File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
Microsoft.Toolkit.Uwp.SampleApp Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 33// See the LICENSE file in the project root for more information.
44
55using System ;
6+ using System . Threading . Tasks ;
67using Microsoft . Toolkit . Uwp . Helpers ;
78using Microsoft . Toolkit . Uwp . SampleApp . Common ;
89using Microsoft . Toolkit . Uwp . SampleApp . SamplePages ;
@@ -163,7 +164,7 @@ private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
163164 /// </summary>
164165 /// <param name="sender">The source of the suspend request.</param>
165166 /// <param name="e">Details about the suspend request.</param>
166- private void OnSuspending ( object sender , SuspendingEventArgs e )
167+ private async void OnSuspending ( object sender , SuspendingEventArgs e )
167168 {
168169 var deferral = e . SuspendingOperation . GetDeferral ( ) ;
169170
@@ -179,7 +180,18 @@ private void OnSuspending(object sender, SuspendingEventArgs e)
179180 // ignore
180181 }
181182
182- deferral . Complete ( ) ;
183+ try
184+ {
185+ await Task . Delay ( 2000 ) ;
186+ }
187+ catch
188+ {
189+ // ignore
190+ }
191+ finally
192+ {
193+ deferral . Complete ( ) ;
194+ }
183195 }
184196 }
185197}
You can’t perform that action at this time.
0 commit comments