■ SuspendingDeferral 클래스 : 비동기 처리 대기하기

----------------------------------------------------------------------------------------------------

using Windows.ApplicationModel;

using Windows.Storage;

using Windows.UI.Xaml;

using Windows.UI.Xaml.Controls;

 

...

 

private TextBox textBox;

 

...

 

Application.Current.Suspending += Application_Suspending;

 

...

 

private async void Application_Suspending(object sender, SuspendingEventArgs e)

{

    SuspendingDeferral suspendingDeferral = e.SuspendingOperation.GetDeferral();

 

    await PathIO.WriteTextAsync("ms-appdata:///local/sample.txt", this.textBox.Text);

 

    suspendingDeferral.Complete();

}

 

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker

댓글을 달아 주세요