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 11// // Copyright (c) Microsoft. All rights reserved.
22// // Licensed under the MIT license. See LICENSE file in the project root for full license information.
33
4+ using Microsoft . UI . Dispatching ;
45using System . Windows ;
56
67namespace CalculatorDemo
@@ -10,5 +11,21 @@ namespace CalculatorDemo
1011 /// </summary>
1112 public partial class App : Application
1213 {
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 ;
1330 }
1431}
You can’t perform that action at this time.
0 commit comments