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()
58
58
API . SavePluginSettings ( ) ;
59
59
}
60
60
61
+ public static async ValueTask DisposePluginsAsync ( )
62
+ {
63
+ foreach ( var plugin in AllPlugins )
64
+ {
65
+ switch ( 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
+
61
77
public static async Task ReloadData ( )
62
78
{
63
79
await Task . WhenAll ( AllPlugins . Select ( plugin => plugin . Plugin switch
Original file line number Diff line number Diff line change 11
11
using Flow . Launcher . Helper ;
12
12
using Flow . Launcher . Infrastructure . UserSettings ;
13
13
using Flow . Launcher . ViewModel ;
14
+ using Application = System . Windows . Application ;
14
15
using Screen = System . Windows . Forms . Screen ;
15
16
using ContextMenuStrip = System . Windows . Forms . ContextMenuStrip ;
16
17
using DataFormats = System . Windows . DataFormats ;
@@ -46,10 +47,13 @@ public MainWindow()
46
47
InitializeComponent ( ) ;
47
48
}
48
49
49
- private void OnClosing ( object sender , CancelEventArgs e )
50
+ private async void OnClosing ( object sender , CancelEventArgs e )
50
51
{
51
52
_notifyIcon . Visible = false ;
52
53
_viewModel . Save ( ) ;
54
+ e . Cancel = true ;
55
+ await PluginManager . DisposePluginsAsync ( ) ;
56
+ Application . Current . Shutdown ( ) ;
53
57
}
54
58
55
59
private void OnInitialized ( object sender , EventArgs e )
You can’t perform that action at this time.
0 commit comments