File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed
Plugins/Flow.Launcher.Plugin.Sys Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -9,34 +9,37 @@ public class ThemeSelector
9
9
{
10
10
public const string Keyword = "fltheme" ;
11
11
12
- private readonly Theme _theme ;
13
12
private readonly PluginInitContext _context ;
14
13
14
+ // Do not initialize it in the constructor, because it will cause null reference in
15
+ // var dicts = Application.Current.Resources.MergedDictionaries; line of Theme
16
+ private Theme theme = null ;
17
+ private Theme Theme => theme ??= Ioc . Default . GetRequiredService < Theme > ( ) ;
18
+
15
19
#region Theme Selection
16
20
17
21
// Theme select codes simplified from SettingsPaneThemeViewModel.cs
18
22
19
23
private Theme . ThemeData _selectedTheme ;
20
24
public Theme . ThemeData SelectedTheme
21
25
{
22
- get => _selectedTheme ??= Themes . Find ( v => v . FileNameWithoutExtension == _theme . GetCurrentTheme ( ) ) ;
26
+ get => _selectedTheme ??= Themes . Find ( v => v . FileNameWithoutExtension == Theme . GetCurrentTheme ( ) ) ;
23
27
set
24
28
{
25
29
_selectedTheme = value ;
26
- _theme . ChangeTheme ( value . FileNameWithoutExtension ) ;
30
+ Theme . ChangeTheme ( value . FileNameWithoutExtension ) ;
27
31
28
- _ = _theme . RefreshFrameAsync ( ) ;
32
+ _ = Theme . RefreshFrameAsync ( ) ;
29
33
}
30
34
}
31
35
32
- private List < Theme . ThemeData > Themes => _theme . LoadAvailableThemes ( ) ;
36
+ private List < Theme . ThemeData > Themes => Theme . LoadAvailableThemes ( ) ;
33
37
34
38
#endregion
35
39
36
40
public ThemeSelector ( PluginInitContext context )
37
41
{
38
42
_context = context ;
39
- _theme = Ioc . Default . GetRequiredService < Theme > ( ) ;
40
43
}
41
44
42
45
public List < Result > Query ( Query query )
You can’t perform that action at this time.
0 commit comments