diff --git a/Plugins/Wox.Plugin.PluginManagement/plugin.json b/Plugins/Wox.Plugin.PluginManagement/plugin.json index ee149e9c10..173598b665 100644 --- a/Plugins/Wox.Plugin.PluginManagement/plugin.json +++ b/Plugins/Wox.Plugin.PluginManagement/plugin.json @@ -7,5 +7,6 @@ "Version":"1.0", "Language":"csharp", "Website":"http://www.getwox.com/plugin", - "ExecuteFileName":"Wox.Plugin.PluginManagement.dll" + "ExecuteFileName":"Wox.Plugin.PluginManagement.dll", + "IcoPath":"Images\\plugin.png" } diff --git a/Wox.Plugin.System/BaseSystemPlugin.cs b/Wox.Plugin.System/BaseSystemPlugin.cs index d07dcc2699..710ccf509a 100644 --- a/Wox.Plugin.System/BaseSystemPlugin.cs +++ b/Wox.Plugin.System/BaseSystemPlugin.cs @@ -21,7 +21,7 @@ namespace Wox.Plugin.System InitInternal(context); } - public string Name + public virtual string Name { get { @@ -29,12 +29,22 @@ namespace Wox.Plugin.System } } - public string Description + public virtual string Description { get { return "System workflow"; } } + + public virtual string IcoPath + { + get + { + return null; + } + } + + public string PluginDirectory { get; set; } } } diff --git a/Wox.Plugin.System/BrowserBookmarks.cs b/Wox.Plugin.System/BrowserBookmarks.cs index 94eef2bdc5..73fc40826c 100644 --- a/Wox.Plugin.System/BrowserBookmarks.cs +++ b/Wox.Plugin.System/BrowserBookmarks.cs @@ -121,6 +121,21 @@ namespace Wox.Plugin.System Regex reg = new Regex(@"(?i)\\[uU]([0-9a-f]{4})"); return reg.Replace(dataStr, m => ((char)Convert.ToInt32(m.Groups[1].Value, 16)).ToString()); } + + public override string Name + { + get { return "Bookmarks"; } + } + + public override string IcoPath + { + get { return @"Images\bookmark.png"; } + } + + public override string Description + { + get { return base.Description; } + } } public class Bookmark : IEquatable, IEqualityComparer diff --git a/Wox.Plugin.System/CMD/CMD.cs b/Wox.Plugin.System/CMD/CMD.cs index 379a2bda2b..9fee1a1a5b 100644 --- a/Wox.Plugin.System/CMD/CMD.cs +++ b/Wox.Plugin.System/CMD/CMD.cs @@ -148,5 +148,19 @@ namespace Wox.Plugin.System.CMD this.context = context; } + public override string Name + { + get { return "Shell"; } + } + + public override string IcoPath + { + get { return @"Images\cmd.png"; } + } + + public override string Description + { + get { return base.Description; } + } } } diff --git a/Wox.Plugin.System/Calculator.cs b/Wox.Plugin.System/Calculator.cs index 4a333ba8ca..48f6a553e0 100644 --- a/Wox.Plugin.System/Calculator.cs +++ b/Wox.Plugin.System/Calculator.cs @@ -86,6 +86,19 @@ namespace Wox.Plugin.System this.context = context; } - + public override string Name + { + get { return "Calculator"; } + } + + public override string IcoPath + { + get { return @"Images\calculator.png"; } + } + + public override string Description + { + get { return base.Description; } + } } } diff --git a/Wox.Plugin.System/DirectoryIndicator.cs b/Wox.Plugin.System/DirectoryIndicator.cs index c89d020050..c59d9bd2ae 100644 --- a/Wox.Plugin.System/DirectoryIndicator.cs +++ b/Wox.Plugin.System/DirectoryIndicator.cs @@ -157,5 +157,19 @@ namespace Wox.Plugin.System this.context = context; } + public override string Name + { + get { return "File System"; } + } + + public override string IcoPath + { + get { return @"Images\folder.png"; } + } + + public override string Description + { + get { return base.Description; } + } } } diff --git a/Wox.Plugin.System/Programs.cs b/Wox.Plugin.System/Programs.cs index f50128ea42..3028a6311f 100644 --- a/Wox.Plugin.System/Programs.cs +++ b/Wox.Plugin.System/Programs.cs @@ -145,5 +145,21 @@ namespace Wox.Plugin.System if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall")) p.Score -= 20; } + + + public override string Name + { + get { return "Programs"; } + } + + public override string IcoPath + { + get { return @"Images\app.png"; } + } + + public override string Description + { + get { return base.Description; } + } } } diff --git a/Wox.Plugin.System/Setting.cs b/Wox.Plugin.System/Setting.cs deleted file mode 100644 index 334e5cb959..0000000000 --- a/Wox.Plugin.System/Setting.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Wox.Plugin.System -{ - public class Setting : BaseSystemPlugin - { - private PluginInitContext context; - protected override List QueryInternal(Query query) - { - List results = new List(); - if ("setting".Contains(query.RawQuery.ToLower())) - { - results.Add(new Result() - { - Title = "Wox Setting", - Score = 40, - IcoPath = "Images/app.png", - Action = (contenxt) => - { - context.OpenSettingDialog(); - return true; - } - }); - } - - return results; - } - - protected override void InitInternal(PluginInitContext context) - { - this.context = context; - } - } -} diff --git a/Wox.Plugin.System/Sys.cs b/Wox.Plugin.System/Sys.cs index a3c0da2aef..5bf3b0988b 100644 --- a/Wox.Plugin.System/Sys.cs +++ b/Wox.Plugin.System/Sys.cs @@ -85,6 +85,34 @@ namespace Wox.Plugin.System return true; } }); + availableResults.Add(new Result + { + Title = "Setting", + SubTitle = "Tweak this app", + Score = 40, + IcoPath = "Images\\app.png", + Action = (c) => + { + context.OpenSettingDialog(); + return true; + } + }); + } + + + public override string Name + { + get { return "System Commands"; } + } + + public override string IcoPath + { + get { return @"Images\lock.png"; } + } + + public override string Description + { + get { return base.Description; } } } } diff --git a/Wox.Plugin.System/ThirdpartyPluginIndicator.cs b/Wox.Plugin.System/ThirdpartyPluginIndicator.cs index eee39ecafa..6cf5fc6bfa 100644 --- a/Wox.Plugin.System/ThirdpartyPluginIndicator.cs +++ b/Wox.Plugin.System/ThirdpartyPluginIndicator.cs @@ -62,5 +62,19 @@ namespace Wox.Plugin.System } + public override string Name + { + get { return "Plugins"; } + } + + public override string IcoPath + { + get { return @"Images\work.png"; } + } + + public override string Description + { + get { return base.Description; } + } } } diff --git a/Wox.Plugin.System/WebSearchPlugin.cs b/Wox.Plugin.System/WebSearchPlugin.cs index f56f860926..98441321f2 100644 --- a/Wox.Plugin.System/WebSearchPlugin.cs +++ b/Wox.Plugin.System/WebSearchPlugin.cs @@ -81,5 +81,20 @@ namespace Wox.Plugin.System if (UserSettingStorage.Instance.WebSearches == null) UserSettingStorage.Instance.WebSearches = UserSettingStorage.Instance.LoadDefaultWebSearches(); } + + public override string Name + { + get { return "Web Searches"; } + } + + public override string IcoPath + { + get { return @"Images\app.png"; } + } + + public override string Description + { + get { return base.Description; } + } } } diff --git a/Wox.Plugin.System/Wox.Plugin.System.csproj b/Wox.Plugin.System/Wox.Plugin.System.csproj index 685d2ca9e0..0554e5f733 100644 --- a/Wox.Plugin.System/Wox.Plugin.System.csproj +++ b/Wox.Plugin.System/Wox.Plugin.System.csproj @@ -67,7 +67,6 @@ - diff --git a/Wox.Plugin/PluginMetadata.cs b/Wox.Plugin/PluginMetadata.cs index 2b7fc9b1f9..4c9d2e3576 100644 --- a/Wox.Plugin/PluginMetadata.cs +++ b/Wox.Plugin/PluginMetadata.cs @@ -35,5 +35,7 @@ namespace Wox.Plugin public string PluginDirecotry { get; set; } public string ActionKeyword { get; set; } public PluginType PluginType { get; set; } + + public string IcoPath { get; set; } } } diff --git a/Wox/PluginLoader/CSharpPluginLoader.cs b/Wox/PluginLoader/CSharpPluginLoader.cs index 9bcde23526..d56d4cfd42 100644 --- a/Wox/PluginLoader/CSharpPluginLoader.cs +++ b/Wox/PluginLoader/CSharpPluginLoader.cs @@ -37,6 +37,13 @@ namespace Wox.PluginLoader Plugin = Activator.CreateInstance(type) as IPlugin, Metadata = metadata }; + + var sys = pair.Plugin as BaseSystemPlugin; + if (sys != null) + { + sys.PluginDirectory = metadata.PluginDirecotry; + } + plugins.Add(pair); } } diff --git a/Wox/SettingWindow.xaml b/Wox/SettingWindow.xaml index 0990013923..1958140505 100644 --- a/Wox/SettingWindow.xaml +++ b/Wox/SettingWindow.xaml @@ -3,12 +3,21 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:wox="clr-namespace:Wox" xmlns:UserSettings="clr-namespace:Wox.Infrastructure.Storage.UserSettings;assembly=Wox.Infrastructure" x:Class="Wox.SettingWindow" + xmlns:woxPlugin="clr-namespace:Wox.Plugin;assembly=Wox.Plugin" + xmlns:system="clr-namespace:Wox.Plugin.System;assembly=Wox.Plugin.System" Icon="Images\app.png" Title="Wox Setting" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Height="600" Width="800"> - + + + + + + @@ -255,5 +264,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Wox/SettingWindow.xaml.cs b/Wox/SettingWindow.xaml.cs index 15e9256f32..6d044071ac 100644 --- a/Wox/SettingWindow.xaml.cs +++ b/Wox/SettingWindow.xaml.cs @@ -17,6 +17,7 @@ using Wox.Helper; using Application = System.Windows.Forms.Application; using File = System.IO.File; using MessageBox = System.Windows.MessageBox; +using System.Windows.Data; namespace Wox { @@ -157,6 +158,24 @@ namespace Wox cbEnablePythonPlugins.IsChecked = UserSettingStorage.Instance.EnablePythonPlugins; cbStartWithWindows.IsChecked = File.Exists(woxLinkPath); + var features = new CompositeCollection + { + new CollectionContainer() + { + Collection = + PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System) + .Select(o => o.Plugin) + .Cast() + }, + FindResource("FeatureBoxSeperator"), + new CollectionContainer() + { + Collection = + PluginLoader.Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.ThirdParty) + } + }; + featureBox.ItemsSource = features; + slOpacity.Value = UserSettingStorage.Instance.Opacity; CbOpacityMode.SelectedItem = UserSettingStorage.Instance.OpacityMode; @@ -473,5 +492,10 @@ namespace Wox else PreviewMainPanel.Opacity = 1; } + + private void featureBox_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + // throw new NotImplementedException(); + } } }