2020-05-11 13:15:15 +00:00
|
|
|
|
using Flow.Launcher.Infrastructure.Storage;
|
2020-06-08 04:20:22 +00:00
|
|
|
|
using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
|
2020-05-11 13:15:15 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Flow.Launcher.Plugin.Explorer.ViewModels
|
|
|
|
|
|
{
|
|
|
|
|
|
public class SettingsViewModel
|
|
|
|
|
|
{
|
2020-06-08 04:20:22 +00:00
|
|
|
|
private readonly PluginJsonStorage<Settings> storage;
|
2020-05-11 13:15:15 +00:00
|
|
|
|
|
2020-06-08 04:20:22 +00:00
|
|
|
|
internal Settings Settings { get; set; }
|
2020-05-11 13:15:15 +00:00
|
|
|
|
|
2020-06-08 04:20:22 +00:00
|
|
|
|
internal PluginInitContext Context { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public SettingsViewModel(PluginInitContext context)
|
2020-05-11 13:15:15 +00:00
|
|
|
|
{
|
2020-06-08 04:20:22 +00:00
|
|
|
|
Context = context;
|
|
|
|
|
|
storage = new PluginJsonStorage<Settings>();
|
|
|
|
|
|
Settings = storage.Load();
|
2020-05-11 13:15:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Save()
|
|
|
|
|
|
{
|
2020-06-08 04:20:22 +00:00
|
|
|
|
storage.Save();
|
2020-05-11 13:15:15 +00:00
|
|
|
|
}
|
2020-06-08 04:20:22 +00:00
|
|
|
|
|
|
|
|
|
|
internal void RemoveFolderLinkFromQuickFolders(FolderLink selectedRow) => Settings.QuickFolderAccessLinks.Remove(selectedRow);
|
|
|
|
|
|
|
|
|
|
|
|
internal void RemoveFolderLinkFromExcludedIndexPaths(FolderLink selectedRow) => Settings.IndexSearchExcludedSubdirectoryPaths.Remove(selectedRow);
|
2020-05-11 13:15:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
}
|