mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
Code Cleanup of MainWindow
This commit is contained in:
parent
f8df14dc61
commit
a2b811972f
3 changed files with 120 additions and 127 deletions
|
|
@ -44,6 +44,47 @@ namespace ServerManagerTool
|
|||
public static readonly DependencyProperty LatestServerManagerVersionProperty = DependencyProperty.Register(nameof(LatestServerManagerVersion), typeof(Version), typeof(MainWindow), new PropertyMetadata(new Version()));
|
||||
public static readonly DependencyProperty NewServerManagerAvailableProperty = DependencyProperty.Register(nameof(NewServerManagerAvailable), typeof(bool), typeof(MainWindow), new PropertyMetadata(false));
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
this.AppInstance = App.Instance;
|
||||
this.Config = Config.Default;
|
||||
|
||||
InitializeComponent();
|
||||
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
|
||||
|
||||
this.ServerManager = ServerManager.Instance;
|
||||
|
||||
this.DataContext = this;
|
||||
this.versionChecker = new ActionQueue();
|
||||
this.scheduledTaskChecker = new ActionQueue();
|
||||
|
||||
IsAdministrator = SecurityUtils.IsAdministrator();
|
||||
if (!string.IsNullOrWhiteSpace(App.Instance.Title))
|
||||
{
|
||||
this.Title = App.Instance.Title;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsAdministrator)
|
||||
{
|
||||
this.Title = _globalizer.GetResourceString("MainWindow_TitleWithAdmin");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Title = _globalizer.GetResourceString("MainWindow_Title");
|
||||
}
|
||||
}
|
||||
|
||||
this.Left = Config.Default.MainWindow_Left;
|
||||
this.Top = Config.Default.MainWindow_Top;
|
||||
this.Height = Config.Default.MainWindow_Height;
|
||||
this.Width = Config.Default.MainWindow_Width;
|
||||
this.WindowState = Config.Default.MainWindow_WindowState;
|
||||
|
||||
// hook into the language change event
|
||||
GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent += ResourceDictionaryChangedEvent;
|
||||
}
|
||||
|
||||
public App AppInstance
|
||||
{
|
||||
get { return GetValue(AppInstanceProperty) as App; }
|
||||
|
|
@ -122,47 +163,6 @@ namespace ServerManagerTool
|
|||
set { SetValue(NewServerManagerAvailableProperty, value); }
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
this.AppInstance = App.Instance;
|
||||
this.Config = Config.Default;
|
||||
|
||||
InitializeComponent();
|
||||
WindowUtils.RemoveDefaultResourceDictionary(this, Config.Default.DefaultGlobalizationFile);
|
||||
|
||||
this.ServerManager = ServerManager.Instance;
|
||||
|
||||
this.DataContext = this;
|
||||
this.versionChecker = new ActionQueue();
|
||||
this.scheduledTaskChecker = new ActionQueue();
|
||||
|
||||
IsAdministrator = SecurityUtils.IsAdministrator();
|
||||
if (!string.IsNullOrWhiteSpace(App.Instance.Title))
|
||||
{
|
||||
this.Title = App.Instance.Title;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (IsAdministrator)
|
||||
{
|
||||
this.Title = _globalizer.GetResourceString("MainWindow_TitleWithAdmin");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Title = _globalizer.GetResourceString("MainWindow_Title");
|
||||
}
|
||||
}
|
||||
|
||||
this.Left = Config.Default.MainWindow_Left;
|
||||
this.Top = Config.Default.MainWindow_Top;
|
||||
this.Height = Config.Default.MainWindow_Height;
|
||||
this.Width = Config.Default.MainWindow_Width;
|
||||
this.WindowState = Config.Default.MainWindow_WindowState;
|
||||
|
||||
// hook into the language change event
|
||||
GlobalizedApplication.Instance.GlobalizationManager.ResourceDictionaryChangedEvent += ResourceDictionaryChangedEvent;
|
||||
}
|
||||
|
||||
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
//
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue