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:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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"; }
|
||||
|
||||
@@ -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"; }
|
||||
|
||||
@@ -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"; }
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace Wox.Plugin.SystemPlugins
|
||||
{
|
||||
public interface ISystemPlugin : IPlugin
|
||||
{
|
||||
string ID { get; }
|
||||
string Name { get; }
|
||||
string Description { get; }
|
||||
}
|
||||
|
||||
@@ -140,6 +140,11 @@ namespace Wox.Plugin.SystemPlugins.Program
|
||||
}
|
||||
|
||||
|
||||
public override string ID
|
||||
{
|
||||
get { return "791FC278BA414111B8D1886DFE447410"; }
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return "Programs"; }
|
||||
|
||||
@@ -118,6 +118,11 @@ namespace Wox.Plugin.SystemPlugins
|
||||
}
|
||||
|
||||
|
||||
public override string ID
|
||||
{
|
||||
get { return "CEA08895D2544B019B2E9C5009600DF4"; }
|
||||
}
|
||||
|
||||
public override string Name
|
||||
{
|
||||
get { return "System Commands"; }
|
||||
|
||||
@@ -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"; }
|
||||
|
||||
@@ -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"; } }
|
||||
|
||||
@@ -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"; }
|
||||
|
||||
Reference in New Issue
Block a user