mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Adjust score weight for programs.
This commit is contained in:
@@ -93,7 +93,6 @@ namespace Wox.Plugin.SystemPlugins.ControlPanel
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Result> panelItems = results.OrderByDescending(o => o.Score).Take(5).ToList();
|
List<Result> panelItems = results.OrderByDescending(o => o.Score).Take(5).ToList();
|
||||||
panelItems.ForEach(o => o.Score = 0);
|
|
||||||
return panelItems;
|
return panelItems;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace Wox.Plugin.SystemPlugins.Program
|
|||||||
Title = c.Title,
|
Title = c.Title,
|
||||||
SubTitle = c.ExecutePath,
|
SubTitle = c.ExecutePath,
|
||||||
IcoPath = c.IcoPath,
|
IcoPath = c.IcoPath,
|
||||||
Score = 0,
|
Score = c.Score,
|
||||||
Action = (e) =>
|
Action = (e) =>
|
||||||
{
|
{
|
||||||
context.API.HideApp();
|
context.API.HideApp();
|
||||||
@@ -77,9 +77,9 @@ namespace Wox.Plugin.SystemPlugins.Program
|
|||||||
|
|
||||||
private bool MatchProgram(Program program, FuzzyMatcher matcher)
|
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.Title).Score) > 0) return true;
|
||||||
if ((program.Score = matcher.Evaluate(program.PinyinTitle).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;
|
if (program.ExecuteName != null && (program.Score = matcher.Evaluate(program.ExecuteName).Score) > 0) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -51,14 +51,11 @@ namespace Wox.Plugin.SystemPlugins.Sys
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
public System.Windows.Controls.Control CreateSettingPanel()
|
public System.Windows.Controls.Control CreateSettingPanel()
|
||||||
{
|
{
|
||||||
return new SysSettings(availableResults);
|
return new SysSettings(availableResults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected override List<Result> QueryInternal(Query query)
|
protected override List<Result> QueryInternal(Query query)
|
||||||
{
|
{
|
||||||
if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
|
if (query.RawQuery.EndsWith(" ") || query.RawQuery.Length <= 1) return new List<Result>();
|
||||||
@@ -96,7 +93,7 @@ namespace Wox.Plugin.SystemPlugins.Sys
|
|||||||
{
|
{
|
||||||
Title = "Log off",
|
Title = "Log off",
|
||||||
SubTitle = "Log off current user",
|
SubTitle = "Log off current user",
|
||||||
Score = 20,
|
Score = 100,
|
||||||
IcoPath = "Images\\logoff.png",
|
IcoPath = "Images\\logoff.png",
|
||||||
Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
|
Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
|
||||||
},
|
},
|
||||||
@@ -104,7 +101,7 @@ namespace Wox.Plugin.SystemPlugins.Sys
|
|||||||
{
|
{
|
||||||
Title = "Lock",
|
Title = "Lock",
|
||||||
SubTitle = "Lock this computer",
|
SubTitle = "Lock this computer",
|
||||||
Score = 20,
|
Score = 100,
|
||||||
IcoPath = "Images\\lock.png",
|
IcoPath = "Images\\lock.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
{
|
{
|
||||||
@@ -146,7 +143,7 @@ namespace Wox.Plugin.SystemPlugins.Sys
|
|||||||
{
|
{
|
||||||
Title = "Settings",
|
Title = "Settings",
|
||||||
SubTitle = "Tweak this app",
|
SubTitle = "Tweak this app",
|
||||||
Score = 40,
|
Score = 100,
|
||||||
IcoPath = "Images\\app.png",
|
IcoPath = "Images\\app.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,29 +70,6 @@ namespace Wox
|
|||||||
return location;
|
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()
|
public void SelectNext()
|
||||||
{
|
{
|
||||||
int index = lbResults.SelectedIndex;
|
int index = lbResults.SelectedIndex;
|
||||||
|
|||||||
Reference in New Issue
Block a user