In my windows phone 7 application, i have created a button to change the default background image and the users can have their own custom skins on the app. It worked perfectly. But when the users exits the app and relaunches it again the application’s background image is changed to default. But what i needed is, the application should have the last image that is chosen by the user even is launched no. of times. Can anyone help me with this? Thanks in advance for your hard work!
private void BackgroundBrowserIcon_MouseEnter(object sender, MouseEventArgs e)
{
var PhotoChooser = new PhotoChooserTask();
PhotoChooser.Completed += new EventHandler<PhotoResult>(PhotoChooser_Completed);
PhotoChooser.Show();
}
void PhotoChooser_Completed(object sender, PhotoResult e)
{
{
if (e.TaskResult == TaskResult.OK)
{
System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage();
bmp.SetSource(e.ChosenPhoto);
var app = Application.Current as App;
if (app == null)
return;
var imageBrush = new ImageBrush { ImageSource = bmp, Opacity = 1.0d };
this.LayoutRoot.Background = imageBrush;
app.backchanged = true;
app.appbrush = imageBrush;
}
}
}
Are you using IsolatedStorageSettings to store the last chosen photo, and then loading it on app launch?
Update:
Check out this post, as it explains how to code exactly what you are looking to accomplish: http://www.windowsphonegeek.com/tips/All-about-WP7-Isolated-Storage—Read-and-Save-Captured-Image