diff --git a/WinAlfred.Plugin.System/ThirdpartyPluginIndicator.cs b/WinAlfred.Plugin.System/ThirdpartyPluginIndicator.cs new file mode 100644 index 0000000000..ca10dfa486 --- /dev/null +++ b/WinAlfred.Plugin.System/ThirdpartyPluginIndicator.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace WinAlfred.Plugin.System +{ + public class ThirdpartyPluginIndicator : ISystemPlugin + { + private List allPlugins = new List(); + private Action changeQuery; + + public List Query(Query query) + { + List results = new List(); + if (string.IsNullOrEmpty(query.RawQuery)) return results; + + foreach (PluginMetadata metadata in allPlugins.Select(o=>o.Metadata)) + { + if (metadata.ActionKeyword.StartsWith(query.RawQuery)) + { + PluginMetadata metadataCopy = metadata; + Result result = new Result + { + Title = metadata.ActionKeyword, + SubTitle = string.Format("press space to active {0} workflow",metadata.Name), + Score = 50, + IcoPath = "Images/work.png", + Action = () => changeQuery(metadataCopy.ActionKeyword + " "), + DontHideWinAlfredAfterAction = true + }; + results.Add(result); + } + } + return results; + } + + public void Init(PluginInitContext context) + { + allPlugins = context.Plugins; + changeQuery = context.ChangeQuery; + } + + public string Name { + get + { + return "ThirdpartyPluginIndicator"; + } + } + + public string Description + { + get + { + return "ThirdpartyPluginIndicator"; + } + } + + + } +} diff --git a/WinAlfred/Commands/BaseCommand.cs b/WinAlfred/Commands/BaseCommand.cs new file mode 100644 index 0000000000..aa3dfbdb75 --- /dev/null +++ b/WinAlfred/Commands/BaseCommand.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using WinAlfred.Plugin; + +namespace WinAlfred.Commands +{ + public abstract class BaseCommand + { + private MainWindow window; + + public abstract void Dispatch(Query query); + + //TODO:Ugly, we should subscribe events here, instead of just use usercontrol as the parameter + protected BaseCommand(MainWindow window) + { + this.window = window; + } + + protected void UpdateResultView(List results) + { + if (results.Count > 0) + { + window.OnUpdateResultView(results); + } + } + } +} diff --git a/WinAlfred/Images/close.png b/WinAlfred/Images/close.png new file mode 100644 index 0000000000..5ddfe20b8f Binary files /dev/null and b/WinAlfred/Images/close.png differ diff --git a/WinAlfred/Images/cmd.png b/WinAlfred/Images/cmd.png new file mode 100644 index 0000000000..4e4ca09443 Binary files /dev/null and b/WinAlfred/Images/cmd.png differ diff --git a/WinAlfred/Images/exit.png b/WinAlfred/Images/exit.png new file mode 100644 index 0000000000..523c3d5197 Binary files /dev/null and b/WinAlfred/Images/exit.png differ diff --git a/WinAlfred/Images/logoff.png b/WinAlfred/Images/logoff.png new file mode 100644 index 0000000000..73c1379b2e Binary files /dev/null and b/WinAlfred/Images/logoff.png differ diff --git a/WinAlfred/Images/work.png b/WinAlfred/Images/work.png new file mode 100644 index 0000000000..aa447afd8d Binary files /dev/null and b/WinAlfred/Images/work.png differ diff --git a/WinAlfred/MainWindow.xaml.cs b/WinAlfred/MainWindow.xaml.cs index 02dea99755..4a12ba4f75 100644 --- a/WinAlfred/MainWindow.xaml.cs +++ b/WinAlfred/MainWindow.xaml.cs @@ -100,6 +100,9 @@ namespace WinAlfred Plugins.Init(this); cmdDispatcher = new Command(this); InitialTray(); + + //var engine = new Jurassic.ScriptEngine(); + //MessageBox.Show(engine.Evaluate("5 * 10 + 2").ToString()); } private void TbQuery_OnPreviewKeyDown(object sender, KeyEventArgs e) diff --git a/WinAlfred/WinAlfred.csproj b/WinAlfred/WinAlfred.csproj index f77fec5eab..722066c294 100644 --- a/WinAlfred/WinAlfred.csproj +++ b/WinAlfred/WinAlfred.csproj @@ -59,6 +59,9 @@ + + C:\Users\Scott\Desktop\Jurassic.dll + ..\packages\log4net.2.0.3\lib\net35-full\log4net.dll