Changed the Window States when the language is changed.

This commit is contained in:
Brett Hewitson 2021-11-30 13:05:07 +10:00
parent 2680464911
commit 19a9db6490
9 changed files with 326 additions and 47 deletions

View file

@ -9,8 +9,8 @@
<entry>
<id>urn:uuid:38961ED8-0964-4C1A-B09C-8AE2C5FCF76E</id>
<title>1.1.54 (1.1.54.1)</title>
<summary>1.1.54.1</summary>
<title>1.1.54 (1.1.54.2)</title>
<summary>1.1.54.2</summary>
<link href="" />
<updated>2021-11-30T00:00:00Z</updated>
<content type="xhtml">

View file

@ -7,6 +7,29 @@
<link href="http://servermanagers.freeforums.net/" />
<updated>2021-11-30T00:00:00Z</updated>
<entry>
<id>urn:uuid:38961ED8-0964-4C1A-B09C-8AE2C5FCF76E</id>
<title>1.1.54 (1.1.54.2)</title>
<summary>1.1.54.2</summary>
<link href="" />
<updated>2021-11-30T00:00:00Z</updated>
<content type="xhtml">
<div xmlns="http://www.w3.org/1999/xhtml" style="font-family: Arial, Verdana, Helvetica, Sans-Serif;font-size: .8em;">
<p>
<u style="font-size: .9em;">CHANGE</u>
<br/>
<ul>
<li>Changed the Window States when the language is changed.</li>
</ul>
</p>
</div>
</content>
<author>
<name>bletch</name>
<email>bletch1971@hotmail.com</email>
</author>
</entry>
<entry>
<id>urn:uuid:38961ED8-0964-4C1A-B09C-8AE2C5FCF76E</id>
<title>1.1.54 (1.1.54.1)</title>

View file

@ -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"/>

View file

@ -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;
}
}
}
}