■ Application 클래스의 Suspending 이벤트를 사용하는 방법을 보여준다.
▶ 예제 코드 (C#)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
using Windows.ApplicationModel; using Windows.UI.Xaml; ... Application.Current.Suspending += Application_Suspending; ... #region 애플리케이션 중단시 처리하기 - Application_Suspending(sender, e) /// <summary> /// 애플리케이션 중단시 처리하기 /// </summary> /// <param name="sender">이벤트 발생자</param> /// <param name="e">이벤트 인자</param> private async void Application_Suspending(object sender, SuspendingEventArgs e) { SuspendingDeferral suspendingDeferral = e.SuspendingOperation.GetDeferral(); // 애플리케이션 중단시 처리를 합니다. suspendingDeferral.Complete(); } #endregion |