Skip to content

Instantly share code, notes, and snippets.

@biac
Created December 6, 2011 06:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biac/1437083 to your computer and use it in GitHub Desktop.
Save biac/1437083 to your computer and use it in GitHub Desktop.
BasicToastsSample から抜粋
public partial class App
{
public App()
{
InitializeComponent();
this.Suspending += new SuspendingEventHandler(OnSuspending);
}
async protected void OnSuspending(object sender, SuspendingEventArgs args)
{
SuspendingDeferral deferral = args.SuspendingOperation.GetDeferral();
await SuspensionManager.SaveAsync();
deferral.Complete(); //一時停止されてもOKだという通知
}
async protected override void OnLaunched(LaunchActivatedEventArgs args)
{
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
// Do an asynchronous restore
await SuspensionManager.RestoreAsync();
}
Window.Current.Content = new MainPage();
Window.Current.Activate();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment