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 3
3
// See the LICENSE file in the project root for more information.
4
4
5
5
using System ;
6
+ using System . Threading . Tasks ;
6
7
using Microsoft . Toolkit . Uwp . Helpers ;
7
8
using Microsoft . Toolkit . Uwp . SampleApp . Common ;
8
9
using Microsoft . Toolkit . Uwp . SampleApp . SamplePages ;
@@ -163,7 +164,7 @@ private void OnNavigationFailed(object sender, NavigationFailedEventArgs e)
163
164
/// </summary>
164
165
/// <param name="sender">The source of the suspend request.</param>
165
166
/// <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 )
167
168
{
168
169
var deferral = e . SuspendingOperation . GetDeferral ( ) ;
169
170
@@ -179,7 +180,18 @@ private void OnSuspending(object sender, SuspendingEventArgs e)
179
180
// ignore
180
181
}
181
182
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
+ }
183
195
}
184
196
}
185
197
}
You can’t perform that action at this time.
0 commit comments