CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Format:
Recent snippets for: Jerry Nixon
C#
private void PhoneApplicationPage_ManipulationDelta1(object sender, ManipulationDeltaEventArgs e)
{
    MyTransform1.X += e.DeltaManipulation.Translation.X;
    MyTransform1.Y += e.DeltaManipulation.Translation.Y;
    Collide();
}
 
private void PhoneApplicationPage_ManipulationDelta2(object sender, ManipulationDeltaEventArgs e)
{
    MyTransform2.X += e.DeltaManipulation.Translation.X;
by Jerry Nixon   Monday @ 9:37pm
Tags:
15 Views
no comments
 
XML
<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>
 
    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
        <TextBlock x:Name="ApplicationTitle" Text="MY APPLICATION" Style="{StaticResource PhoneTextNormalStyle}"/>
by Jerry Nixon   Monday @ 9:36pm
Tags:
16 Views
no comments
 
C#
public partial class MainPage : PhoneApplicationPage
{
    // Constructor
    public MainPage()
    {
        InitializeComponent();
        MyListBox.ItemsSource = new string[] { "Red", "Green", "Blue" };
    }
 
    private void MyListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
by Jerry Nixon   January 19, 2012 @ 1:37pm
Tags: WP, Tiles
70 Views
no comments
 
C#
ObservableCollection<string> m_Data;
public MainPage()
{
    InitializeComponent();
    m_Data = new ObservableCollection<string>
    {
        "One", "Two", "Three", "Four"
    };
    MyListBox.ItemsSource = m_Data;
}
by Jerry Nixon   January 19, 2012 @ 8:53am
Tags: WP, XAML, Animation
33 Views
no comments
 
C#
ObservableCollection<string> m_Data;
public MainPage()
{
    InitializeComponent();
    m_Data = new ObservableCollection<string> 
    { 
        "One", "Two", "Three", "Four"
    };
    MyListBox.ItemsSource = m_Data;
}
by Jerry Nixon   January 19, 2012 @ 8:52am
Tags: WP, XAML, Animation
28 Views
no comments
 
C#
public class MatchConverter : IValueConverter
{
    public object Convert(object value, Type targetType,
        object parameter, System.Globalization.CultureInfo c)
    {
        if (value == null && Match == null)
            return Then;
 
        // convert Match to the value's type
        if (Match != null && value != null)
by Jerry Nixon   January 10, 2012 @ 4:07pm
36 Views
no comments
 
C#
public sealed class InfoHub: INotifyPropertyChanged
{
    /* VERSION 1.0 // 2012.01.06 // blog.jerrynixon.com */
    /* SEND UPDATES/BUGS/SUGGESTIONS TO jnixon@microsoft.com */
 
    public enum Theme { Light, Dark }
    public enum Version { Nodo, Mango, Tango, Apollo, Unkown }
    public enum Accent { Blue, Pink, Brown, Purple, Green, Red, Lime, Teal, Magenta, Mango, Other }
 
    // used for the blocking Load()
by Jerry Nixon   January 06, 2012 @ 3:24pm
Tags: WP7, Info Hub
118 Views
1 comments
 
C#
static void Delete(PhoneApplicationPage page,
    UIElement item, Action callback)
{
    // setup
    var _Scale = new ScaleTransform
    {
        ScaleX = 1,
        ScaleY = 1,
        CenterX = item.RenderSize.Width / 2,
        CenterY = item.RenderSize.Height / 2,
by Jerry Nixon   January 04, 2012 @ 9:06am
Tags: Animation, WP7
48 Views
no comments
 
C#
public ItemViewer()
{
    InitializeComponent();
    Loaded += ItemViewer_Loaded;
}
 
void ItemViewer_Loaded(object sender, RoutedEventArgs e)
{
    if (LayoutRoot.Visibility != Visibility.Collapsed)
        throw new Exception("item.Visibility != Collapsed");
by Jerry Nixon   January 03, 2012 @ 5:06pm
Tags: WP7, Animate
64 Views
no comments
 
C#
private void MyListBox_SelectionChanged(object sender, 
    SelectionChangedEventArgs e)
{
    // get the ListBoxItem that was pressed
    var _UIElement = MyListBox.ItemContainerGenerator
        .ContainerFromItem(MyListBox.SelectedItem) as UIElement;
 
    // resize the ListBoxItem
    Resize(_UIElement, () => { /* TODO: nav away */ }, 1, .25, .1);
}
by Jerry Nixon   January 03, 2012 @ 3:42pm
Tags: WP7, ANimation
48 Views
no comments
 
C#
Rectangle m_Rectangle;
TranslateTransform m_Transform;
Microsoft.Devices.Sensors.Accelerometer m_Accelerometer;
 
public MainPage()
{
    InitializeComponent();
    Loaded += MainPage_Loaded;
    Unloaded += (s, e) => { m_Accelerometer.Stop(); };
}
by Jerry Nixon   December 13, 2011 @ 11:03am
121 Views
no comments
 
C#
static void Main(string[] args)
{
    Console.WriteLine(PhoneNumber("12345678901234"));
    Console.WriteLine(PhoneNumber("1234567890123"));
    Console.WriteLine(PhoneNumber("123456789012"));
    Console.WriteLine(PhoneNumber("12345678901"));
    Console.WriteLine(PhoneNumber("1234567890"));
    Console.WriteLine(PhoneNumber("123456789"));
    Console.WriteLine(PhoneNumber("12345678"));
    Console.WriteLine(PhoneNumber("1234567"));
by Jerry Nixon   December 06, 2011 @ 8:10am
Tags: C#, Format
71 Views
no comments
 
C#
public static bool IsDouble(TextBox textBox, Key newKey)
{
    var _Letter = string.Empty;
    switch (newKey)
    {
        case Key.A: _Letter = "A"; break;
        case Key.Add: _Letter = "+"; break;
        case Key.Alt: break;
        case Key.B: _Letter = "B"; break;
        case Key.Back: break;
by Jerry Nixon   November 23, 2011 @ 8:57am
Tags: WP, SL
62 Views
no comments
 
C#
public partial class MainPage : PhoneApplicationPage
{
    // Constructor
    public MainPage()
    {
        InitializeComponent();
        LoadButton.Click += LoadButton_Click;
        SaveButton.Click += SaveButton_Click;
    }
by Jerry Nixon   November 22, 2011 @ 7:04pm
Tags: WP, WCF
54 Views
no comments
 
C#
public class HandleTheme
{
    // light
    public static string GetLightUrl(DependencyObject obj)
    {
        return (string)obj.GetValue(LightUrlProperty);
    }
    public static void SetLightUrl(DependencyObject obj, string value)
    {
        obj.SetValue(LightUrlProperty, value);
by Jerry Nixon   November 18, 2011 @ 9:36am
82 Views
no comments
 
C#
public partial class MyDataContext : System.Data.Linq.DataContext
{
    public void OnCreated()
    {
        if (!this.DatabaseExists())
            MoveDatabase("MyDatabase.sdf");
    }
 
    public static void MoveDatabase(string name)
    {
by Jerry Nixon   November 10, 2011 @ 10:13am
102 Views
no comments
 
C#
public abstract class ViewModelBase : INotifyPropertyChanged
{
    public event PropertyChangedEventHandler PropertyChanged;
    protected void RaisePropertyChanged(string property)
    {
        if (PropertyChanged == null)
            return;
        PropertyChanged(this,
            new PropertyChangedEventArgs(property));
        PropertyChanged(this,
by Jerry Nixon   November 08, 2011 @ 10:39am
Tags: MVVM, C#
100 Views
no comments
 
XML
<!-- CTRL+K, CTRL+X = Insert Snippet -->
<!-- CTRL+K, CTRL+B = Manage Snippets -->
<CodeSnippet Format="1.0.0" 
             xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  
  <Header>
    <Title>Property with NotifyPropertyChanged</Title>
    <Author>Jerry Nixon</Author>
    <Shortcut>propnote</Shortcut>
    <Description>Property with NotifyPropertyChanged</Description>
by Jerry Nixon   November 08, 2011 @ 9:29am
289 Views
1 comments
 
C#
void DoQuery()
{
    // Register for the LoadCompleted event.
    var _Data = new DataServiceCollection<CityCrime>();
    _Data.LoadCompleted += _Data_LoadCompleted;
 
    // start the servery query
    var _Query = GetContext().CityCrime
        .Where(x => x.State == "Colorado")
        .Where(x => x.City == "Denver");
by Jerry Nixon   November 07, 2011 @ 3:56pm
71 Views
no comments
 
C#
// https://datamarket.azure.com/
private const string AZUREDATAACCOUNT = "Your Customer ID";
private const string AZUREDATAKEY = "Your Account Key";
private const string AZUREDATAURL = 
    "https://api.datamarket.azure.com/Data.ashx/data.gov/Crimes/";
 
// create a new context to the odata feed
private static Mango.Sample.AzureMarket
    .CityCrimeService.datagovCrimesContainer GetContext()
{
by Jerry Nixon   November 07, 2011 @ 3:28pm
57 Views
no comments
 
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate