@@ -7,16 +7,50 @@ public class SettingsViewModel
77 {
88 private readonly IEverythingApi api ;
99
10+ private readonly PluginInitContext context ;
11+
1012 private Settings settings ;
11- public SettingsViewModel ( IEverythingApi api , Settings settings )
13+
14+ public SettingsViewModel ( IEverythingApi api , Settings settings , PluginInitContext context )
1215 {
1316 this . api = api ;
1417 this . settings = settings ;
18+ this . context = context ;
1519 }
1620
1721 public Visibility FastSortWarningVisibility
1822 {
19- get => api . IsFastSortOption ( settings . SortOption ) ? Visibility . Hidden : Visibility . Visible ;
23+ get
24+ {
25+ try
26+ {
27+ return api . IsFastSortOption ( settings . SortOption ) ? Visibility . Hidden : Visibility . Visible ;
28+ }
29+ catch ( IPCErrorException )
30+ {
31+ // this error occurs if the Everything service is not running, in this instance show the warning and
32+ // update the message to let user know in the settings panel.
33+ return Visibility . Visible ;
34+ }
35+ }
36+ }
37+
38+ public string GetSortOptionWarningMessage
39+ {
40+ get
41+ {
42+ try
43+ {
44+ // this method is used to determine if Everything service is running because as at Everything v1.4.1
45+ // the sdk does not provide a dedicated interface to determine if it is running.
46+ return api . IsFastSortOption ( settings . SortOption ) ? string . Empty
47+ : context . API . GetTranslation ( "flowlauncher_plugin_everything_nonfastsort_warning" ) ;
48+ }
49+ catch ( IPCErrorException )
50+ {
51+ return context . API . GetTranslation ( "flowlauncher_plugin_everything_is_not_running" ) ;
52+ }
53+ }
2054 }
2155
2256 public SortOption [ ] GetSortOptions
0 commit comments