mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-09 12:46:47 +02:00
Optimized search
Removed redundant check.
This commit is contained in:
@@ -65,51 +65,47 @@ namespace Wox.Plugin.SystemPlugins.ControlPanel
|
|||||||
|
|
||||||
foreach (var item in controlPanelItems)
|
foreach (var item in controlPanelItems)
|
||||||
{
|
{
|
||||||
if (item.LocalizedString.IndexOf(myQuery, StringComparison.OrdinalIgnoreCase) >= 0 || item.InfoTip.IndexOf(myQuery, StringComparison.OrdinalIgnoreCase) >= 0)
|
if (item.LocalizedString.IndexOf(myQuery, StringComparison.OrdinalIgnoreCase) >= 0)
|
||||||
{
|
{
|
||||||
|
results.Insert(0, new Result()
|
||||||
if (item.LocalizedString.IndexOf(myQuery, StringComparison.OrdinalIgnoreCase) >= 0) //Items with Query in title have higher score.
|
|
||||||
{
|
{
|
||||||
results.Insert(0, new Result()
|
Title = item.LocalizedString,
|
||||||
|
SubTitle = item.InfoTip,
|
||||||
|
IcoPath = "Images\\ControlPanelIcons\\" + item.ApplicationName + fileType,
|
||||||
|
Action = e =>
|
||||||
{
|
{
|
||||||
Title = item.LocalizedString,
|
try
|
||||||
SubTitle = item.InfoTip,
|
|
||||||
IcoPath = "Images\\ControlPanelIcons\\" + item.ApplicationName + fileType,
|
|
||||||
Action = e =>
|
|
||||||
{
|
{
|
||||||
try
|
Process.Start(item.ExecutablePath);
|
||||||
{
|
|
||||||
Process.Start(item.ExecutablePath);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
//Silently Fail for now..
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
catch (Exception)
|
||||||
}
|
{
|
||||||
else
|
//Silently Fail for now..
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (item.InfoTip.IndexOf(myQuery, StringComparison.OrdinalIgnoreCase) >= 0)
|
||||||
|
{
|
||||||
|
results.Add(new Result()
|
||||||
{
|
{
|
||||||
results.Add(new Result()
|
Title = item.LocalizedString,
|
||||||
|
SubTitle = item.InfoTip,
|
||||||
|
IcoPath = "Images\\ControlPanelIcons\\" + item.ApplicationName + fileType,
|
||||||
|
Action = e =>
|
||||||
{
|
{
|
||||||
Title = item.LocalizedString,
|
try
|
||||||
SubTitle = item.InfoTip,
|
|
||||||
IcoPath = "Images\\ControlPanelIcons\\" + item.ApplicationName + fileType,
|
|
||||||
Action = e =>
|
|
||||||
{
|
{
|
||||||
try
|
Process.Start(item.ExecutablePath);
|
||||||
{
|
|
||||||
Process.Start(item.ExecutablePath);
|
|
||||||
}
|
|
||||||
catch (Exception)
|
|
||||||
{
|
|
||||||
//Silently Fail for now..
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
catch (Exception)
|
||||||
}
|
{
|
||||||
|
//Silently Fail for now..
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < 2 && i < results.Count; i++)
|
for (int i = 0; i < 2 && i < results.Count; i++)
|
||||||
|
|||||||
Reference in New Issue
Block a user