From f7edc853da4f4d909daa9e1573857838d0e739ca Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Mon, 13 Jan 2014 09:45:31 +0800 Subject: [PATCH 1/6] project file change --- WinAlfred.sln | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/WinAlfred.sln b/WinAlfred.sln index c2f59e6710..6bc6c2246e 100644 --- a/WinAlfred.sln +++ b/WinAlfred.sln @@ -113,14 +113,12 @@ Global {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Debug|x86.ActiveCfg = Debug|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|Any CPU.ActiveCfg = Release|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|Any CPU.Build.0 = Release|Any CPU - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|Mixed Platforms.ActiveCfg = Release|x86 - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|Mixed Platforms.Build.0 = Release|x86 - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|Win32.ActiveCfg = Release|x86 - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|Win32.Build.0 = Release|x86 + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|Mixed Platforms.ActiveCfg = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|Mixed Platforms.Build.0 = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|Win32.ActiveCfg = Release|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|x64.ActiveCfg = Release|x64 {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|x64.Build.0 = Release|x64 - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|x86.ActiveCfg = Release|x86 - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|x86.Build.0 = Release|x86 + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.EmbeddingTest|x86.ActiveCfg = Release|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|Any CPU.ActiveCfg = Release|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|Any CPU.Build.0 = Release|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU @@ -130,14 +128,12 @@ Global {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.Release|x86.ActiveCfg = Release|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|Any CPU.ActiveCfg = Release|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|Any CPU.Build.0 = Release|Any CPU - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|Mixed Platforms.ActiveCfg = Release|x86 - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|Mixed Platforms.Build.0 = Release|x86 - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|Win32.ActiveCfg = Release|x86 - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|Win32.Build.0 = Release|x86 + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|Mixed Platforms.ActiveCfg = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|Mixed Platforms.Build.0 = Release|Any CPU + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|Win32.ActiveCfg = Release|Any CPU {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|x64.ActiveCfg = Release|x64 {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|x64.Build.0 = Release|x64 - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|x86.ActiveCfg = Release|x86 - {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|x86.Build.0 = Release|x86 + {DB90F671-D861-46BB-93A3-F1304F5BA1C5}.UnitTests|x86.ActiveCfg = Release|Any CPU {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {69CE0206-CB41-453D-88AF-DF86092EF9B8}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU From b6bbd6899ee9f64740243d22ab5c9884286fd345 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Mon, 13 Jan 2014 18:43:44 +0800 Subject: [PATCH 2/6] fix issues --- WinAlfred/Commands/BaseCommand.cs | 7 ++++++- WinAlfred/Commands/Command.cs | 6 ++++++ WinAlfred/Commands/PluginCommand.cs | 4 ++-- WinAlfred/Commands/SystemCommand.cs | 4 ++-- WinAlfred/MainWindow.xaml.cs | 29 ++++++++++++++++++++++------- 5 files changed, 38 insertions(+), 12 deletions(-) diff --git a/WinAlfred/Commands/BaseCommand.cs b/WinAlfred/Commands/BaseCommand.cs index fd16c8ab55..ca0a5ebe6d 100644 --- a/WinAlfred/Commands/BaseCommand.cs +++ b/WinAlfred/Commands/BaseCommand.cs @@ -10,7 +10,12 @@ namespace WinAlfred.Commands { private MainWindow window; - public abstract void Dispatch(Query query); + public void Dispatch(Query query) + { + Dispatch(query, true); + } + + public abstract void Dispatch(Query query, bool updateView); //TODO:Ugly, we should subscribe events here, instead of just use usercontrol as the parameter protected BaseCommand(MainWindow window) diff --git a/WinAlfred/Commands/Command.cs b/WinAlfred/Commands/Command.cs index 7e9af536e5..2bab900136 100644 --- a/WinAlfred/Commands/Command.cs +++ b/WinAlfred/Commands/Command.cs @@ -23,5 +23,11 @@ namespace WinAlfred.Commands systemCmd.Dispatch(query); pluginCmd.Dispatch(query); } + + public void DispatchCommand(Query query,bool updateView) + { + systemCmd.Dispatch(query,updateView); + pluginCmd.Dispatch(query,updateView); + } } } diff --git a/WinAlfred/Commands/PluginCommand.cs b/WinAlfred/Commands/PluginCommand.cs index 81f5e739d1..590e7b252c 100644 --- a/WinAlfred/Commands/PluginCommand.cs +++ b/WinAlfred/Commands/PluginCommand.cs @@ -20,7 +20,7 @@ namespace WinAlfred.Commands } - public override void Dispatch(Query q) + public override void Dispatch(Query q,bool updateView) { PluginPair thirdPlugin = Plugins.AllPlugins.FirstOrDefault(o => o.Metadata.ActionKeyword == q.ActionName); if (thirdPlugin != null && !string.IsNullOrEmpty(thirdPlugin.Metadata.ActionKeyword)) @@ -39,7 +39,7 @@ namespace WinAlfred.Commands o.PluginDirectory = thirdPlugin.Metadata.PluginDirecotry; o.OriginQuery = q; }); - UpdateResultView(r); + if(updateView) UpdateResultView(r); } catch (Exception queryException) { diff --git a/WinAlfred/Commands/SystemCommand.cs b/WinAlfred/Commands/SystemCommand.cs index 7ecad98203..f1e43e2acf 100644 --- a/WinAlfred/Commands/SystemCommand.cs +++ b/WinAlfred/Commands/SystemCommand.cs @@ -18,7 +18,7 @@ namespace WinAlfred.Commands systemPlugins = Plugins.AllPlugins.Where(o => o.Metadata.PluginType == PluginType.System).ToList(); } - public override void Dispatch(Query query) + public override void Dispatch(Query query,bool updateView) { foreach (PluginPair pair in systemPlugins) { @@ -31,7 +31,7 @@ namespace WinAlfred.Commands result.PluginDirectory = pair1.Metadata.PluginDirecotry; result.OriginQuery = query; } - if(results.Count > 0) UpdateResultView(results); + if(results.Count > 0 && updateView) UpdateResultView(results); }); } } diff --git a/WinAlfred/MainWindow.xaml.cs b/WinAlfred/MainWindow.xaml.cs index 6a627110a3..25b47c42d6 100644 --- a/WinAlfred/MainWindow.xaml.cs +++ b/WinAlfred/MainWindow.xaml.cs @@ -7,19 +7,12 @@ using System.Windows.Controls; using System.Windows.Forms; using System.Windows.Input; using System.Windows.Media.Animation; -using System.Windows.Shapes; -using System.Windows.Threading; -using Microsoft.Win32; using WinAlfred.Commands; using WinAlfred.Helper; using WinAlfred.Plugin; using WinAlfred.PluginLoader; -using DataFormats = System.Windows.DataFormats; -using DragDropEffects = System.Windows.DragDropEffects; -using DragEventArgs = System.Windows.DragEventArgs; using KeyEventArgs = System.Windows.Input.KeyEventArgs; using MessageBox = System.Windows.MessageBox; -using Timer = System.Threading.Timer; namespace WinAlfred { @@ -41,6 +34,28 @@ namespace WinAlfred resultCtrl.resultItemChangedEvent += resultCtrl_resultItemChangedEvent; ThreadPool.SetMaxThreads(30, 10); InitProgressbarAnimation(); + WakeupApp(); + } + + private void WakeupApp() + { + //After hide winalfred in the background for a long time. It will become very slow in the next show. + //This is caused by the Virtual Mermory Page Mechanisam. So, our solution is execute some codes in every 20min + //which may prevent sysetem uninstall memory from RAM to disk. + + System.Timers.Timer t = new System.Timers.Timer(1000 * 30 * 1) { AutoReset = true, Enabled = true }; + t.Elapsed += (o, e) => Dispatcher.Invoke(new Action(() => + { + if (Visibility != Visibility.Visible) + { + double oldLeft = Left; + Left = 20000; + ShowWinAlfred(); + cmdDispatcher.DispatchCommand(new Query("qq"),false); + HideWinAlfred(); + Left = oldLeft; + } + })); } private void InitProgressbarAnimation() From af954a0578cf2b4d8a9d0b3a51e6f5b526a81d79 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Mon, 13 Jan 2014 19:32:27 +0800 Subject: [PATCH 3/6] Add kill process workflow --- Plugins/WinAlfred.Plugin.Kill/Images/app.png | Bin 0 -> 1338 bytes Plugins/WinAlfred.Plugin.Kill/main.py | 36 +++++++++++++++++++ Plugins/WinAlfred.Plugin.Kill/plugin.ini | 8 +++++ WinAlfred/MainWindow.xaml.cs | 8 ++--- 4 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 Plugins/WinAlfred.Plugin.Kill/Images/app.png create mode 100644 Plugins/WinAlfred.Plugin.Kill/main.py create mode 100644 Plugins/WinAlfred.Plugin.Kill/plugin.ini diff --git a/Plugins/WinAlfred.Plugin.Kill/Images/app.png b/Plugins/WinAlfred.Plugin.Kill/Images/app.png new file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V?xoNs9gXz2HTp|@q+vt`Wk@03#m7hG^aXD=Rq{5Kk?1!yO5hx w5A8WtPo-3QE@T|6*G+t0c^yo9{ Dispatcher.Invoke(new Action(() => { if (Visibility != Visibility.Visible) @@ -203,6 +202,7 @@ namespace WinAlfred InitialTray(); selectedRecords.LoadSelectedRecords(); SetAutoStart(true); + WakeupApp(); //var engine = new Jurassic.ScriptEngine(); //MessageBox.Show(engine.Evaluate("5 * 10 + 2").ToString()); } @@ -272,7 +272,7 @@ namespace WinAlfred public void CloseApp() { notifyIcon.Visible = false; - Close(); + Environment.Exit(0); } public void HideApp() From 8a57a322330d980b63ac32cd7cef3bf1fc8db869 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Tue, 14 Jan 2014 22:57:15 +0800 Subject: [PATCH 4/6] Update README.md --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 509ce85cde..4a006dbb76 100644 --- a/README.md +++ b/README.md @@ -22,3 +22,8 @@ Create workflow ========= Currently, WinAlfred support using C# and Python to write your workflows. Please refer to [Create-workflows](https://github.com/qianlifeng/WinAlfred/wiki/Create-workflows) page for more infomation. + +Upload your workflow +========= + +Share your workflows through WinalfredWorkflows. After you upload your workflow, other uses can download or search your workflow through `wf` command (this is a workflow management workflow, which is the one of the default workflows inside winalfred). From 5baeadbe92c109b2a81ed33759fae95d5808d3eb Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Tue, 14 Jan 2014 22:58:49 +0800 Subject: [PATCH 5/6] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4a006dbb76..7e1e492d15 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Create workflow Currently, WinAlfred support using C# and Python to write your workflows. Please refer to [Create-workflows](https://github.com/qianlifeng/WinAlfred/wiki/Create-workflows) page for more infomation. -Upload your workflow +Share workflow ========= -Share your workflows through WinalfredWorkflows. After you upload your workflow, other uses can download or search your workflow through `wf` command (this is a workflow management workflow, which is the one of the default workflows inside winalfred). +Share your workflows through WinAlfredWorkflows. After you upload your workflow, other uses can download or search your workflow through `wf` command (this is a workflow management workflow, which is the one of the default workflows inside winalfred). From cfdb5456aaea69fa0458159716ee40149a6238d2 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Tue, 14 Jan 2014 23:00:38 +0800 Subject: [PATCH 6/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7e1e492d15..44443e7434 100644 --- a/README.md +++ b/README.md @@ -26,4 +26,4 @@ Currently, WinAlfred support using C# and Python to write your workflows. Please Share workflow ========= -Share your workflows through WinAlfredWorkflows. After you upload your workflow, other uses can download or search your workflow through `wf` command (this is a workflow management workflow, which is the one of the default workflows inside winalfred). +Share your workflows through WinAlfredWorkflows. After you upload your workflow, other uses can download or search your workflow through `wf` command (this is a workflow for workflow management , which is the one of the default workflows inside winalfred).