mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Changed the Window States when the language is changed.
This commit is contained in:
parent
2680464911
commit
19a9db6490
9 changed files with 326 additions and 47 deletions
|
|
@ -136,7 +136,7 @@
|
|||
<CheckBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" Content="{DynamicResource GlobalSettings_RunAsAdministratorLabel}" IsChecked="{Binding Config.RunAsAdministratorPrompt, Mode=TwoWay}" HorizontalAlignment="Left"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Margin="1" Content="{DynamicResource GlobalSettings_StartModeLabel}" VerticalAlignment="Center"/>
|
||||
<ComboBox Grid.Row="2" Grid.Column="1" Margin="5" ItemsSource="{Binding ElementName=GlobalSettings, Path=WindowStates}" SelectedValue="{Binding Config.MainWindow_WindowState}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
|
||||
<ComboBox Name="WindowStateComboBox" Grid.Row="2" Grid.Column="1" Margin="5" ItemsSource="{Binding ElementName=GlobalSettings, Path=WindowStates}" SelectedValue="{Binding Config.MainWindow_WindowState}" SelectedValuePath="ValueMember" DisplayMemberPath="DisplayMember" PreviewMouseWheel="ComboBox_PreviewMouseWheel"/>
|
||||
<CheckBox Grid.Row="2" Grid.Column="2" Grid.ColumnSpan="2" Margin="5" Content="{DynamicResource GlobalSettings_MinimizeToTrayLabel}" IsChecked="{Binding Config.MainWindow_MinimizeToTray, Mode=TwoWay}" HorizontalAlignment="Left" VerticalAlignment="Center"/>
|
||||
|
||||
<CheckBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" Content="{DynamicResource GlobalSettings_ManageFirewallLabel}" IsChecked="{Binding Config.ManageFirewallAutomatically, Mode=TwoWay}" HorizontalAlignment="Left"/>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ using ServerManagerTool.Common.Lib;
|
|||
using ServerManagerTool.Common.Model;
|
||||
using ServerManagerTool.Common.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
|
@ -39,12 +38,7 @@ namespace ServerManagerTool
|
|||
this.IsAdministrator = SecurityUtils.IsAdministrator();
|
||||
this.Version = GetDeployedVersion();
|
||||
|
||||
this.WindowStates = new ComboBoxItemList();
|
||||
foreach (WindowState windowState in Enum.GetValues(typeof(WindowState)))
|
||||
{
|
||||
var displayMember = _globalizer.GetResourceString($"WindowState_{windowState}") ?? windowState.ToString();
|
||||
this.WindowStates.Add(new Common.Model.ComboBoxItem(windowState.ToString(), displayMember));
|
||||
}
|
||||
PopulateWindowsStatesComboBox();
|
||||
|
||||
InitializeComponent();
|
||||
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
|
||||
|
|
@ -319,6 +313,8 @@ namespace ServerManagerTool
|
|||
private void LanguageSelectionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
Config.CultureName = AvailableLanguages.Instance.SelectedLanguage;
|
||||
|
||||
PopulateWindowsStatesComboBox();
|
||||
}
|
||||
|
||||
private void StyleSelectionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
|
|
@ -400,5 +396,23 @@ namespace ServerManagerTool
|
|||
App.Current.Shutdown(exitCode);
|
||||
}
|
||||
}
|
||||
|
||||
private void PopulateWindowsStatesComboBox()
|
||||
{
|
||||
var selectedValue = this.WindowStateComboBox?.SelectedValue ?? Config.MainWindow_WindowState;
|
||||
var windowStates = new ComboBoxItemList();
|
||||
|
||||
foreach (WindowState windowState in Enum.GetValues(typeof(WindowState)))
|
||||
{
|
||||
var displayMember = _globalizer.GetResourceString($"WindowState_{windowState}") ?? windowState.ToString();
|
||||
windowStates.Add(new Common.Model.ComboBoxItem(windowState.ToString(), displayMember));
|
||||
}
|
||||
|
||||
this.WindowStates = windowStates;
|
||||
if (this.WindowStateComboBox != null)
|
||||
{
|
||||
this.WindowStateComboBox.SelectedValue = selectedValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue