1. Main window now stored the Left and Top positions.

2. Added global setting to set the start mode of the Main Window.
This commit is contained in:
Brett Hewitson 2021-11-23 15:26:06 +10:00
parent 229ee09049
commit 34582ca91b
20 changed files with 286 additions and 58 deletions

View file

@ -4,6 +4,7 @@ using ServerManagerTool.Common;
using ServerManagerTool.Common.Lib;
using ServerManagerTool.Common.Utils;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
@ -11,6 +12,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Xml;
using WPFSharp.Globalizer;
@ -26,6 +28,7 @@ namespace ServerManagerTool
public static readonly DependencyProperty AppInstanceProperty = DependencyProperty.Register(nameof(AppInstance), typeof(App), typeof(GlobalSettingsControl), new PropertyMetadata(null));
public static readonly DependencyProperty IsAdministratorProperty = DependencyProperty.Register(nameof(IsAdministrator), typeof(bool), typeof(GlobalSettingsControl), new PropertyMetadata(false));
public static readonly DependencyProperty WindowStatesProperty = DependencyProperty.Register(nameof(WindowStates), typeof(List<WindowState>), typeof(GlobalSettingsControl), new PropertyMetadata(new List<WindowState>()));
public GlobalSettingsControl()
{
@ -35,6 +38,12 @@ namespace ServerManagerTool
this.IsAdministrator = SecurityUtils.IsAdministrator();
this.Version = GetDeployedVersion();
this.WindowStates = new List<WindowState>();
foreach (var windowState in Enum.GetValues(typeof(WindowState)))
{
this.WindowStates.Add((WindowState)windowState);
}
InitializeComponent();
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
@ -65,6 +74,12 @@ namespace ServerManagerTool
set { SetValue(IsAdministratorProperty, value); }
}
public List<WindowState> WindowStates
{
get { return (List<WindowState>)GetValue(WindowStatesProperty); }
set { SetValue(WindowStatesProperty, value); }
}
public string Version
{
get;
@ -287,6 +302,18 @@ namespace ServerManagerTool
}
}
private void ComboBox_PreviewMouseWheel(object sender, MouseWheelEventArgs e)
{
var comboBox = sender as ComboBox;
if (comboBox == null)
return;
if (comboBox.IsDropDownOpen)
return;
e.Handled = true;
}
private void LanguageSelectionComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Config.CultureName = AvailableLanguages.Instance.SelectedLanguage;