mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-11 14:02:24 +02:00
use caculated score for sys plugin item
This commit is contained in:
@@ -39,8 +39,11 @@ namespace Wox.Plugin.Sys
|
|||||||
List<Result> results = new List<Result>();
|
List<Result> results = new List<Result>();
|
||||||
foreach (Result availableResult in availableResults)
|
foreach (Result availableResult in availableResults)
|
||||||
{
|
{
|
||||||
if (StringMatcher.IsMatch(availableResult.Title, query.Search) || StringMatcher.IsMatch(availableResult.SubTitle, query.Search))
|
int titleScore = StringMatcher.Match(availableResult.Title, query.Search);
|
||||||
|
int subTitleScore = StringMatcher.Match(availableResult.SubTitle, query.Search);
|
||||||
|
if (titleScore > 0 || subTitleScore > 0)
|
||||||
{
|
{
|
||||||
|
availableResult.Score = titleScore > 0 ? titleScore : subTitleScore;
|
||||||
results.Add(availableResult);
|
results.Add(availableResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -60,7 +63,6 @@ namespace Wox.Plugin.Sys
|
|||||||
{
|
{
|
||||||
Title = "Shutdown",
|
Title = "Shutdown",
|
||||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_shutdown_computer"),
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_shutdown_computer"),
|
||||||
Score = 100,
|
|
||||||
IcoPath = "Images\\exit.png",
|
IcoPath = "Images\\exit.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
{
|
{
|
||||||
@@ -74,7 +76,6 @@ namespace Wox.Plugin.Sys
|
|||||||
{
|
{
|
||||||
Title = "Log off",
|
Title = "Log off",
|
||||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_log_off"),
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_log_off"),
|
||||||
Score = 100,
|
|
||||||
IcoPath = "Images\\logoff.png",
|
IcoPath = "Images\\logoff.png",
|
||||||
Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
|
Action = (c) => ExitWindowsEx(EWX_LOGOFF, 0)
|
||||||
},
|
},
|
||||||
@@ -82,7 +83,6 @@ namespace Wox.Plugin.Sys
|
|||||||
{
|
{
|
||||||
Title = "Lock",
|
Title = "Lock",
|
||||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_lock"),
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_lock"),
|
||||||
Score = 100,
|
|
||||||
IcoPath = "Images\\lock.png",
|
IcoPath = "Images\\lock.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
{
|
{
|
||||||
@@ -94,7 +94,6 @@ namespace Wox.Plugin.Sys
|
|||||||
{
|
{
|
||||||
Title = "Sleep",
|
Title = "Sleep",
|
||||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_sleep"),
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_sleep"),
|
||||||
Score = 100,
|
|
||||||
IcoPath = "Images\\sleep.png",
|
IcoPath = "Images\\sleep.png",
|
||||||
Action = (c) => Application.SetSuspendState(PowerState.Suspend, false, false)
|
Action = (c) => Application.SetSuspendState(PowerState.Suspend, false, false)
|
||||||
},
|
},
|
||||||
@@ -102,7 +101,6 @@ namespace Wox.Plugin.Sys
|
|||||||
{
|
{
|
||||||
Title = "Exit",
|
Title = "Exit",
|
||||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_exit"),
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_exit"),
|
||||||
Score = 110,
|
|
||||||
IcoPath = "Images\\app.png",
|
IcoPath = "Images\\app.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
{
|
{
|
||||||
@@ -114,7 +112,6 @@ namespace Wox.Plugin.Sys
|
|||||||
{
|
{
|
||||||
Title = "Restart Wox",
|
Title = "Restart Wox",
|
||||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_restart"),
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_restart"),
|
||||||
Score = 110,
|
|
||||||
IcoPath = "Images\\restart.png",
|
IcoPath = "Images\\restart.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
{
|
{
|
||||||
@@ -132,7 +129,6 @@ namespace Wox.Plugin.Sys
|
|||||||
{
|
{
|
||||||
Title = "Settings",
|
Title = "Settings",
|
||||||
SubTitle = context.API.GetTranslation("wox_plugin_sys_setting"),
|
SubTitle = context.API.GetTranslation("wox_plugin_sys_setting"),
|
||||||
Score = 100,
|
|
||||||
IcoPath = "Images\\app.png",
|
IcoPath = "Images\\app.png",
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user