From 574e711f337422fbeb8ea183b5d692a28c0d7e40 Mon Sep 17 00:00:00 2001 From: CoenraadS Date: Thu, 17 Jul 2014 17:43:29 +0200 Subject: [PATCH] Added priority to title results --- .../ControlPanel/ControlPanel.cs | 49 ++++++++++++++----- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/Wox.Plugin.SystemPlugins/ControlPanel/ControlPanel.cs b/Wox.Plugin.SystemPlugins/ControlPanel/ControlPanel.cs index 984f93bc1d..b87f6f9447 100644 --- a/Wox.Plugin.SystemPlugins/ControlPanel/ControlPanel.cs +++ b/Wox.Plugin.SystemPlugins/ControlPanel/ControlPanel.cs @@ -64,24 +64,49 @@ namespace Wox.Plugin.SystemPlugins.ControlPanel { if (item.LocalizedString.IndexOf(myQuery, StringComparison.OrdinalIgnoreCase) >= 0 || item.InfoTip.IndexOf(myQuery, StringComparison.OrdinalIgnoreCase) >= 0) { - results.Add(new Result() + + if (item.LocalizedString.IndexOf(myQuery, StringComparison.OrdinalIgnoreCase) >= 0) //Items with Query in title have higher score. { - Title = item.LocalizedString, - SubTitle = item.InfoTip, - IcoPath = "Images\\ControlPanelIcons\\" + item.ApplicationName + ".ico", //Relative path to plugin directory - Action = e => + results.Insert(0, new Result() { - try + Title = item.LocalizedString, + SubTitle = item.InfoTip, + IcoPath = "Images\\ControlPanelIcons\\" + item.ApplicationName + ".ico", + Action = e => { - Process.Start(item.ExecutablePath); + try + { + Process.Start(item.ExecutablePath); + } + catch (Exception) + { + //Silently Fail for now.. + } + return true; } - catch (Exception) + }); + } + else + { + results.Add(new Result() + { + Title = item.LocalizedString, + SubTitle = item.InfoTip, + IcoPath = "Images\\ControlPanelIcons\\" + item.ApplicationName + ".ico", + Action = e => { - //Silently Fail for now.. + try + { + Process.Start(item.ExecutablePath); + } + catch (Exception) + { + //Silently Fail for now.. + } + return true; } - return true; - } - }); + }); + } } } return results;