From d4d7215bf0db562b4a616e30ea9b54e2b71950a3 Mon Sep 17 00:00:00 2001 From: Ran Bi Date: Wed, 24 Nov 2021 12:59:07 +0800 Subject: [PATCH] ExtendedExecution: Remove confusing suspending deferral field --- .../ExtendedExecution/cs/Scenario2_SavingDataReason.xaml.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Samples/ExtendedExecution/cs/Scenario2_SavingDataReason.xaml.cs b/Samples/ExtendedExecution/cs/Scenario2_SavingDataReason.xaml.cs index 8723e7baf2..e2c4cd72d3 100644 --- a/Samples/ExtendedExecution/cs/Scenario2_SavingDataReason.xaml.cs +++ b/Samples/ExtendedExecution/cs/Scenario2_SavingDataReason.xaml.cs @@ -30,7 +30,6 @@ public sealed partial class SavingDataReason : Page private MainPage rootPage = MainPage.Current; private CancellationTokenSource cancellationTokenSource; - private SuspendingDeferral suspendDeferral; public SavingDataReason() { @@ -50,7 +49,7 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e) private async void OnSuspending(object sender, SuspendingEventArgs args) { - suspendDeferral = args.SuspendingOperation.GetDeferral(); + var suspendDeferral = args.SuspendingOperation.GetDeferral(); rootPage.NotifyUser("", NotifyType.StatusMessage); @@ -112,9 +111,6 @@ await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => rootPage.NotifyUser("Extended execution revoked due to system policy.", NotifyType.StatusMessage); break; } - - suspendDeferral?.Complete(); - suspendDeferral = null; }); } }