File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Samples/Islands/DrawingIsland/CalculatorDemo Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1
1
// // Copyright (c) Microsoft. All rights reserved.
2
2
// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
3
3
4
+ using Microsoft . UI . Dispatching ;
4
5
using System . Windows ;
5
6
6
7
namespace CalculatorDemo
@@ -10,5 +11,21 @@ namespace CalculatorDemo
10
11
/// </summary>
11
12
public partial class App : Application
12
13
{
14
+ // Many WinAppSDK APIs require a DispatcherQueue to be running on the thread. We'll start one when the app starts up
15
+ // and shut it down when the app is finished.
16
+ protected override void OnStartup ( StartupEventArgs e )
17
+ {
18
+ _dispatcherQueueController = DispatcherQueueController . CreateOnCurrentThread ( ) ;
19
+ base . OnStartup ( e ) ;
20
+ }
21
+
22
+ protected override void OnExit ( ExitEventArgs e )
23
+ {
24
+ base . OnExit ( e ) ;
25
+ _dispatcherQueueController ? . ShutdownQueue ( ) ;
26
+ _dispatcherQueueController = null ;
27
+ }
28
+
29
+ DispatcherQueueController ? _dispatcherQueueController ;
13
30
}
14
31
}
You can’t perform that action at this time.
0 commit comments