20. • App is suspended
• All code stopped
• No timers tick
• No events fire
• Process still alive and in memory
• Code has a chance to respond
(next slide)
22. • Same app is resumed
• Same process, same memory so
values of variables are intact
• All code runs
• Code has a chance to respond.
Launch Switcher
23. public App()
{
this.InitializeComponent();
this.Suspending += this.OnSuspending;
this.Resuming += App_Resuming;
}
void App_Resuming(object sender, object e)
{
// TODO: whatever you need to do to resume your app
}
29. protected override void OnLaunched(LaunchActivatedEventArgs e)
{
Frame rootFrame = Window.Current.Content as Frame;
// Do not repeat app initialization when the Window already has
// content, just ensure that the window is active
if (rootFrame == null)
{
// Create a Frame to act as the navigation context and navigate
// to the first page
rootFrame = new Frame();
...
// Place the frame in the current Window
Window.Current.Content = rootFrame;
}
if (rootFrame.Content == null)
{
// Navigate to the first page
rootFrame.Navigate(typeof(MainPage), e.Arguments);
}
// Ensure the current window is active
Window.Current.Activate();
}
30. private void itemListView_ItemClick(object sender, ItemClickEventArgs e)
{
// Navigate to the appropriate destination page, configuring the new page
// by passing required information as a navigation parameter
var itemId = ((MyListViewItem)e.ClickedItem).UniqueId;
Frame.Navigate(typeof(MyDetailPage), itemId);
}