add save after adding to quick access

This commit is contained in:
Jeremy Wu 2021-01-26 21:14:39 +11:00
parent dd57bfc6f8
commit d90b6d23d3
2 changed files with 9 additions and 2 deletions

View file

@ -13,6 +13,7 @@ using MessageBox = System.Windows.Forms.MessageBox;
using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon; using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon;
using MessageBoxButton = System.Windows.Forms.MessageBoxButtons; using MessageBoxButton = System.Windows.Forms.MessageBoxButtons;
using DialogResult = System.Windows.Forms.DialogResult; using DialogResult = System.Windows.Forms.DialogResult;
using Flow.Launcher.Plugin.Explorer.ViewModels;
namespace Flow.Launcher.Plugin.Explorer namespace Flow.Launcher.Plugin.Explorer
{ {
@ -22,10 +23,13 @@ namespace Flow.Launcher.Plugin.Explorer
private Settings Settings { get; set; } private Settings Settings { get; set; }
public ContextMenu(PluginInitContext context, Settings settings) private SettingsViewModel ViewModel { get; set; }
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)
@ -68,6 +72,9 @@ namespace Flow.Launcher.Plugin.Explorer
Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"), Context.API.GetTranslation("plugin_explorer_addfilefoldersuccess_detail"),
fileOrFolder), fileOrFolder),
Constants.ExplorerIconImageFullPath); Constants.ExplorerIconImageFullPath);
ViewModel.Save();
return true; return true;
} }
catch (Exception e) catch (Exception e)

View file

@ -38,7 +38,7 @@ namespace Flow.Launcher.Plugin.Explorer
if (Settings.QuickFolderAccessLinks.Any()) if (Settings.QuickFolderAccessLinks.Any())
Settings.QuickAccessLinks = Settings.QuickFolderAccessLinks; Settings.QuickAccessLinks = Settings.QuickFolderAccessLinks;
contextMenu = new ContextMenu(Context, Settings); contextMenu = new ContextMenu(Context, Settings, viewModel);
searchManager = new SearchManager(Settings, Context); searchManager = new SearchManager(Settings, Context);
} }