#21 Add Disable option for each plugin.

This commit is contained in:
qianlifeng
2014-07-01 22:19:46 +08:00
parent 6352408d87
commit e275ce6063
20 changed files with 174 additions and 13 deletions

View File

@@ -1,4 +1,6 @@
using System.Collections.Generic;
using System.Linq;
using Wox.Infrastructure.Storage.UserSettings;
namespace Wox.Plugin.SystemPlugins
{
@@ -6,6 +8,8 @@ namespace Wox.Plugin.SystemPlugins
public abstract class BaseSystemPlugin : ISystemPlugin
{
public string PluginDirectory { get; set; }
public abstract string ID { get; }
public virtual string Name { get { return "System workflow"; } }
public virtual string Description { get { return "System workflow"; } }
public virtual string IcoPath { get { return null; } }
@@ -17,6 +21,11 @@ namespace Wox.Plugin.SystemPlugins
public List<Result> Query(Query query)
{
if (string.IsNullOrEmpty(query.RawQuery)) return new List<Result>();
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == ID);
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
{
return new List<Result>();
}
return QueryInternal(query);
}

View File

@@ -148,6 +148,11 @@ namespace Wox.Plugin.SystemPlugins.CMD
this.context = context;
}
public override string ID
{
get { return "D409510CD0D2481F853690A07E6DC426"; }
}
public override string Name
{
get { return "Shell"; }

View File

@@ -85,6 +85,11 @@ namespace Wox.Plugin.SystemPlugins
this.context = context;
}
public override string ID
{
get { return "CEA0FDFC6D3B4085823D60DC76F28855"; }
}
public override string Name
{
get { return "Calculator"; }

View File

@@ -101,6 +101,11 @@ namespace Wox.Plugin.SystemPlugins
return string.Format("{0}{1}.png", ColorsDirectory.FullName, name.Substring(1));
}
public override string ID
{
get { return "9B36CE6181FC47FBB597AA2C29CD9B0A"; }
}
public override string Name
{
get { return "Colors"; }

View File

@@ -23,7 +23,12 @@ namespace Wox.Plugin.SystemPlugins.Folder {
}
}
public override string Name { get { return "Folder"; } }
public override string ID
{
get { return "B4D3B69656E14D44865C8D818EAE47C4"; }
}
public override string Name { get { return "Folder"; } }
public override string IcoPath { get { return @"Images\folder.png"; } }
#endregion Properties

View File

@@ -7,6 +7,7 @@ namespace Wox.Plugin.SystemPlugins
{
public interface ISystemPlugin : IPlugin
{
string ID { get; }
string Name { get; }
string Description { get; }
}

View File

@@ -140,6 +140,11 @@ namespace Wox.Plugin.SystemPlugins.Program
}
public override string ID
{
get { return "791FC278BA414111B8D1886DFE447410"; }
}
public override string Name
{
get { return "Programs"; }

View File

@@ -118,6 +118,11 @@ namespace Wox.Plugin.SystemPlugins
}
public override string ID
{
get { return "CEA08895D2544B019B2E9C5009600DF4"; }
}
public override string Name
{
get { return "System Commands"; }

View File

@@ -22,6 +22,12 @@ namespace Wox.Plugin.SystemPlugins
if (metadata.ActionKeyword.StartsWith(query.RawQuery))
{
PluginMetadata metadataCopy = metadata;
var customizedPluginConfig = UserSettingStorage.Instance.CustomizedPluginConfigs.FirstOrDefault(o => o.ID == metadataCopy.ID);
if (customizedPluginConfig != null && customizedPluginConfig.Disabled)
{
continue;
}
Result result = new Result
{
Title = metadata.ActionKeyword,
@@ -61,6 +67,11 @@ namespace Wox.Plugin.SystemPlugins
}
public override string ID
{
get { return "6A122269676E40EB86EB543B945932B9"; }
}
public override string Name
{
get { return "Third-party Plugin Indicator"; }

View File

@@ -31,6 +31,11 @@ namespace Wox.Plugin.SystemPlugins
return new List<Result>(0);
}
public override string ID
{
get { return "0308FD86DE0A4DEE8D62B9B535370992"; }
}
public override string Name { get { return "URL handler"; } }
public override string Description { get { return "Provide Opening the typed URL from Wox."; } }
public override string IcoPath { get { return "Images/url2.png"; } }

View File

@@ -81,6 +81,11 @@ namespace Wox.Plugin.SystemPlugins
UserSettingStorage.Instance.WebSearches = UserSettingStorage.Instance.LoadDefaultWebSearches();
}
public override string ID
{
get { return "565B73353DBF4806919830B9202EE3BF"; }
}
public override string Name
{
get { return "Web Searches"; }