mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-01-06 03:07:54 +08:00
Expose index file suffixes config [WIP]
This commit is contained in:
parent
eee76222bd
commit
5d1006f05b
@ -67,6 +67,9 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
|||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public double Opacity { get; set; }
|
public double Opacity { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty]
|
||||||
|
public List<string> ProgramSuffixes { get; set; }
|
||||||
|
|
||||||
[JsonProperty]
|
[JsonProperty]
|
||||||
public OpacityMode OpacityMode { get; set; }
|
public OpacityMode OpacityMode { get; set; }
|
||||||
|
|
||||||
@ -162,6 +165,16 @@ namespace Wox.Infrastructure.Storage.UserSettings
|
|||||||
{
|
{
|
||||||
storage.CustomizedPluginConfigs = new List<CustomizedPluginConfig>();
|
storage.CustomizedPluginConfigs = new List<CustomizedPluginConfig>();
|
||||||
}
|
}
|
||||||
|
if (storage.ProgramSuffixes == null || storage.ProgramSuffixes.Count == 0)
|
||||||
|
{
|
||||||
|
storage.ProgramSuffixes = new List<string>()
|
||||||
|
{
|
||||||
|
"lnk",
|
||||||
|
"exe",
|
||||||
|
"appref-ms",
|
||||||
|
"bat"
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,9 +16,10 @@
|
|||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<DockPanel Grid.Row="0">
|
<StackPanel Grid.Row="0" Orientation="Horizontal" HorizontalAlignment="Right">
|
||||||
<Button Height="30" HorizontalAlignment="Right" x:Name="btnReindex" Width="100" Click="btnReindex_Click">Re-Index</Button>
|
<Button Height="30" HorizontalAlignment="Right" x:Name="btnProgramSuffixes" Width="130" Click="BtnProgramSuffixes_OnClick">Index File Type</Button>
|
||||||
</DockPanel>
|
<Button Height="30" HorizontalAlignment="Right" Margin="10 0 0 0" x:Name="btnReindex" Width="100" Click="btnReindex_Click">Re-Index</Button>
|
||||||
|
</StackPanel>
|
||||||
<ListView x:Name="programSourceView" Grid.Row="1">
|
<ListView x:Name="programSourceView" Grid.Row="1">
|
||||||
<ListView.View>
|
<ListView.View>
|
||||||
<GridView>
|
<GridView>
|
||||||
|
@ -95,5 +95,12 @@ namespace Wox.Plugin.SystemPlugins.Program
|
|||||||
{
|
{
|
||||||
ReIndexing();
|
ReIndexing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void BtnProgramSuffixes_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
ProgramSuffixes p = new ProgramSuffixes();
|
||||||
|
p.ShowDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -8,19 +8,12 @@ namespace Wox.Plugin.SystemPlugins.Program.ProgramSources
|
|||||||
public class FileSystemProgramSource : AbstractProgramSource
|
public class FileSystemProgramSource : AbstractProgramSource
|
||||||
{
|
{
|
||||||
public string BaseDirectory;
|
public string BaseDirectory;
|
||||||
public List<string> Suffixes = new List<string>() { "lnk", "exe", "appref-ms" };
|
|
||||||
|
|
||||||
public FileSystemProgramSource(string baseDirectory)
|
public FileSystemProgramSource(string baseDirectory)
|
||||||
{
|
{
|
||||||
BaseDirectory = baseDirectory;
|
BaseDirectory = baseDirectory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileSystemProgramSource(string baseDirectory, List<string> suffixes)
|
|
||||||
: this(baseDirectory)
|
|
||||||
{
|
|
||||||
Suffixes = suffixes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public FileSystemProgramSource(ProgramSource source)
|
public FileSystemProgramSource(ProgramSource source)
|
||||||
: this(source.Location)
|
: this(source.Location)
|
||||||
{
|
{
|
||||||
@ -41,7 +34,7 @@ namespace Wox.Plugin.SystemPlugins.Program.ProgramSources
|
|||||||
{
|
{
|
||||||
foreach (string file in Directory.GetFiles(path))
|
foreach (string file in Directory.GetFiles(path))
|
||||||
{
|
{
|
||||||
if (Suffixes.Any(o => file.EndsWith("." + o)))
|
if (UserSettingStorage.Instance.ProgramSuffixes.Any(o => file.EndsWith("." + o)))
|
||||||
{
|
{
|
||||||
Program p = CreateEntry(file);
|
Program p = CreateEntry(file);
|
||||||
list.Add(p);
|
list.Add(p);
|
||||||
|
32
Wox.Plugin.SystemPlugins/Program/ProgramSuffixes.xaml
Normal file
32
Wox.Plugin.SystemPlugins/Program/ProgramSuffixes.xaml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<Window x:Class="Wox.Plugin.SystemPlugins.Program.ProgramSuffixes"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="300" d:DesignWidth="300">
|
||||||
|
<Grid Margin="10">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<ListView x:Name="lvProgramSuffixes" Grid.Row="0" ItemsSource="{Binding UserSettingStorage.Instance.ProgramSuffixes}">
|
||||||
|
<ListView.View>
|
||||||
|
<GridView>
|
||||||
|
<GridViewColumn Header="Suffixes" Width="200">
|
||||||
|
<GridViewColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.CellTemplate>
|
||||||
|
</GridViewColumn>
|
||||||
|
</GridView>
|
||||||
|
</ListView.View>
|
||||||
|
</ListView>
|
||||||
|
<StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||||
|
<Button x:Name="btnDelete" Click="btnDelete_OnClick" Width="100" Margin="10" Content="Delete"/>
|
||||||
|
<Button x:Name="btnEdit" Click="btnEdit_OnClick" Width="100" Margin="10" Content="Edit"/>
|
||||||
|
<Button x:Name="btnAdd" Click="btnAdd_OnClick" Width="100" Margin="10" Content="Add"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
42
Wox.Plugin.SystemPlugins/Program/ProgramSuffixes.xaml.cs
Normal file
42
Wox.Plugin.SystemPlugins/Program/ProgramSuffixes.xaml.cs
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using System.Windows.Documents;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
using System.Windows.Navigation;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.SystemPlugins.Program
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// ProgramSuffixes.xaml 的交互逻辑
|
||||||
|
/// </summary>
|
||||||
|
public partial class ProgramSuffixes
|
||||||
|
{
|
||||||
|
public ProgramSuffixes()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnDelete_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnEdit_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnAdd_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -131,8 +131,7 @@ namespace Wox.Plugin.SystemPlugins
|
|||||||
var dlg = new Microsoft.Win32.OpenFileDialog
|
var dlg = new Microsoft.Win32.OpenFileDialog
|
||||||
{
|
{
|
||||||
DefaultExt = ".png",
|
DefaultExt = ".png",
|
||||||
Filter =
|
Filter ="Image files (*.jpg, *.jpeg, *.gif, *.png, *.bmp) | *.jpg; *.jpeg; *.gif; *.png, *.bmp"
|
||||||
"JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool? result = dlg.ShowDialog();
|
bool? result = dlg.ShowDialog();
|
||||||
|
@ -76,6 +76,9 @@
|
|||||||
<Compile Include="Calculator.cs" />
|
<Compile Include="Calculator.cs" />
|
||||||
<Compile Include="Program\ProgramSources\FileSystemProgramSource.cs" />
|
<Compile Include="Program\ProgramSources\FileSystemProgramSource.cs" />
|
||||||
<Compile Include="Program\ProgramSources\UserStartMenuProgramSource.cs" />
|
<Compile Include="Program\ProgramSources\UserStartMenuProgramSource.cs" />
|
||||||
|
<Compile Include="Program\ProgramSuffixes.xaml.cs">
|
||||||
|
<DependentUpon>ProgramSuffixes.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="SuggestionSources\Baidu.cs" />
|
<Compile Include="SuggestionSources\Baidu.cs" />
|
||||||
<Compile Include="SuggestionSources\SuggestionSourceFactory.cs" />
|
<Compile Include="SuggestionSources\SuggestionSourceFactory.cs" />
|
||||||
<Compile Include="Sys\SysSettings.xaml.cs">
|
<Compile Include="Sys\SysSettings.xaml.cs">
|
||||||
@ -122,6 +125,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Program\ProgramSuffixes.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Sys\SysSettings.xaml">
|
<Page Include="Sys\SysSettings.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@ -576,13 +576,7 @@ namespace Wox
|
|||||||
{
|
{
|
||||||
if (o.AutoAjustScore) o.Score += UserSelectedRecordStorage.Instance.GetSelectedCount(o);
|
if (o.AutoAjustScore) o.Score += UserSelectedRecordStorage.Instance.GetSelectedCount(o);
|
||||||
});
|
});
|
||||||
lock (locker)
|
List<Result> l = list.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList();
|
||||||
{
|
|
||||||
waitShowResultList.AddRange(list);
|
|
||||||
}
|
|
||||||
List<Result> l = waitShowResultList.Where(o => o.OriginQuery != null && o.OriginQuery.RawQuery == lastQuery).ToList();
|
|
||||||
waitShowResultList.Clear();
|
|
||||||
|
|
||||||
Dispatcher.Invoke(new Action(() => resultCtrl.AddResults(l)));
|
Dispatcher.Invoke(new Action(() => resultCtrl.AddResults(l)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user