mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 19:57:07 +02:00
Add translation for web search plugin
This commit is contained in:
@@ -7,7 +7,7 @@
|
|||||||
#define MyAppVer = GetFileVersion(MyAppPath + "\Wox.exe")
|
#define MyAppVer = GetFileVersion(MyAppPath + "\Wox.exe")
|
||||||
|
|
||||||
[Setup]
|
[Setup]
|
||||||
AppId={{A5AF4C34-70A7-4D3B-BA18-E49C0AEEA5E6}
|
AppId=05700E94-3DAD-4827-8AAA-9908178DE132-Wox
|
||||||
AppMutex=DBDE24E4-91F6-11DF-B495-C536DFD72085-Wox
|
AppMutex=DBDE24E4-91F6-11DF-B495-C536DFD72085-Wox
|
||||||
AppName={#MyAppName}
|
AppName={#MyAppName}
|
||||||
AppVerName={#MyAppName} v{#MyAppVer}
|
AppVerName={#MyAppName} v{#MyAppVer}
|
||||||
@@ -21,6 +21,8 @@ OutputBaseFilename=Wox-setup
|
|||||||
OutputDir={#OutputPath}
|
OutputDir={#OutputPath}
|
||||||
Compression=lzma
|
Compression=lzma
|
||||||
SolidCompression=yes
|
SolidCompression=yes
|
||||||
|
DisableDirPage=auto
|
||||||
|
DisableProgramGroupPage=auto
|
||||||
|
|
||||||
[Languages]
|
[Languages]
|
||||||
Name: english; MessagesFile: compiler:Default.isl
|
Name: english; MessagesFile: compiler:Default.isl
|
||||||
|
|||||||
28
Plugins/Wox.Plugin.WebSearch/Languages/en.xaml
Normal file
28
Plugins/Wox.Plugin.WebSearch/Languages/en.xaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_websearch_delete">Delete</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_edit">Edit</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_add">Add</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_action_keyword">Action Keyword</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_url">URL</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_enable_suggestion">Enable search suggestions</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_pls_select_web_search">Please select a web search</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_delete_warning">Are your sure to delete {0}?</system:String>
|
||||||
|
|
||||||
|
|
||||||
|
<!--web search edit-->
|
||||||
|
<system:String x:Key="wox_plugin_websearch_title">Title</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_enable">Enable</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_select_icon">Select Icon</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_icon">Icon</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_cancel">Cancel</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_invalid_web_search">Invalid web search</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_input_title">Please input title</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_input_action_keyword">Please input action keyword</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_input_url">Please input URL</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_action_keyword_exist">ActionWord has existed, please input a new one</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_succeed">Succeed</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
28
Plugins/Wox.Plugin.WebSearch/Languages/zh-cn.xaml
Normal file
28
Plugins/Wox.Plugin.WebSearch/Languages/zh-cn.xaml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:system="clr-namespace:System;assembly=mscorlib">
|
||||||
|
|
||||||
|
<system:String x:Key="wox_plugin_websearch_delete">删除</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_edit">编辑</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_add">添加</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_action_keyword">触发关键字</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_url">URL</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_enable_suggestion">启用搜索建议</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_pls_select_web_search">请选择一项</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_delete_warning">你确定要删除 {0} 吗?</system:String>
|
||||||
|
|
||||||
|
|
||||||
|
<!--web search edit-->
|
||||||
|
<system:String x:Key="wox_plugin_websearch_title">标题</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_enable">启用</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_icon">图标</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_select_icon">选择图标</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_cancel">取消</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_invalid_web_search">非法的网页搜索</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_input_title">请输入标题</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_input_action_keyword">请输入触发关键字</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_input_url">请输入URL</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_action_keyword_exist">触发关键字已经存在,请选择一个新的关键字</system:String>
|
||||||
|
<system:String x:Key="wox_plugin_websearch_succeed">操作成功</system:String>
|
||||||
|
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using Wox.Core.UserSettings;
|
using Wox.Core.UserSettings;
|
||||||
using Wox.Plugin.WebSearch.SuggestionSources;
|
using Wox.Plugin.WebSearch.SuggestionSources;
|
||||||
|
|
||||||
namespace Wox.Plugin.WebSearch
|
namespace Wox.Plugin.WebSearch
|
||||||
{
|
{
|
||||||
public class WebSearchPlugin : IPlugin, ISettingProvider
|
public class WebSearchPlugin : IPlugin, ISettingProvider,IPluginI18n
|
||||||
{
|
{
|
||||||
private PluginInitContext context;
|
private PluginInitContext context;
|
||||||
|
|
||||||
@@ -86,9 +88,14 @@ namespace Wox.Plugin.WebSearch
|
|||||||
|
|
||||||
public System.Windows.Controls.Control CreateSettingPanel()
|
public System.Windows.Controls.Control CreateSettingPanel()
|
||||||
{
|
{
|
||||||
return new WebSearchesSetting();
|
return new WebSearchesSetting(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
public string GetLanguagesFolder()
|
||||||
|
{
|
||||||
|
return Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "Languages");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,27 +17,28 @@
|
|||||||
<ColumnDefinition Width="120"></ColumnDefinition>
|
<ColumnDefinition Width="120"></ColumnDefinition>
|
||||||
<ColumnDefinition></ColumnDefinition>
|
<ColumnDefinition></ColumnDefinition>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<TextBlock Margin="10" FontSize="14" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right">Title:</TextBlock>
|
<TextBlock Margin="10" FontSize="14" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_title}"></TextBlock>
|
||||||
<TextBox x:Name="tbTitle" Margin="10" Grid.Row="0" Width="400" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBox>
|
<TextBox x:Name="tbTitle" Margin="10" Grid.Row="0" Width="400" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBox>
|
||||||
|
|
||||||
<TextBlock Margin="10" FontSize="14" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right">URL:</TextBlock>
|
<TextBlock Margin="10" FontSize="14" Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_url}"></TextBlock>
|
||||||
<TextBox x:Name="tbUrl" Margin="10" Grid.Row="1" Width="400" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBox>
|
<TextBox x:Name="tbUrl" Margin="10" Grid.Row="1" Width="400" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBox>
|
||||||
|
|
||||||
<TextBlock Margin="10" FontSize="14" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right">ActionWord:</TextBlock>
|
<TextBlock Margin="10" FontSize="14" Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_action_keyword}"></TextBlock>
|
||||||
<TextBox x:Name="tbActionword" Margin="10" Grid.Row="2" Width="400" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBox>
|
<TextBox x:Name="tbActionword" Margin="10" Grid.Row="2" Width="400" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBox>
|
||||||
|
|
||||||
<TextBlock Margin="10" FontSize="14" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right">Enable:</TextBlock>
|
<TextBlock Margin="10" FontSize="14" Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_enable}"></TextBlock>
|
||||||
<CheckBox x:Name="cbEnable" IsChecked="True" Margin="10" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center"></CheckBox>
|
<CheckBox x:Name="cbEnable" IsChecked="True" Margin="10" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center"></CheckBox>
|
||||||
|
|
||||||
<TextBlock Margin="10" FontSize="14" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right">Icon:</TextBlock>
|
<TextBlock Margin="10" FontSize="14" Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Text="{DynamicResource wox_plugin_websearch_icon}"></TextBlock>
|
||||||
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1" Margin="10">
|
<StackPanel Orientation="Horizontal" Grid.Row="4" Grid.Column="1" Margin="10">
|
||||||
<Image x:Name="imgIcon" Width="24" Height="24" Margin="0 0 10 0" />
|
<Image x:Name="imgIcon" Width="24" Height="24" Margin="0 0 10 0" />
|
||||||
<Button x:Name="btnSelectIcon" Height="24" Click="BtnSelectIcon_OnClick">Select Icon</Button>
|
<Button x:Name="btnSelectIcon" Height="24" Click="BtnSelectIcon_OnClick" Content="{DynamicResource wox_plugin_websearch_select_icon}"></Button>
|
||||||
<TextBlock x:Name="tbIconPath" Visibility="Hidden"></TextBlock>
|
<TextBlock x:Name="tbIconPath" Visibility="Hidden"></TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="5" Grid.Column="1">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="5" Grid.Column="1">
|
||||||
<Button x:Name="btnCancel" Click="BtnCancel_OnClick" Margin="10 0 10 0" Width="80" Height="25">Cancel</Button>
|
<Button x:Name="btnCancel" Click="BtnCancel_OnClick" Margin="10 0 10 0" Width="80" Height="25" Content="{DynamicResource wox_plugin_websearch_cancel}"></Button>
|
||||||
<Button x:Name="btnAdd" Margin="10 0 10 0" Width="80" Height="25" Click="btnAdd_OnClick"><TextBlock x:Name="lblAdd">Add</TextBlock></Button>
|
<Button x:Name="btnAdd" Margin="10 0 10 0" Width="80" Height="25" Click="btnAdd_OnClick">
|
||||||
|
<TextBlock x:Name="lblAdd" Text="{DynamicResource wox_plugin_websearch_add}"></TextBlock></Button>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
|
|||||||
@@ -15,9 +15,11 @@ namespace Wox.Plugin.WebSearch
|
|||||||
private WebSearchesSetting settingWindow;
|
private WebSearchesSetting settingWindow;
|
||||||
private bool update;
|
private bool update;
|
||||||
private Core.UserSettings.WebSearch updateWebSearch;
|
private Core.UserSettings.WebSearch updateWebSearch;
|
||||||
|
private PluginInitContext context;
|
||||||
|
|
||||||
public WebSearchSetting(WebSearchesSetting settingWidow)
|
public WebSearchSetting(WebSearchesSetting settingWidow,PluginInitContext context)
|
||||||
{
|
{
|
||||||
|
this.context = context;
|
||||||
this.settingWindow = settingWidow;
|
this.settingWindow = settingWidow;
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
@@ -27,7 +29,9 @@ namespace Wox.Plugin.WebSearch
|
|||||||
updateWebSearch = UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o == webSearch);
|
updateWebSearch = UserSettingStorage.Instance.WebSearches.FirstOrDefault(o => o == webSearch);
|
||||||
if (updateWebSearch == null || string.IsNullOrEmpty(updateWebSearch.Url))
|
if (updateWebSearch == null || string.IsNullOrEmpty(updateWebSearch.Url))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Invalid web search");
|
|
||||||
|
string warning = context.API.GetTranslation("wox_plugin_websearch_invalid_web_search");
|
||||||
|
MessageBox.Show(warning);
|
||||||
Close();
|
Close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -63,21 +67,24 @@ namespace Wox.Plugin.WebSearch
|
|||||||
string title = tbTitle.Text;
|
string title = tbTitle.Text;
|
||||||
if (string.IsNullOrEmpty(title))
|
if (string.IsNullOrEmpty(title))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Please input Title field");
|
string warning = context.API.GetTranslation("wox_plugin_websearch_input_title");
|
||||||
|
MessageBox.Show(warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string url = tbUrl.Text;
|
string url = tbUrl.Text;
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Please input URL field");
|
string warning = context.API.GetTranslation("wox_plugin_websearch_input_url");
|
||||||
|
MessageBox.Show(warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
string action = tbActionword.Text;
|
string action = tbActionword.Text;
|
||||||
if (string.IsNullOrEmpty(action))
|
if (string.IsNullOrEmpty(action))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Please input ActionWord field");
|
string warning = context.API.GetTranslation("wox_plugin_websearch_input_action_keyword");
|
||||||
|
MessageBox.Show(warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -86,7 +93,8 @@ namespace Wox.Plugin.WebSearch
|
|||||||
{
|
{
|
||||||
if (UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == action))
|
if (UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == action))
|
||||||
{
|
{
|
||||||
MessageBox.Show("ActionWord has existed, please input a new one.");
|
string warning = context.API.GetTranslation("wox_plugin_websearch_action_keyword_exist");
|
||||||
|
MessageBox.Show(warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
UserSettingStorage.Instance.WebSearches.Add(new Core.UserSettings.WebSearch()
|
UserSettingStorage.Instance.WebSearches.Add(new Core.UserSettings.WebSearch()
|
||||||
@@ -97,13 +105,15 @@ namespace Wox.Plugin.WebSearch
|
|||||||
Url = url,
|
Url = url,
|
||||||
Title = title
|
Title = title
|
||||||
});
|
});
|
||||||
MessageBox.Show(string.Format("Add {0} web search successfully!", title));
|
string msg = context.API.GetTranslation("wox_plugin_websearch_succeed");
|
||||||
|
MessageBox.Show(msg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == action && o != updateWebSearch))
|
if (UserSettingStorage.Instance.WebSearches.Exists(o => o.ActionWord == action && o != updateWebSearch))
|
||||||
{
|
{
|
||||||
MessageBox.Show("ActionWord has existed, please input a new one.");
|
string warning = context.API.GetTranslation("wox_plugin_websearch_action_keyword_exist");
|
||||||
|
MessageBox.Show(warning);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
updateWebSearch.ActionWord = action;
|
updateWebSearch.ActionWord = action;
|
||||||
@@ -111,7 +121,8 @@ namespace Wox.Plugin.WebSearch
|
|||||||
updateWebSearch.Enabled = cbEnable.IsChecked ?? false;
|
updateWebSearch.Enabled = cbEnable.IsChecked ?? false;
|
||||||
updateWebSearch.Url = url;
|
updateWebSearch.Url = url;
|
||||||
updateWebSearch.Title= title;
|
updateWebSearch.Title= title;
|
||||||
MessageBox.Show(string.Format("Update {0} web search successfully!", title));
|
string msg = context.API.GetTranslation("wox_plugin_websearch_succeed");
|
||||||
|
MessageBox.Show(msg);
|
||||||
}
|
}
|
||||||
UserSettingStorage.Instance.Save();
|
UserSettingStorage.Instance.Save();
|
||||||
settingWindow.ReloadWebSearchView();
|
settingWindow.ReloadWebSearchView();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="300" d:DesignWidth="300">
|
d:DesignHeight="300" d:DesignWidth="500">
|
||||||
<Grid Margin="10">
|
<Grid Margin="10">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="42"/>
|
<RowDefinition Height="42"/>
|
||||||
@@ -12,21 +12,21 @@
|
|||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="50"/>
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<StackPanel Orientation="Horizontal" Grid.Row="0">
|
<StackPanel Orientation="Horizontal" Grid.Row="0">
|
||||||
<CheckBox x:Name="cbEnableWebSearchSuggestion" Unchecked="CbEnableWebSearchSuggestion_OnUnchecked" Checked="CbEnableWebSearchSuggestion_OnChecked" Margin="0 10 10 10">Enable search suggestions</CheckBox>
|
<CheckBox x:Name="cbEnableWebSearchSuggestion" Unchecked="CbEnableWebSearchSuggestion_OnUnchecked" Checked="CbEnableWebSearchSuggestion_OnChecked" Margin="0 10 10 10" Content="{DynamicResource wox_plugin_websearch_enable_suggestion}"></CheckBox>
|
||||||
<ComboBox x:Name="comboBoxSuggestionSource" SelectionChanged="ComboBoxSuggestionSource_OnSelectionChanged" Margin="10">
|
<ComboBox x:Name="comboBoxSuggestionSource" SelectionChanged="ComboBoxSuggestionSource_OnSelectionChanged" Margin="10">
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<ListView x:Name="webSearchView" Grid.Row="1">
|
<ListView x:Name="webSearchView" Grid.Row="1">
|
||||||
<ListView.View>
|
<ListView.View>
|
||||||
<GridView>
|
<GridView>
|
||||||
<GridViewColumn Header="ActionWord" Width="180">
|
<GridViewColumn Header="{DynamicResource wox_plugin_websearch_action_keyword}" Width="180">
|
||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding ActionWord}"/>
|
<TextBlock Text="{Binding ActionWord}"/>
|
||||||
</DataTemplate>
|
</DataTemplate>
|
||||||
</GridViewColumn.CellTemplate>
|
</GridViewColumn.CellTemplate>
|
||||||
</GridViewColumn>
|
</GridViewColumn>
|
||||||
<GridViewColumn Header="Url" Width="500">
|
<GridViewColumn Header="{DynamicResource wox_plugin_websearch_url}" Width="500">
|
||||||
<GridViewColumn.CellTemplate>
|
<GridViewColumn.CellTemplate>
|
||||||
<DataTemplate>
|
<DataTemplate>
|
||||||
<TextBlock Text="{Binding Url}"/>
|
<TextBlock Text="{Binding Url}"/>
|
||||||
@@ -37,9 +37,9 @@
|
|||||||
</ListView.View>
|
</ListView.View>
|
||||||
</ListView>
|
</ListView>
|
||||||
<StackPanel Grid.Row="2" HorizontalAlignment="Right" Orientation="Horizontal">
|
<StackPanel Grid.Row="2" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||||
<Button x:Name="btnDeleteWebSearch" Click="btnDeleteWebSearch_OnClick" Width="100" Margin="10" Content="Delete"/>
|
<Button x:Name="btnDeleteWebSearch" Click="btnDeleteWebSearch_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_websearch_delete}"/>
|
||||||
<Button x:Name="btnEditWebSearch" Click="btnEditWebSearch_OnClick" Width="100" Margin="10" Content="Edit"/>
|
<Button x:Name="btnEditWebSearch" Click="btnEditWebSearch_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_websearch_edit}"/>
|
||||||
<Button x:Name="btnAddWebSearch" Click="btnAddWebSearch_OnClick" Width="100" Margin="10" Content="Add"/>
|
<Button x:Name="btnAddWebSearch" Click="btnAddWebSearch_OnClick" Width="100" Margin="10" Content="{DynamicResource wox_plugin_websearch_add}"/>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ namespace Wox.Plugin.WebSearch
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class WebSearchesSetting : UserControl
|
public partial class WebSearchesSetting : UserControl
|
||||||
{
|
{
|
||||||
public WebSearchesSetting()
|
PluginInitContext context;
|
||||||
|
|
||||||
|
public WebSearchesSetting(PluginInitContext context)
|
||||||
{
|
{
|
||||||
|
this.context = context;
|
||||||
|
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
Loaded += Setting_Loaded;
|
Loaded += Setting_Loaded;
|
||||||
@@ -48,7 +52,7 @@ namespace Wox.Plugin.WebSearch
|
|||||||
|
|
||||||
private void btnAddWebSearch_OnClick(object sender, RoutedEventArgs e)
|
private void btnAddWebSearch_OnClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
WebSearchSetting webSearch = new WebSearchSetting(this);
|
WebSearchSetting webSearch = new WebSearchSetting(this,context);
|
||||||
webSearch.ShowDialog();
|
webSearch.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,8 +61,9 @@ namespace Wox.Plugin.WebSearch
|
|||||||
Core.UserSettings.WebSearch selectedWebSearch = webSearchView.SelectedItem as Core.UserSettings.WebSearch;
|
Core.UserSettings.WebSearch selectedWebSearch = webSearchView.SelectedItem as Core.UserSettings.WebSearch;
|
||||||
if (selectedWebSearch != null)
|
if (selectedWebSearch != null)
|
||||||
{
|
{
|
||||||
if (MessageBox.Show("Are your sure to delete " + selectedWebSearch.Title, "Delete WebSearch",
|
string msg = string.Format(context.API.GetTranslation("wox_plugin_websearch_delete_warning"),selectedWebSearch.Title);
|
||||||
MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
|
||||||
|
if (MessageBox.Show(msg,string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
UserSettingStorage.Instance.WebSearches.Remove(selectedWebSearch);
|
UserSettingStorage.Instance.WebSearches.Remove(selectedWebSearch);
|
||||||
webSearchView.Items.Refresh();
|
webSearchView.Items.Refresh();
|
||||||
@@ -66,7 +71,8 @@ namespace Wox.Plugin.WebSearch
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("Please select a web search");
|
string warning =context.API.GetTranslation("wox_plugin_websearch_pls_select_web_search");
|
||||||
|
MessageBox.Show(warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -75,13 +81,14 @@ namespace Wox.Plugin.WebSearch
|
|||||||
Core.UserSettings.WebSearch selectedWebSearch = webSearchView.SelectedItem as Core.UserSettings.WebSearch;
|
Core.UserSettings.WebSearch selectedWebSearch = webSearchView.SelectedItem as Core.UserSettings.WebSearch;
|
||||||
if (selectedWebSearch != null)
|
if (selectedWebSearch != null)
|
||||||
{
|
{
|
||||||
WebSearchSetting webSearch = new WebSearchSetting(this);
|
WebSearchSetting webSearch = new WebSearchSetting(this,context);
|
||||||
webSearch.UpdateItem(selectedWebSearch);
|
webSearch.UpdateItem(selectedWebSearch);
|
||||||
webSearch.ShowDialog();
|
webSearch.ShowDialog();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("Please select a web search");
|
string warning = context.API.GetTranslation("wox_plugin_websearch_pls_select_web_search");
|
||||||
|
MessageBox.Show(warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,6 +64,16 @@
|
|||||||
</Compile>
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="Languages\en.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<None Include="Languages\zh-cn.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<Page Include="WebSearchesSetting.xaml">
|
<Page Include="WebSearchesSetting.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
Reference in New Issue
Block a user