mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
#21 Add Disable option for each plugin.
This commit is contained in:
@@ -15,6 +15,14 @@ namespace Wox.Infrastructure.Storage
|
||||
private static object locker = new object();
|
||||
private static T storage;
|
||||
|
||||
public event Action<T> AfterLoadConfig;
|
||||
|
||||
protected virtual void OnAfterLoadConfig(T obj)
|
||||
{
|
||||
Action<T> handler = AfterLoadConfig;
|
||||
if (handler != null) handler(obj);
|
||||
}
|
||||
|
||||
protected abstract string ConfigName { get; }
|
||||
|
||||
public static T Instance
|
||||
@@ -53,6 +61,7 @@ namespace Wox.Infrastructure.Storage
|
||||
try
|
||||
{
|
||||
storage = JsonConvert.DeserializeObject<T>(json);
|
||||
OnAfterLoadConfig(storage);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Wox.Infrastructure.Storage.UserSettings
|
||||
{
|
||||
public class CustomizedPluginConfig
|
||||
{
|
||||
public string ID { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Actionword { get; set; }
|
||||
|
||||
public bool Disabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,8 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
||||
[JsonProperty]
|
||||
public List<FolderLink> FolderLinks { get; set; } //Aaron
|
||||
|
||||
public List<CustomizedPluginConfig> CustomizedPluginConfigs { get; set; }
|
||||
|
||||
[JsonProperty]
|
||||
public List<CustomPluginHotkey> CustomPluginHotkeys { get; set; }
|
||||
|
||||
@@ -147,6 +149,7 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
||||
ReplaceWinR = true;
|
||||
WebSearches = LoadDefaultWebSearches();
|
||||
ProgramSources = LoadDefaultProgramSources();
|
||||
CustomizedPluginConfigs = new List<CustomizedPluginConfig>();
|
||||
Hotkey = "Alt + Space";
|
||||
QueryBoxFont = FontFamily.GenericSansSerif.Name;
|
||||
ResultItemFont = FontFamily.GenericSansSerif.Name;
|
||||
@@ -156,6 +159,13 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
||||
HideWhenDeactive = false;
|
||||
}
|
||||
|
||||
protected override void OnAfterLoadConfig(UserSettingStorage storage)
|
||||
{
|
||||
if (storage.CustomizedPluginConfigs == null)
|
||||
{
|
||||
storage.CustomizedPluginConfigs = new List<CustomizedPluginConfig>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum OpacityMode
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PeHeaderReader.cs" />
|
||||
<Compile Include="Storage\UserSettings\CustomizedPluginConfig.cs" />
|
||||
<Compile Include="Storage\UserSettings\FolderLink.cs" />
|
||||
<Compile Include="Unidecoder.Characters.cs" />
|
||||
<Compile Include="ChineseToPinYin.cs" />
|
||||
|
||||
Reference in New Issue
Block a user