From 7ae98ca9feb019f983bc712a9514377237a81579 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Sun, 2 Mar 2014 11:29:14 +0800 Subject: [PATCH] Fix issue#32 --- Wox.Plugin.System/Programs.cs | 10 ++++++---- Wox.Plugin.System/Setting.cs | 2 +- Wox.Plugin.System/WebSearchPlugin.cs | 1 + Wox/ResultPanel.xaml | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Wox.Plugin.System/Programs.cs b/Wox.Plugin.System/Programs.cs index f66f91396..4bafa2a78 100644 --- a/Wox.Plugin.System/Programs.cs +++ b/Wox.Plugin.System/Programs.cs @@ -27,7 +27,6 @@ namespace Wox.Plugin.System List installedList = new List(); - [DllImport("shell32.dll")] static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner,[Out] StringBuilder lpszPath, int nFolder, bool fCreate); const int CSIDL_COMMON_STARTMENU = 0x16; // \Windows\Start Menu\Programs @@ -40,6 +39,10 @@ namespace Wox.Plugin.System var fuzzyMather = FuzzyMatcher.Create(query.RawQuery); List returnList = installedList.Where(o => MatchProgram(o, fuzzyMather)).ToList(); returnList.ForEach(ScoreFilter); + //return ordered list instead of return the score, because programs scores will affect other + //plugins, the weight of program should be less than the plugins when they showed at the same time. + returnList = returnList.OrderByDescending(o => o.Score).ToList(); + returnList.ForEach(o=>o.Score = 0); return returnList.Select(c => new Result() { @@ -112,7 +115,6 @@ namespace Wox.Plugin.System { Title = getAppNameFromAppPath(file), IcoPath = file, - Score = 10, ExecutePath = file }; installedList.Add(p); @@ -129,11 +131,11 @@ namespace Wox.Plugin.System { if (p.Title.Contains("启动") || p.Title.ToLower().Contains("start")) { - p.Score += 10; + p.Score += 1; } if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall")) { - p.Score -= 5; + p.Score -= 1; } } diff --git a/Wox.Plugin.System/Setting.cs b/Wox.Plugin.System/Setting.cs index f824f2cf9..334e5cb95 100644 --- a/Wox.Plugin.System/Setting.cs +++ b/Wox.Plugin.System/Setting.cs @@ -16,7 +16,7 @@ namespace Wox.Plugin.System results.Add(new Result() { Title = "Wox Setting", - Score = 100, + Score = 40, IcoPath = "Images/app.png", Action = (contenxt) => { diff --git a/Wox.Plugin.System/WebSearchPlugin.cs b/Wox.Plugin.System/WebSearchPlugin.cs index 5fdced79d..c207f4c8d 100644 --- a/Wox.Plugin.System/WebSearchPlugin.cs +++ b/Wox.Plugin.System/WebSearchPlugin.cs @@ -25,6 +25,7 @@ namespace Wox.Plugin.System results.Add(new Result() { Title = string.Format("Search {0} for \"{1}\"", webSearch.Title, keyword), + Score = 6, IcoPath = webSearch.IconPath, Action = (c) => { diff --git a/Wox/ResultPanel.xaml b/Wox/ResultPanel.xaml index 8501347a6..2c85062e2 100644 --- a/Wox/ResultPanel.xaml +++ b/Wox/ResultPanel.xaml @@ -40,7 +40,7 @@ - +