Skip to content

Instantly share code, notes, and snippets.

@biac
Created Dec 6, 2011
Embed
What would you like to do?
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