Remove unnecessary view model reference

This commit is contained in:
VictoriousRaptor 2025-07-18 00:15:46 +08:00
parent 2018956034
commit 7ca0dba461
2 changed files with 4 additions and 8 deletions

View file

@ -21,13 +21,10 @@ namespace Flow.Launcher.Plugin.Explorer
private Settings Settings { get; set; } private Settings Settings { get; set; }
private SettingsViewModel ViewModel { get; set; } public ContextMenu(PluginInitContext context, Settings settings)
public ContextMenu(PluginInitContext context, Settings settings, SettingsViewModel vm)
{ {
Context = context; Context = context;
Settings = settings; Settings = settings;
ViewModel = vm;
} }
public List<Result> LoadContextMenus(Result selectedResult) public List<Result> LoadContextMenus(Result selectedResult)
@ -84,7 +81,7 @@ namespace Flow.Launcher.Plugin.Explorer
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"), Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
Constants.ExplorerIconImageFullPath); Constants.ExplorerIconImageFullPath);
ViewModel.Save(); Context.API.SaveSettingJsonStorage<Settings>();
return true; return true;
}, },
@ -108,7 +105,7 @@ namespace Flow.Launcher.Plugin.Explorer
Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess_detail"), Context.API.GetTranslation("plugin_explorer_removefilefoldersuccess_detail"),
Constants.ExplorerIconImageFullPath); Constants.ExplorerIconImageFullPath);
ViewModel.Save(); Context.API.SaveSettingJsonStorage<Settings>();
return true; return true;
}, },

View file

@ -38,8 +38,7 @@ namespace Flow.Launcher.Plugin.Explorer
FillQuickAccessLinkNames(); FillQuickAccessLinkNames();
viewModel = new SettingsViewModel(context, Settings); viewModel = new SettingsViewModel(context, Settings);
contextMenu = new ContextMenu(Context, Settings);
contextMenu = new ContextMenu(Context, Settings, viewModel);
searchManager = new SearchManager(Settings, Context); searchManager = new SearchManager(Settings, Context);
ResultManager.Init(Context, Settings); ResultManager.Init(Context, Settings);