mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 20:27:36 +02:00
Move WebSearch into featureBox
This commit is contained in:
@@ -11,7 +11,7 @@ using Wox.Plugin.SystemPlugins.SuggestionSources;
|
|||||||
|
|
||||||
namespace Wox.Plugin.SystemPlugins
|
namespace Wox.Plugin.SystemPlugins
|
||||||
{
|
{
|
||||||
public class WebSearchPlugin : BaseSystemPlugin
|
public class WebSearchPlugin : BaseSystemPlugin, ISettingProvider
|
||||||
{
|
{
|
||||||
private PluginInitContext context;
|
private PluginInitContext context;
|
||||||
|
|
||||||
@@ -96,5 +96,14 @@ namespace Wox.Plugin.SystemPlugins
|
|||||||
{
|
{
|
||||||
get { return base.Description; }
|
get { return base.Description; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region ISettingProvider Members
|
||||||
|
|
||||||
|
public System.Windows.Controls.Control CreateSettingPanel()
|
||||||
|
{
|
||||||
|
return new WebSearchesSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
<Window x:Class="Wox.WebSearchSetting"
|
<Window x:Class="Wox.Plugin.SystemPlugins.WebSearchSetting"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
Icon="Images\app.png"
|
|
||||||
ResizeMode="NoResize"
|
ResizeMode="NoResize"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
Title="WebSearchSetting" Height="350" Width="674.766">
|
Title="WebSearchSetting" Height="350" Width="674.766">
|
||||||
@@ -11,21 +11,20 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Wox.Helper;
|
|
||||||
using Wox.Infrastructure;
|
using Wox.Infrastructure;
|
||||||
using Wox.Infrastructure.Storage;
|
using Wox.Infrastructure.Storage;
|
||||||
using Wox.Infrastructure.Storage.UserSettings;
|
using Wox.Infrastructure.Storage.UserSettings;
|
||||||
using MessageBox = System.Windows.MessageBox;
|
using MessageBox = System.Windows.MessageBox;
|
||||||
|
|
||||||
namespace Wox
|
namespace Wox.Plugin.SystemPlugins
|
||||||
{
|
{
|
||||||
public partial class WebSearchSetting : Window
|
public partial class WebSearchSetting : Window
|
||||||
{
|
{
|
||||||
private SettingWindow settingWindow;
|
private WebSearchesSetting settingWindow;
|
||||||
private bool update;
|
private bool update;
|
||||||
private WebSearch updateWebSearch;
|
private WebSearch updateWebSearch;
|
||||||
|
|
||||||
public WebSearchSetting(SettingWindow settingWidow)
|
public WebSearchSetting(WebSearchesSetting settingWidow)
|
||||||
{
|
{
|
||||||
this.settingWindow = settingWidow;
|
this.settingWindow = settingWidow;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
39
Wox.Plugin.SystemPlugins/WebSearchesSetting.xaml
Normal file
39
Wox.Plugin.SystemPlugins/WebSearchesSetting.xaml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<UserControl x:Class="Wox.Plugin.SystemPlugins.WebSearchesSetting"
|
||||||
|
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 Height="*"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<ListView x:Name="webSearchView" Grid.Row="0">
|
||||||
|
<ListView.View>
|
||||||
|
<GridView>
|
||||||
|
<GridViewColumn Header="ActionWord" Width="180">
|
||||||
|
<GridViewColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding ActionWord}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.CellTemplate>
|
||||||
|
</GridViewColumn>
|
||||||
|
<GridViewColumn Header="Url" Width="500">
|
||||||
|
<GridViewColumn.CellTemplate>
|
||||||
|
<DataTemplate>
|
||||||
|
<TextBlock Text="{Binding Url}"/>
|
||||||
|
</DataTemplate>
|
||||||
|
</GridViewColumn.CellTemplate>
|
||||||
|
</GridViewColumn>
|
||||||
|
</GridView>
|
||||||
|
</ListView.View>
|
||||||
|
</ListView>
|
||||||
|
<StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||||
|
<Button x:Name="btnDeleteWebSearch" Click="btnDeleteWebSearch_OnClick" Width="100" Margin="10" Content="Delete"/>
|
||||||
|
<Button x:Name="btnEditWebSearch" Click="btnEditWebSearch_OnClick" Width="100" Margin="10" Content="Edit"/>
|
||||||
|
<Button x:Name="btnAddWebSearch" Click="btnAddWebSearch_OnClick" Width="100" Margin="10" Content="Add"/>
|
||||||
|
</StackPanel>
|
||||||
|
</Grid>
|
||||||
|
</UserControl>
|
||||||
79
Wox.Plugin.SystemPlugins/WebSearchesSetting.xaml.cs
Normal file
79
Wox.Plugin.SystemPlugins/WebSearchesSetting.xaml.cs
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
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;
|
||||||
|
using Wox.Infrastructure.Storage.UserSettings;
|
||||||
|
|
||||||
|
namespace Wox.Plugin.SystemPlugins
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for WebSearchesSetting.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class WebSearchesSetting : UserControl
|
||||||
|
{
|
||||||
|
public WebSearchesSetting()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
Loaded += Setting_Loaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Setting_Loaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
webSearchView.ItemsSource = UserSettingStorage.Instance.WebSearches;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReloadWebSearchView()
|
||||||
|
{
|
||||||
|
webSearchView.Items.Refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void btnAddWebSearch_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
WebSearchSetting webSearch = new WebSearchSetting(this);
|
||||||
|
webSearch.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnDeleteWebSearch_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
WebSearch seletedWebSearch = webSearchView.SelectedItem as WebSearch;
|
||||||
|
if (seletedWebSearch != null &&
|
||||||
|
MessageBox.Show("Are your sure to delete " + seletedWebSearch.Title, "Delete WebSearch",
|
||||||
|
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
|
UserSettingStorage.Instance.WebSearches.Remove(seletedWebSearch);
|
||||||
|
webSearchView.Items.Refresh();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Please select a web search");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnEditWebSearch_OnClick(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
WebSearch seletedWebSearch = webSearchView.SelectedItem as WebSearch;
|
||||||
|
if (seletedWebSearch != null)
|
||||||
|
{
|
||||||
|
WebSearchSetting webSearch = new WebSearchSetting(this);
|
||||||
|
webSearch.UpdateItem(seletedWebSearch);
|
||||||
|
webSearch.ShowDialog();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Please select a web search");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,6 +70,9 @@
|
|||||||
<Compile Include="Calculator.cs" />
|
<Compile Include="Calculator.cs" />
|
||||||
<Compile Include="ProgramSources\FileSystemProgramSource.cs" />
|
<Compile Include="ProgramSources\FileSystemProgramSource.cs" />
|
||||||
<Compile Include="ProgramSources\UserStartMenuProgramSource.cs" />
|
<Compile Include="ProgramSources\UserStartMenuProgramSource.cs" />
|
||||||
|
<Compile Include="WebSearchesSetting.xaml.cs">
|
||||||
|
<DependentUpon>WebSearchesSetting.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="WebSearchPlugin.cs" />
|
<Compile Include="WebSearchPlugin.cs" />
|
||||||
<Compile Include="CMD\CMD.cs" />
|
<Compile Include="CMD\CMD.cs" />
|
||||||
<Compile Include="DirectoryIndicator.cs" />
|
<Compile Include="DirectoryIndicator.cs" />
|
||||||
@@ -80,6 +83,9 @@
|
|||||||
<Compile Include="ThirdpartyPluginIndicator.cs" />
|
<Compile Include="ThirdpartyPluginIndicator.cs" />
|
||||||
<Compile Include="SuggestionSources\Google.cs" />
|
<Compile Include="SuggestionSources\Google.cs" />
|
||||||
<Compile Include="SuggestionSources\ISuggestionSource.cs" />
|
<Compile Include="SuggestionSources\ISuggestionSource.cs" />
|
||||||
|
<Compile Include="WebSearchSetting.xaml.cs">
|
||||||
|
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
<ProjectReference Include="..\Wox.Infrastructure\Wox.Infrastructure.csproj">
|
||||||
@@ -103,6 +109,14 @@
|
|||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="WebSearchesSetting.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
|
<Page Include="WebSearchSetting.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</Page>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|||||||
@@ -77,39 +77,6 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="Web Search">
|
|
||||||
<Grid Margin="10">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*"/>
|
|
||||||
<RowDefinition Height="50"/>
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<ListView x:Name="webSearchView" Grid.Row="0">
|
|
||||||
<ListView.View>
|
|
||||||
<GridView>
|
|
||||||
<GridViewColumn Header="ActionWord" Width="180">
|
|
||||||
<GridViewColumn.CellTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding ActionWord}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</GridViewColumn.CellTemplate>
|
|
||||||
</GridViewColumn>
|
|
||||||
<GridViewColumn Header="Url" Width="500">
|
|
||||||
<GridViewColumn.CellTemplate>
|
|
||||||
<DataTemplate>
|
|
||||||
<TextBlock Text="{Binding Url}"/>
|
|
||||||
</DataTemplate>
|
|
||||||
</GridViewColumn.CellTemplate>
|
|
||||||
</GridViewColumn>
|
|
||||||
</GridView>
|
|
||||||
</ListView.View>
|
|
||||||
</ListView>
|
|
||||||
<StackPanel Grid.Row="1" HorizontalAlignment="Right" Orientation="Horizontal">
|
|
||||||
<Button x:Name="btnDeleteWebSearch" Click="btnDeleteWebSearch_OnClick" Width="100" Margin="10" Content="Delete"/>
|
|
||||||
<Button x:Name="btnEditWebSearch" Click="btnEditWebSearch_OnClick" Width="100" Margin="10" Content="Edit"/>
|
|
||||||
<Button x:Name="btnAddWebSearch" Click="btnAddWebSearch_OnClick" Width="100" Margin="10" Content="Add"/>
|
|
||||||
</StackPanel>
|
|
||||||
</Grid>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="Plugins">
|
<TabItem Header="Plugins">
|
||||||
<StackPanel Orientation="Vertical" Margin="10">
|
<StackPanel Orientation="Vertical" Margin="10">
|
||||||
<StackPanel Orientation="Horizontal" Margin="10">
|
<StackPanel Orientation="Horizontal" Margin="10">
|
||||||
@@ -215,7 +182,6 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<TabItem Header="Features">
|
<TabItem Header="Features">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
|
|||||||
@@ -154,7 +154,6 @@ namespace Wox
|
|||||||
|
|
||||||
themeComboBox.SelectedItem = UserSettingStorage.Instance.Theme;
|
themeComboBox.SelectedItem = UserSettingStorage.Instance.Theme;
|
||||||
cbReplaceWinR.IsChecked = UserSettingStorage.Instance.ReplaceWinR;
|
cbReplaceWinR.IsChecked = UserSettingStorage.Instance.ReplaceWinR;
|
||||||
webSearchView.ItemsSource = UserSettingStorage.Instance.WebSearches;
|
|
||||||
lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys;
|
lvCustomHotkey.ItemsSource = UserSettingStorage.Instance.CustomPluginHotkeys;
|
||||||
cbEnablePythonPlugins.IsChecked = UserSettingStorage.Instance.EnablePythonPlugins;
|
cbEnablePythonPlugins.IsChecked = UserSettingStorage.Instance.EnablePythonPlugins;
|
||||||
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
|
cbStartWithWindows.IsChecked = File.Exists(woxLinkPath);
|
||||||
@@ -198,57 +197,12 @@ namespace Wox
|
|||||||
App.Window.SetTheme(UserSettingStorage.Instance.Theme);
|
App.Window.SetTheme(UserSettingStorage.Instance.Theme);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReloadWebSearchView()
|
|
||||||
{
|
|
||||||
webSearchView.Items.Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private List<string> LoadAvailableThemes()
|
private List<string> LoadAvailableThemes()
|
||||||
{
|
{
|
||||||
string themePath = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Themes");
|
string themePath = Path.Combine(Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath), "Themes");
|
||||||
return Directory.GetFiles(themePath).Where(filePath => filePath.EndsWith(".xaml") && !filePath.EndsWith("Default.xaml")).ToList();
|
return Directory.GetFiles(themePath).Where(filePath => filePath.EndsWith(".xaml") && !filePath.EndsWith("Default.xaml")).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void btnAddWebSearch_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
WebSearchSetting webSearch = new WebSearchSetting(this);
|
|
||||||
webSearch.ShowDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnDeleteWebSearch_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
WebSearch seletedWebSearch = webSearchView.SelectedItem as WebSearch;
|
|
||||||
if (seletedWebSearch != null &&
|
|
||||||
MessageBox.Show("Are your sure to delete " + seletedWebSearch.Title, "Delete WebSearch",
|
|
||||||
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
|
||||||
{
|
|
||||||
UserSettingStorage.Instance.WebSearches.Remove(seletedWebSearch);
|
|
||||||
webSearchView.Items.Refresh();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Please select a web search");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnEditWebSearch_OnClick(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
WebSearch seletedWebSearch = webSearchView.SelectedItem as WebSearch;
|
|
||||||
if (seletedWebSearch != null)
|
|
||||||
{
|
|
||||||
WebSearchSetting webSearch = new WebSearchSetting(this);
|
|
||||||
webSearch.UpdateItem(seletedWebSearch);
|
|
||||||
webSearch.ShowDialog();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
MessageBox.Show("Please select a web search");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CbStartWithWindows_OnChecked(object sender, RoutedEventArgs e)
|
private void CbStartWithWindows_OnChecked(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
CreateStartupFolderShortcut();
|
CreateStartupFolderShortcut();
|
||||||
|
|||||||
@@ -150,9 +150,6 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="StringEmptyConverter.cs" />
|
<Compile Include="StringEmptyConverter.cs" />
|
||||||
<Compile Include="StringNullOrEmptyToVisibilityConverter.cs" />
|
<Compile Include="StringNullOrEmptyToVisibilityConverter.cs" />
|
||||||
<Compile Include="WebSearchSetting.xaml.cs">
|
|
||||||
<DependentUpon>WebSearchSetting.xaml</DependentUpon>
|
|
||||||
</Compile>
|
|
||||||
<Page Include="Helper\ErrorReporting\WPFErrorReportingDialog.xaml">
|
<Page Include="Helper\ErrorReporting\WPFErrorReportingDialog.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
@@ -224,10 +221,6 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<Page Include="WebSearchSetting.xaml">
|
|
||||||
<SubType>Designer</SubType>
|
|
||||||
<Generator>MSBuild:Compile</Generator>
|
|
||||||
</Page>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs">
|
<Compile Include="Properties\AssemblyInfo.cs">
|
||||||
|
|||||||
Reference in New Issue
Block a user