January, 2012

  • File → New Project

    You've Got Game Sweepstakes for Game Developers



    You still have time to get your game into the You've Got Game Sweepstakes before the February 29th deadline. For every game you create and publish a to the Windows Phone Marketplace, you get another entry for a chance at winning a Dell Alienware M18x laptop or an Xbox LIVE Gold Card.

    Head over to http://aka.ms/ygg to find out more about the contest, how to enter, and what you can win. Rules are at http://bit.ly/YGGRules

  • File → New Project

    Basic Tombstoning with IsolatedStorage


    I was talking with my good buddy Sam Stokes today about a group of students he is working with who are having some trouble with

    saving the state of their applications. He was looking for a way to show them an example on a single page, just to get the concept across. As we often do, we loaded up a screen sharing session and created a new project to build a sample out.

    To start with, we wanted to be able to show that the state was being saved, so we dropped a couple of controls onto the page.


    We added event handlers for the OnNavigatedTo, and OnNavigatedFrom events. When we navigate to the page, we'll check to see if anything was saved and load the values. When we navigate away, we'll save everything to IsolatedStorage.

    Saving and Loading State
    1. public void SaveStateToIsolatedStorage()
    2. {
    3.     IsolatedStorageSettings isolatedStore = IsolatedStorageSettings.ApplicationSettings;
    5.     isolatedStore.Remove("textBox1");
    6.     isolatedStore.Add("textBox1", textBox1.Text);
    8.     isolatedStore.Remove("checkBox1");
    9.     isolatedStore.Add("checkBox1", checkBox1.IsChecked.ToString());
    11.     isolatedStore.Save();
    12. }
    14. public void LoadStateFromIsolatedStorage()
    15. {
    16.     IsolatedStorageSettings isolatedStore = IsolatedStorageSettings.ApplicationSettings;
    18.     if (isolatedStore.Contains("textBox1"))
    19.     {
    20.         textBox1.Text = (string)isolatedStore["textBox1"];
    21.     }
    23.     if (isolatedStore.Contains("checkBox1"))
    24.     {
    25.         bool isChecked = false;
    26.         if (bool.TryParse((string)isolatedStore["checkBox1"], out isChecked))
    27.         {
    28.             checkBox1.IsChecked = isChecked;
    29.         }
    30.     }
    31. }



    If you want to take a look at the project in action, you can download the source code.

    After we got the project up and going, I was inspired to build another project that shows how to use the application events to support Fast Application Switching. I'll post more on that next.

Page 1 of 1 (2 items)