I had a little time while traveling to South Africa so I thought I'd update my Silverlight FlickR demo to Beta2.
Download the full solution read the full writeup
(note: in the application, you can click on the image to advance to the next one)
Overall, the changes were pretty minor, the most interesting one was a change in the way Isolated Storage is accessed.
I set up a page level variable called appsettings:
IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;
Then, when the page is loaded, I initialized based on it.
public Page() { InitializeComponent(); if (appSettings.Contains("searchTerm")) { this.searchTermTextBox.Text = (string)appSettings["searchTerm"]; } if (appSettings.Contains("imageNumber")) { ImageNumber = (int)appSettings["imageNumber"]; } }
Then, at the right time in the application flow, I save data to it
private void searchResultsImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { if (Photos == null) return; if (ImageNumber >= Photos.Count()) ImageNumber = 0; FlickRPhoto p = Photos.Skip(ImageNumber).First(); this.searchResultsImage.Source = new BitmapImage(new Uri (p.ImageUrl)); appSettings["imageNumber"] = ImageNumber; appSettings.Save(); ImageNumber++; }
Notice, I also use Corrina's updated "Flat" style for SL beta2 as well, while the style structure changed a lot to take advantage of the new Visual State Manager, the changes to my code were minimal.