protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { Sticky sticky; if (NavigationContext.QueryString.TryGetValue("tile", out id)) { if (settings.TryGetValue(id, out sticky)) { Sticky = sticky; DataContext = Sticky; return; } } Sticky = new Sticky { FrontColor = (Color)App.Current.Resources["PhoneAccentColor"], BackColor = (Color)App.Current.Resources["PhoneAccentColor"], FrontTextColor = Colors.White, BackTextColor = Colors.White, FrontSize = 20, BackSize = 20 }; DataContext = Sticky; }
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e) { if (e.NavigationMode == System.Windows.Navigation.NavigationMode.New) { CreateDonationPopup(); } Sticky sticky; if (NavigationContext.QueryString.TryGetValue("tile", out id) && settings.TryGetValue(id, out sticky)) { // Launching pinned sticky Sticky = sticky; // Change pin button to save button var button = (MainAppbar.Buttons[0] as ApplicationBarIconButton); button.IconUri = new Uri("/icons/appbar.save.rest.png", UriKind.Relative); button.Text = "save"; FlurryWP7SDK.Api.LogEvent("Editing tile"); } else if (State.ContainsKey("sticky")) { // Restore from tombstone Sticky = State["sticky"] as Sticky; } else { // New sticky Sticky = new Sticky { FrontColor = Colors.Transparent, BackColor = Colors.Transparent, FrontTextColor = Colors.White, BackTextColor = Colors.White, FrontSize = 20, BackSize = 20 }; } DataContext = Sticky; DeleteOldTiles(); FrontBackgroundPicker.ItemsSource = BackgroundType; BackBackgroundPicker.ItemsSource = BackgroundType; }