@@ -11,7 +11,7 @@ public class Main : IPlugin, IPluginI18n, IContextMenu, ISettingProvider
11
11
{
12
12
internal static PluginInitContext Context { get ; private set ; }
13
13
14
- internal static Settings Settings { get ; private set ; }
14
+ private Settings _settings ;
15
15
16
16
private readonly ProcessHelper processHelper = new ( ) ;
17
17
@@ -20,8 +20,8 @@ public class Main : IPlugin, IPluginI18n, IContextMenu, ISettingProvider
20
20
public void Init ( PluginInitContext context )
21
21
{
22
22
Context = context ;
23
- Settings = context . API . LoadSettingJsonStorage < Settings > ( ) ;
24
- _viewModel = new SettingsViewModel ( Settings ) ;
23
+ _settings = context . API . LoadSettingJsonStorage < Settings > ( ) ;
24
+ _viewModel = new SettingsViewModel ( _settings ) ;
25
25
}
26
26
27
27
public List < Result > Query ( Query query )
@@ -31,12 +31,12 @@ public List<Result> Query(Query query)
31
31
32
32
public string GetTranslatedPluginTitle ( )
33
33
{
34
- return Context . API . GetTranslation ( " flowlauncher_plugin_processkiller_plugin_name" ) ;
34
+ return Localize . flowlauncher_plugin_processkiller_plugin_name ( ) ;
35
35
}
36
36
37
37
public string GetTranslatedPluginDescription ( )
38
38
{
39
- return Context . API . GetTranslation ( " flowlauncher_plugin_processkiller_plugin_description" ) ;
39
+ return Localize . flowlauncher_plugin_processkiller_plugin_description ( ) ;
40
40
}
41
41
42
42
public List < Result > LoadContextMenus ( Result result )
@@ -51,7 +51,7 @@ public List<Result> LoadContextMenus(Result result)
51
51
{
52
52
menuOptions . Add ( new Result
53
53
{
54
- Title = Context . API . GetTranslation ( " flowlauncher_plugin_processkiller_kill_instances" ) ,
54
+ Title = Localize . flowlauncher_plugin_processkiller_kill_instances ( ) ,
55
55
SubTitle = processPath ,
56
56
Action = _ =>
57
57
{
@@ -73,7 +73,7 @@ private List<Result> CreateResultsFromQuery(Query query)
73
73
{
74
74
// Get all non-system processes
75
75
var allPocessList = processHelper . GetMatchingProcesses ( ) ;
76
- if ( ! allPocessList . Any ( ) )
76
+ if ( allPocessList . Count == 0 )
77
77
{
78
78
return null ;
79
79
}
@@ -82,9 +82,9 @@ private List<Result> CreateResultsFromQuery(Query query)
82
82
var searchTerm = query . Search ;
83
83
var processlist = new List < ProcessResult > ( ) ;
84
84
var processWindowTitle =
85
- Settings . ShowWindowTitle || Settings . PutVisibleWindowProcessesTop ?
85
+ _settings . ShowWindowTitle || _settings . PutVisibleWindowProcessesTop ?
86
86
ProcessHelper . GetProcessesWithNonEmptyWindowTitle ( ) :
87
- new Dictionary < int , string > ( ) ;
87
+ [ ] ;
88
88
if ( string . IsNullOrWhiteSpace ( searchTerm ) )
89
89
{
90
90
foreach ( var p in allPocessList )
@@ -97,8 +97,8 @@ private List<Result> CreateResultsFromQuery(Query query)
97
97
// Use window title for those processes if enabled
98
98
processlist . Add ( new ProcessResult (
99
99
p ,
100
- Settings . PutVisibleWindowProcessesTop ? 200 : 0 ,
101
- Settings . ShowWindowTitle ? windowTitle : progressNameIdTitle ,
100
+ _settings . PutVisibleWindowProcessesTop ? 200 : 0 ,
101
+ _settings . ShowWindowTitle ? windowTitle : progressNameIdTitle ,
102
102
null ,
103
103
progressNameIdTitle ) ) ;
104
104
}
@@ -129,14 +129,14 @@ private List<Result> CreateResultsFromQuery(Query query)
129
129
{
130
130
// Add score to prioritize processes with visible windows
131
131
// Use window title for those processes
132
- if ( Settings . PutVisibleWindowProcessesTop )
132
+ if ( _settings . PutVisibleWindowProcessesTop )
133
133
{
134
134
score += 200 ;
135
135
}
136
136
processlist . Add ( new ProcessResult (
137
137
p ,
138
138
score ,
139
- Settings . ShowWindowTitle ? windowTitle : progressNameIdTitle ,
139
+ _settings . ShowWindowTitle ? windowTitle : progressNameIdTitle ,
140
140
score == windowTitleMatch . Score ? windowTitleMatch : null ,
141
141
progressNameIdTitle ) ) ;
142
142
}
@@ -194,8 +194,8 @@ private List<Result> CreateResultsFromQuery(Query query)
194
194
sortedResults . Insert ( 1 , new Result ( )
195
195
{
196
196
IcoPath = firstResult ? . IcoPath ,
197
- Title = string . Format ( Context . API . GetTranslation ( " flowlauncher_plugin_processkiller_kill_all" ) , firstResult ? . ContextData ) ,
198
- SubTitle = string . Format ( Context . API . GetTranslation ( " flowlauncher_plugin_processkiller_kill_all_count" ) , processlist . Count ) ,
197
+ Title = Localize . flowlauncher_plugin_processkiller_kill_all ( firstResult ? . ContextData ) ,
198
+ SubTitle = Localize . flowlauncher_plugin_processkiller_kill_all_count ( processlist . Count ) ,
199
199
Score = 200 ,
200
200
Action = ( c ) =>
201
201
{
0 commit comments