Fix issue#32
This commit is contained in:
parent
13ed55ac10
commit
7ae98ca9fe
|
@ -27,7 +27,6 @@ namespace Wox.Plugin.System
|
||||||
|
|
||||||
List<Program> installedList = new List<Program>();
|
List<Program> installedList = new List<Program>();
|
||||||
|
|
||||||
|
|
||||||
[DllImport("shell32.dll")]
|
[DllImport("shell32.dll")]
|
||||||
static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner,[Out] StringBuilder lpszPath, int nFolder, bool fCreate);
|
static extern bool SHGetSpecialFolderPath(IntPtr hwndOwner,[Out] StringBuilder lpszPath, int nFolder, bool fCreate);
|
||||||
const int CSIDL_COMMON_STARTMENU = 0x16; // \Windows\Start Menu\Programs
|
const int CSIDL_COMMON_STARTMENU = 0x16; // \Windows\Start Menu\Programs
|
||||||
|
@ -40,6 +39,10 @@ namespace Wox.Plugin.System
|
||||||
var fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
|
var fuzzyMather = FuzzyMatcher.Create(query.RawQuery);
|
||||||
List<Program> returnList = installedList.Where(o => MatchProgram(o, fuzzyMather)).ToList();
|
List<Program> returnList = installedList.Where(o => MatchProgram(o, fuzzyMather)).ToList();
|
||||||
returnList.ForEach(ScoreFilter);
|
returnList.ForEach(ScoreFilter);
|
||||||
|
//return ordered list instead of return the score, because programs scores will affect other
|
||||||
|
//plugins, the weight of program should be less than the plugins when they showed at the same time.
|
||||||
|
returnList = returnList.OrderByDescending(o => o.Score).ToList();
|
||||||
|
returnList.ForEach(o=>o.Score = 0);
|
||||||
|
|
||||||
return returnList.Select(c => new Result()
|
return returnList.Select(c => new Result()
|
||||||
{
|
{
|
||||||
|
@ -112,7 +115,6 @@ namespace Wox.Plugin.System
|
||||||
{
|
{
|
||||||
Title = getAppNameFromAppPath(file),
|
Title = getAppNameFromAppPath(file),
|
||||||
IcoPath = file,
|
IcoPath = file,
|
||||||
Score = 10,
|
|
||||||
ExecutePath = file
|
ExecutePath = file
|
||||||
};
|
};
|
||||||
installedList.Add(p);
|
installedList.Add(p);
|
||||||
|
@ -129,11 +131,11 @@ namespace Wox.Plugin.System
|
||||||
{
|
{
|
||||||
if (p.Title.Contains("启动") || p.Title.ToLower().Contains("start"))
|
if (p.Title.Contains("启动") || p.Title.ToLower().Contains("start"))
|
||||||
{
|
{
|
||||||
p.Score += 10;
|
p.Score += 1;
|
||||||
}
|
}
|
||||||
if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall"))
|
if (p.Title.Contains("卸载") || p.Title.ToLower().Contains("uninstall"))
|
||||||
{
|
{
|
||||||
p.Score -= 5;
|
p.Score -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace Wox.Plugin.System
|
||||||
results.Add(new Result()
|
results.Add(new Result()
|
||||||
{
|
{
|
||||||
Title = "Wox Setting",
|
Title = "Wox Setting",
|
||||||
Score = 100,
|
Score = 40,
|
||||||
IcoPath = "Images/app.png",
|
IcoPath = "Images/app.png",
|
||||||
Action = (contenxt) =>
|
Action = (contenxt) =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,6 +25,7 @@ namespace Wox.Plugin.System
|
||||||
results.Add(new Result()
|
results.Add(new Result()
|
||||||
{
|
{
|
||||||
Title = string.Format("Search {0} for \"{1}\"", webSearch.Title, keyword),
|
Title = string.Format("Search {0} for \"{1}\"", webSearch.Title, keyword),
|
||||||
|
Score = 6,
|
||||||
IcoPath = webSearch.IconPath,
|
IcoPath = webSearch.IconPath,
|
||||||
Action = (c) =>
|
Action = (c) =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
<RowDefinition></RowDefinition>
|
<RowDefinition></RowDefinition>
|
||||||
<RowDefinition Height="Auto" x:Name="SubTitleRowDefinition"></RowDefinition>
|
<RowDefinition Height="Auto" x:Name="SubTitleRowDefinition"></RowDefinition>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<TextBlock Style="{DynamicResource ItemTitleStyle}" ToolTip="{Binding Title}" x:Name="tbTitle" Text="{Binding Title}"></TextBlock>
|
<TextBlock Style="{DynamicResource ItemTitleStyle}" VerticalAlignment="Center" ToolTip="{Binding Title}" x:Name="tbTitle" Text="{Binding Title}"></TextBlock>
|
||||||
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" Visibility="{Binding SubTitle, Converter={wox:StringNullOrEmptyToVisibilityConverter}}" Grid.Row="1" x:Name="tbSubTitle" Text="{Binding SubTitle}"></TextBlock>
|
<TextBlock Style="{DynamicResource ItemSubTitleStyle}" Visibility="{Binding SubTitle, Converter={wox:StringNullOrEmptyToVisibilityConverter}}" Grid.Row="1" x:Name="tbSubTitle" Text="{Binding SubTitle}"></TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
Loading…
Reference in a new issue