Adjust score weight for programs.

This commit is contained in:
qianlifeng 2014-08-10 16:50:35 +08:00
parent 3fea8eb820
commit 0e812b911e
4 changed files with 5 additions and 32 deletions

View File

@ -93,7 +93,6 @@ namespace Wox.Plugin.SystemPlugins.ControlPanel
}
List<Result> panelItems = results.OrderByDescending(o => o.Score).Take(5).ToList();
panelItems.ForEach(o => o.Score = 0);
return panelItems;
}

View File

@ -65,7 +65,7 @@ namespace Wox.Plugin.SystemPlugins.Program
Title = c.Title,
SubTitle = c.ExecutePath,
IcoPath = c.IcoPath,
Score = 0,
Score = c.Score,
Action = (e) =>
{
context.API.HideApp();
@ -77,9 +77,9 @@ namespace Wox.Plugin.SystemPlugins.Program
private bool MatchProgram(Program program, FuzzyMatcher matcher)
{
if (program.AbbrTitle != null && (program.Score = matcher.Evaluate(program.AbbrTitle).Score) > 0) return true;
if ((program.Score = matcher.Evaluate(program.Title).Score) > 0) return true;
if ((program.Score = matcher.Evaluate(program.PinyinTitle).Score) > 0) return true;
if (program.AbbrTitle != null && (program.Score = matcher.Evaluate(program.AbbrTitle).Score) > 0) return true;
if (program.ExecuteName != null && (program.Score = matcher.Evaluate(program.ExecuteName).Score) > 0) return true;
return false;

View File

@ -51,14 +51,11 @@ namespace Wox.Plugin.SystemPlugins.Sys
#endregion
public System.Windows.Controls.Control CreateSettingPanel()
{
return new SysSettings(availableResults);
}
protected override List<Result> QueryInternal(Query query)
{
if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
@ -96,7 +93,7 @@ namespace Wox.Plugin.SystemPlugins.Sys
{
Title = "Log off",
SubTitle = "Log off current user",
Score = 20,
Score = 100,
IcoPath = "Images\\logoff.png",
Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
},
@ -104,7 +101,7 @@ namespace Wox.Plugin.SystemPlugins.Sys
{
Title = "Lock",
SubTitle = "Lock this computer",
Score = 20,
Score = 100,
IcoPath = "Images\\lock.png",
Action = (c) =>
{
@ -146,7 +143,7 @@ namespace Wox.Plugin.SystemPlugins.Sys
{
Title = "Settings",
SubTitle = "Tweak this app",
Score = 40,
Score = 100,
IcoPath = "Images\\app.png",
Action = (c) =>
{

View File

@ -70,29 +70,6 @@ namespace Wox
return location;
}
private FrameworkElement FindByName(string name, FrameworkElement root)
{
Stack<FrameworkElement> tree = new Stack<FrameworkElement>();
tree.Push(root);
while (tree.Count > 0)
{
FrameworkElement current = tree.Pop();
if (current.Name == name)
return current;
int count = VisualTreeHelper.GetChildrenCount(current);
for (int i = 0; i < count; ++i)
{
DependencyObject child = VisualTreeHelper.GetChild(current, i);
if (child is FrameworkElement)
tree.Push((FrameworkElement)child);
}
}
return null;
}
public void SelectNext()
{
int index = lbResults.SelectedIndex;