File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Flow.Launcher.Core/Plugin Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,22 @@ public static void Save()
5858 API . SavePluginSettings ( ) ;
5959 }
6060
61+ public static async ValueTask DisposePluginsAsync ( )
62+ {
63+ foreach ( var pluginPair in AllPlugins )
64+ {
65+ switch ( pluginPair . Plugin )
66+ {
67+ case IDisposable disposable :
68+ disposable . Dispose ( ) ;
69+ break ;
70+ case IAsyncDisposable asyncDisposable :
71+ await asyncDisposable . DisposeAsync ( ) ;
72+ break ;
73+ }
74+ }
75+ }
76+
6177 public static async Task ReloadData ( )
6278 {
6379 await Task . WhenAll ( AllPlugins . Select ( plugin => plugin . Plugin switch
Original file line number Diff line number Diff line change 1111using Flow . Launcher . Helper ;
1212using Flow . Launcher . Infrastructure . UserSettings ;
1313using Flow . Launcher . ViewModel ;
14+ using Application = System . Windows . Application ;
1415using Screen = System . Windows . Forms . Screen ;
1516using ContextMenuStrip = System . Windows . Forms . ContextMenuStrip ;
1617using DataFormats = System . Windows . DataFormats ;
@@ -46,10 +47,13 @@ public MainWindow()
4647 InitializeComponent ( ) ;
4748 }
4849
49- private void OnClosing ( object sender , CancelEventArgs e )
50+ private async void OnClosing ( object sender , CancelEventArgs e )
5051 {
5152 _notifyIcon . Visible = false ;
5253 _viewModel . Save ( ) ;
54+ e . Cancel = true ;
55+ await PluginManager . DisposePluginsAsync ( ) ;
56+ Application . Current . Shutdown ( ) ;
5357 }
5458
5559 private void OnInitialized ( object sender , EventArgs e )
You can’t perform that action at this time.
0 commit comments