mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-11 05:52:19 +02:00
Databinding for proxy tab
This commit is contained in:
@@ -14,7 +14,7 @@
|
|||||||
Height="600" Width="800" PreviewKeyDown="Window_PreviewKeyDown"
|
Height="600" Width="800" PreviewKeyDown="Window_PreviewKeyDown"
|
||||||
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}">
|
d:DataContext="{d:DesignInstance vm:SettingWindowViewModel}">
|
||||||
<TabControl Height="auto" SelectedIndex="0">
|
<TabControl Height="auto" SelectedIndex="0">
|
||||||
<TabItem Header="{DynamicResource general}" Height="24" VerticalAlignment="Top">
|
<TabItem Header="{DynamicResource general}">
|
||||||
<StackPanel Orientation="Vertical">
|
<StackPanel Orientation="Vertical">
|
||||||
<CheckBox IsChecked="{Binding Settings.StartWoxOnSystemStartup}" Margin="10">
|
<CheckBox IsChecked="{Binding Settings.StartWoxOnSystemStartup}" Margin="10">
|
||||||
<TextBlock Text="{DynamicResource startWoxOnSystemStartup}" />
|
<TextBlock Text="{DynamicResource startWoxOnSystemStartup}" />
|
||||||
@@ -61,9 +61,11 @@
|
|||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<DockPanel Grid.Column="0">
|
<DockPanel Grid.Column="0">
|
||||||
<TextBlock DockPanel.Dock="Top" Margin="10" Cursor="Hand"
|
<TextBlock DockPanel.Dock="Top" Margin="10">
|
||||||
MouseUp="OnMorePluginsClicked" Foreground="Blue"
|
<Hyperlink NavigateUri="{Binding Plugin, Mode=OneWay}" RequestNavigate="OnRequestNavigate">
|
||||||
Text="{DynamicResource browserMorePlugins}" />
|
<Run Text="{DynamicResource browserMorePlugins}"/>
|
||||||
|
</Hyperlink>
|
||||||
|
</TextBlock>
|
||||||
<ListBox SelectedIndex="0" SelectedItem="{Binding SelectedPlugin}"
|
<ListBox SelectedIndex="0" SelectedItem="{Binding SelectedPlugin}"
|
||||||
ItemsSource="{Binding PluginViewModels}"
|
ItemsSource="{Binding PluginViewModels}"
|
||||||
Margin="10, 0, 10, 10" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
Margin="10, 0, 10, 10" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
|
||||||
@@ -160,9 +162,12 @@
|
|||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<DockPanel Grid.Column="0">
|
<DockPanel Grid.Column="0">
|
||||||
<TextBlock DockPanel.Dock="Top" Margin="10" HorizontalAlignment="Left" Cursor="Hand"
|
<TextBlock DockPanel.Dock="Top" Margin="10" HorizontalAlignment="Left">
|
||||||
MouseUp="OnMoreThemesClick" Foreground="Blue"
|
<Hyperlink NavigateUri="{Binding Theme, Mode=OneWay}" RequestNavigate="OnRequestNavigate">
|
||||||
Text="{DynamicResource browserMoreThemes}" />
|
<Run Text="{DynamicResource browserMoreThemes}"/>
|
||||||
|
</Hyperlink>
|
||||||
|
</TextBlock>
|
||||||
|
|
||||||
<ListBox SelectedItem="{Binding SelectedTheme}" ItemsSource="{Binding Themes}"
|
<ListBox SelectedItem="{Binding SelectedTheme}" ItemsSource="{Binding Themes}"
|
||||||
Margin="10, 0, 10, 10" Width="180"
|
Margin="10, 0, 10, 10" Width="180"
|
||||||
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
|
||||||
@@ -287,53 +292,33 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="{DynamicResource proxy}" Height="22" VerticalAlignment="Top">
|
<TabItem Header="{DynamicResource proxy}" >
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
<CheckBox x:Name="ToggleProxy" Margin="10" Checked="ProxyToggled" Unchecked="ProxyToggled">
|
<CheckBox Margin="10" IsChecked="{Binding Settings.ProxyEnabled}">
|
||||||
<TextBlock Text="{DynamicResource enableProxy}" />
|
<TextBlock Text="{DynamicResource enableProxy}" />
|
||||||
</CheckBox>
|
</CheckBox>
|
||||||
<Grid Margin="10" IsEnabled="{Binding IsChecked, ElementName=ToggleProxy}">
|
<Grid Margin="10" IsEnabled="{Binding Settings.ProxyEnabled}">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
<RowDefinition />
|
<RowDefinition />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="80" />
|
<ColumnDefinition Width="100" />
|
||||||
<ColumnDefinition Width="220" />
|
<ColumnDefinition Width="200" />
|
||||||
<ColumnDefinition Width="80" />
|
<ColumnDefinition Width="100" />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition Width="200"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Border Grid.Row="0" Grid.Column="0" Padding="5">
|
<TextBlock Text="{DynamicResource server}" Grid.Row="0" Grid.Column="0" Padding="5" />
|
||||||
<TextBlock Text="{DynamicResource server}" />
|
<TextBox Text="{Binding Settings.ProxyServer}" Grid.Row="0" Grid.Column="1" Padding="5" />
|
||||||
</Border>
|
<TextBlock Text="{DynamicResource port}" Grid.Row="0" Grid.Column="2" Padding="5"/>
|
||||||
<Border Grid.Row="0" Grid.Column="1" Padding="5">
|
<TextBox Text="{Binding Settings.ProxyPort}" Grid.Row="0" Grid.Column="3" Padding="5"/>
|
||||||
<TextBox Width="200" HorizontalAlignment="Left" x:Name="ProxyServer" />
|
<TextBlock Text="{DynamicResource userName}" Grid.Row="1" Grid.Column="0" Padding="5"/>
|
||||||
</Border>
|
<TextBox Text="{Binding Settings.ProxyUserName}" Grid.Row="1" Grid.Column="1" Padding="5"/>
|
||||||
<Border Grid.Row="0" Grid.Column="2" Padding="5">
|
<TextBlock Text="{DynamicResource password}" Grid.Row="1" Grid.Column="2" Padding="5" />
|
||||||
<TextBlock Text="{DynamicResource port}" />
|
<TextBox Text="{Binding Settings.ProxyPassword}" Grid.Row="1" Grid.Column="3" Padding="5" />
|
||||||
</Border>
|
|
||||||
<Border Grid.Row="0" Grid.Column="3" Padding="5">
|
|
||||||
<TextBox Width="50" HorizontalAlignment="Left" x:Name="ProxyPort" />
|
|
||||||
</Border>
|
|
||||||
<Border Grid.Row="1" Grid.Column="0" Padding="5">
|
|
||||||
<TextBlock Text="{DynamicResource userName}" />
|
|
||||||
</Border>
|
|
||||||
<Border Grid.Row="1" Grid.Column="1" Padding="5">
|
|
||||||
<TextBox Width="200" HorizontalAlignment="Left" x:Name="ProxyUserName" />
|
|
||||||
</Border>
|
|
||||||
<Border Grid.Row="1" Grid.Column="2" Padding="5">
|
|
||||||
<TextBlock Text="{DynamicResource password}" />
|
|
||||||
</Border>
|
|
||||||
<Border Grid.Row="1" Grid.Column="3" Padding="5">
|
|
||||||
<PasswordBox Width="200" HorizontalAlignment="Left" x:Name="ProxyPassword" />
|
|
||||||
</Border>
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<StackPanel Orientation="Horizontal" IsEnabled="{Binding IsChecked, ElementName=ToggleProxy}">
|
<Button Content="{DynamicResource testProxy}" IsEnabled="{Binding Settings.ProxyEnabled}"
|
||||||
<Button Width="80" HorizontalAlignment="Left" Margin="10" Click="btnTestProxy_Click"
|
Width="80" HorizontalAlignment="Left" Margin="10" Click="OnTestProxyClick"/>
|
||||||
Content="{DynamicResource testProxy}" />
|
|
||||||
<Button Width="80" HorizontalAlignment="Left" Margin="10" Click="btnSaveProxy_Click"
|
|
||||||
Content="{DynamicResource save}" />
|
|
||||||
</StackPanel>
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="{DynamicResource about}">
|
<TabItem Header="{DynamicResource about}">
|
||||||
@@ -354,34 +339,27 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
<TextBlock Grid.Row="0" Grid.ColumnSpan="2" Text="{Binding ActivatedTimes}" />
|
||||||
<TextBlock x:Name="ActivatedTimes" Grid.Row="0" Grid.ColumnSpan="3"
|
<TextBlock Grid.Row="1" Grid.Column="0" Text="{DynamicResource website}"/>
|
||||||
Text="{DynamicResource about_activate_times}" />
|
<TextBlock Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left">
|
||||||
|
<Hyperlink NavigateUri="{Binding Github, Mode=OneWay}" RequestNavigate="OnRequestNavigate">
|
||||||
<TextBlock Grid.Column="0" Grid.Row="1" Text="{DynamicResource website}" />
|
<Run Text="{Binding Github, Mode=OneWay}"/>
|
||||||
<TextBlock Grid.Column="1" Grid.Row="1" HorizontalAlignment="Left">
|
|
||||||
<Hyperlink NavigateUri="https://github.com/Wox-launcher/Wox" RequestNavigate="OnRequestNavigate">
|
|
||||||
https://github.com/Wox-launcher/Wox
|
|
||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="0" Text="{DynamicResource version}" />
|
||||||
|
<TextBlock Grid.Row="2" Grid.Column="1" Text="{Binding Version}" />
|
||||||
<TextBlock Grid.Column="0" Grid.Row="2" Text="{DynamicResource version}" />
|
<TextBlock Grid.Row="3" Grid.Column="0" Text="{DynamicResource releaseNotes}" />
|
||||||
<TextBlock Grid.Column="1" Grid.Row="2" HorizontalAlignment="Left" x:Name="Version" Text="1.0.0" />
|
<TextBlock Grid.Row="3" Grid.Column="1" >
|
||||||
|
<Hyperlink NavigateUri="{Binding ReleaseNotes, Mode=OneWay}"
|
||||||
<TextBlock Grid.Column="0" Grid.Row="3" Text="{DynamicResource releaseNotes}" />
|
|
||||||
<TextBlock Grid.Column="1" Grid.Row="3" HorizontalAlignment="Left">
|
|
||||||
<Hyperlink NavigateUri="https://github.com/Wox-launcher/Wox/releases/latest"
|
|
||||||
RequestNavigate="OnRequestNavigate">
|
RequestNavigate="OnRequestNavigate">
|
||||||
https://github.com/Wox-launcher/Wox/releases/latest
|
<Run Text="{Binding ReleaseNotes, Mode=OneWay}"/>
|
||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
<Button Grid.Row="4" Grid.Column="0"
|
||||||
<Button Grid.Column="0" Grid.Row="4" Content="{DynamicResource checkUpdates}"
|
Content="{DynamicResource checkUpdates}" Click="OnCheckUpdates"
|
||||||
HorizontalAlignment="Left" Margin="10 10 10 10" Click="OnCheckUpdates" />
|
HorizontalAlignment="Left" Margin="10 10 10 10" />
|
||||||
<TextBlock Grid.Column="1" Grid.Row="4" Name="NewVersionTips" HorizontalAlignment="Left"
|
<TextBlock Grid.Row="4" Grid.Column="1" Text="{Binding NewVersionTips}"
|
||||||
Text="{DynamicResource newVersionTips}" Visibility="Hidden" />
|
HorizontalAlignment="Left" Visibility="{Binding NewVersionTipsVisibility}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
|
|||||||
@@ -26,8 +26,6 @@ namespace Wox
|
|||||||
private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
|
private const string StartupPath = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run";
|
||||||
|
|
||||||
public readonly IPublicAPI _api;
|
public readonly IPublicAPI _api;
|
||||||
bool settingsLoaded;
|
|
||||||
private bool themeTabLoaded;
|
|
||||||
private Settings _settings;
|
private Settings _settings;
|
||||||
private SettingWindowViewModel _viewModel;
|
private SettingWindowViewModel _viewModel;
|
||||||
|
|
||||||
@@ -38,39 +36,6 @@ namespace Wox
|
|||||||
DataContext = viewModel;
|
DataContext = viewModel;
|
||||||
_viewModel = viewModel;
|
_viewModel = viewModel;
|
||||||
_api = api;
|
_api = api;
|
||||||
Loaded += Setting_Loaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ProxyToggled(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
_settings.ProxyEnabled = ToggleProxy.IsChecked ?? false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void Setting_Loaded(object sender, RoutedEventArgs ev)
|
|
||||||
{
|
|
||||||
#region Proxy
|
|
||||||
|
|
||||||
ToggleProxy.IsChecked = _settings.ProxyEnabled;
|
|
||||||
ProxyServer.Text = _settings.ProxyServer;
|
|
||||||
if (_settings.ProxyPort != 0)
|
|
||||||
{
|
|
||||||
ProxyPort.Text = _settings.ProxyPort.ToString();
|
|
||||||
}
|
|
||||||
ProxyUserName.Text = _settings.ProxyUserName;
|
|
||||||
ProxyPassword.Password = _settings.ProxyPassword;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region About
|
|
||||||
|
|
||||||
string activateTimes = string.Format(
|
|
||||||
InternationalizationManager.Instance.GetTranslation("about_activate_times"), _settings.ActivateTimes);
|
|
||||||
ActivatedTimes.Text = activateTimes;
|
|
||||||
Version.Text = Infrastructure.Constant.Version;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
settingsLoaded = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region General
|
#region General
|
||||||
@@ -245,14 +210,6 @@ namespace Wox
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Theme
|
|
||||||
|
|
||||||
private void OnMoreThemesClick(object sender, MouseButtonEventArgs e)
|
|
||||||
{
|
|
||||||
Process.Start("http://www.getwox.com/theme");
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Plugin
|
#region Plugin
|
||||||
|
|
||||||
private void OnPluginToggled(object sender, RoutedEventArgs e)
|
private void OnPluginToggled(object sender, RoutedEventArgs e)
|
||||||
@@ -301,82 +258,40 @@ namespace Wox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnMorePluginsClicked(object sender, MouseButtonEventArgs e)
|
|
||||||
{
|
|
||||||
Process.Start("http://www.getwox.com/plugin");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Proxy
|
#region Proxy
|
||||||
|
|
||||||
private void btnSaveProxy_Click(object sender, RoutedEventArgs e)
|
private void OnTestProxyClick(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
_settings.ProxyEnabled = ToggleProxy.IsChecked ?? false;
|
if (string.IsNullOrEmpty(_settings.ProxyServer))
|
||||||
|
|
||||||
int port = 80;
|
|
||||||
if (_settings.ProxyEnabled)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(ProxyServer.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (string.IsNullOrEmpty(ProxyPort.Text))
|
|
||||||
{
|
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("portCantBeEmpty"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!int.TryParse(ProxyPort.Text, out port))
|
|
||||||
{
|
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidPortFormat"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_settings.ProxyServer = ProxyServer.Text;
|
|
||||||
_settings.ProxyPort = port;
|
|
||||||
_settings.ProxyUserName = ProxyUserName.Text;
|
|
||||||
_settings.ProxyPassword = ProxyPassword.Password;
|
|
||||||
|
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("saveProxySuccessfully"));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void btnTestProxy_Click(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(ProxyServer.Text))
|
|
||||||
{
|
{
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty"));
|
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("serverCantBeEmpty"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (string.IsNullOrEmpty(ProxyPort.Text))
|
if (_settings.ProxyPort > 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("portCantBeEmpty"));
|
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("portCantBeEmpty"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int port;
|
|
||||||
if (!int.TryParse(ProxyPort.Text, out port))
|
|
||||||
{
|
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("invalidPortFormat"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://www.baidu.com");
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Infrastructure.Constant.Github);
|
||||||
request.Timeout = 1000 * 5;
|
request.Timeout = 1000 * 5;
|
||||||
request.ReadWriteTimeout = 1000 * 5;
|
request.ReadWriteTimeout = 1000 * 5;
|
||||||
if (string.IsNullOrEmpty(ProxyUserName.Text))
|
if (string.IsNullOrEmpty(_settings.ProxyUserName) || string.IsNullOrEmpty(_settings.ProxyPassword))
|
||||||
{
|
{
|
||||||
request.Proxy = new WebProxy(ProxyServer.Text, port);
|
request.Proxy = new WebProxy(_settings.ProxyServer, _settings.ProxyPort);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
request.Proxy = new WebProxy(ProxyServer.Text, port);
|
request.Proxy = new WebProxy(_settings.ProxyServer, _settings.ProxyPort)
|
||||||
request.Proxy.Credentials = new NetworkCredential(ProxyUserName.Text, ProxyPassword.Password);
|
{
|
||||||
|
Credentials = new NetworkCredential(_settings.ProxyUserName, _settings.ProxyPassword)
|
||||||
|
};
|
||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
var response = (HttpWebResponse)request.GetResponse();
|
||||||
if (response.StatusCode == HttpStatusCode.OK)
|
if (response.StatusCode == HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("proxyIsCorrect"));
|
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("proxyIsCorrect"));
|
||||||
@@ -412,9 +327,8 @@ namespace Wox
|
|||||||
var oldVersion = Updater.NumericVersion(Infrastructure.Constant.Version);
|
var oldVersion = Updater.NumericVersion(Infrastructure.Constant.Version);
|
||||||
if (newVersion > oldVersion)
|
if (newVersion > oldVersion)
|
||||||
{
|
{
|
||||||
NewVersionTips.Text = string.Format(NewVersionTips.Text, version);
|
|
||||||
NewVersionTips.Visibility = Visibility.Visible;
|
|
||||||
Updater.UpdateApp();
|
Updater.UpdateApp();
|
||||||
|
_viewModel.NewVersionTips = version;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -424,7 +338,5 @@ namespace Wox
|
|||||||
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
Process.Start(new ProcessStartInfo(e.Uri.AbsoluteUri));
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,14 +21,15 @@ namespace Wox.ViewModel
|
|||||||
public class SettingWindowViewModel
|
public class SettingWindowViewModel
|
||||||
{
|
{
|
||||||
public Settings Settings { get; set; }
|
public Settings Settings { get; set; }
|
||||||
|
|
||||||
private readonly JsonStrorage<Settings> _storage;
|
private readonly JsonStrorage<Settings> _storage;
|
||||||
|
|
||||||
#region general
|
#region general
|
||||||
public List<Language> Languages => InternationalizationManager.Instance.LoadAvailableLanguages();
|
public List<Language> Languages => _translater.LoadAvailableLanguages();
|
||||||
|
private Internationalization _translater => InternationalizationManager.Instance;
|
||||||
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
|
public IEnumerable<int> MaxResultsRange => Enumerable.Range(2, 16);
|
||||||
#endregion
|
#endregion
|
||||||
#region plugin
|
#region plugin
|
||||||
|
public static string Plugin => "http://www.getwox.com/plugin";
|
||||||
public PluginViewModel SelectedPlugin { get; set; }
|
public PluginViewModel SelectedPlugin { get; set; }
|
||||||
public IList<PluginViewModel> PluginViewModels
|
public IList<PluginViewModel> PluginViewModels
|
||||||
{
|
{
|
||||||
@@ -72,13 +73,13 @@ namespace Wox.ViewModel
|
|||||||
{
|
{
|
||||||
multipleActionKeywordsProvider.ActionKeywordsChanged += (o, e) =>
|
multipleActionKeywordsProvider.ActionKeywordsChanged += (o, e) =>
|
||||||
{
|
{
|
||||||
// update in-memory data
|
// update in-memory data
|
||||||
PluginManager.UpdateActionKeywordForPlugin(SelectedPlugin.PluginPair, e.OldActionKeyword,
|
PluginManager.UpdateActionKeywordForPlugin(SelectedPlugin.PluginPair, e.OldActionKeyword,
|
||||||
e.NewActionKeyword);
|
e.NewActionKeyword);
|
||||||
// update persistant data
|
// update persistant data
|
||||||
Settings.PluginSettings.UpdateActionKeyword(SelectedPlugin.Metadata);
|
Settings.PluginSettings.UpdateActionKeyword(SelectedPlugin.Metadata);
|
||||||
|
|
||||||
MessageBox.Show(InternationalizationManager.Instance.GetTranslation("succeed"));
|
MessageBox.Show(_translater.GetTranslation("succeed"));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
var control = settingProvider.CreateSettingPanel();
|
var control = settingProvider.CreateSettingPanel();
|
||||||
@@ -95,6 +96,7 @@ namespace Wox.ViewModel
|
|||||||
#endregion
|
#endregion
|
||||||
#region theme
|
#region theme
|
||||||
|
|
||||||
|
public static string Theme => @"http://www.getwox.com/theme";
|
||||||
public string SelectedTheme
|
public string SelectedTheme
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -139,8 +141,7 @@ namespace Wox.ViewModel
|
|||||||
{
|
{
|
||||||
|
|
||||||
const string image = "app.png";
|
const string image = "app.png";
|
||||||
const string theme = "http://www.getwox.com/theme/builder";
|
|
||||||
const string plugin = "http://www.getwox.com/plugin";
|
|
||||||
List<Result> results = new List<Result>
|
List<Result> results = new List<Result>
|
||||||
{
|
{
|
||||||
new Result
|
new Result
|
||||||
@@ -164,12 +165,12 @@ namespace Wox.ViewModel
|
|||||||
new Result
|
new Result
|
||||||
{
|
{
|
||||||
Title = "Build custom themes at: ",
|
Title = "Build custom themes at: ",
|
||||||
SubTitle = theme,
|
SubTitle = Theme,
|
||||||
},
|
},
|
||||||
new Result
|
new Result
|
||||||
{
|
{
|
||||||
Title = "Install plugins from: ",
|
Title = "Install plugins from: ",
|
||||||
SubTitle = plugin,
|
SubTitle = Plugin,
|
||||||
IcoPath = image,
|
IcoPath = image,
|
||||||
},
|
},
|
||||||
new Result
|
new Result
|
||||||
@@ -278,8 +279,25 @@ namespace Wox.ViewModel
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
#region hotkey
|
#region hotkey
|
||||||
|
public CustomPluginHotkey SelectedCustomPluginHotkey { get; set; }
|
||||||
|
#endregion
|
||||||
|
#region about
|
||||||
|
|
||||||
public CustomPluginHotkey SelectedCustomPluginHotkey {get;set;}
|
public static string Github => Infrastructure.Constant.Github;
|
||||||
|
public static string ReleaseNotes => @"https://github.com/Wox-launcher/Wox/releases/latest";
|
||||||
|
public static string Version => Infrastructure.Constant.Version;
|
||||||
|
public string ActivatedTimes => Format(_translater.GetTranslation("about_activate_times"), Settings.ActivateTimes);
|
||||||
|
private string _newVersionTips;
|
||||||
|
public string NewVersionTips
|
||||||
|
{
|
||||||
|
get { return _newVersionTips; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
_newVersionTips = Format(_translater.GetTranslation("newVersionTips"), value);
|
||||||
|
NewVersionTipsVisibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public Visibility NewVersionTipsVisibility { get; set; }
|
||||||
#endregion
|
#endregion
|
||||||
public SettingWindowViewModel()
|
public SettingWindowViewModel()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user