2dust 2025-10-08 14:36:47 +08:00
parent 1607525539
commit 4eaf31bbf8
2 changed files with 9 additions and 12 deletions

View file

@ -31,12 +31,6 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
_config = AppManager.Instance.Config; _config = AppManager.Instance.Config;
_manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.TopRight }; _manager = new WindowNotificationManager(TopLevel.GetTopLevel(this)) { MaxItems = 3, Position = NotificationPosition.TopRight };
if (_config.UiItem.AutoHideStartup)
{
this.ShowActivated = false;
this.WindowState = WindowState.Minimized;
}
this.KeyDown += MainWindow_KeyDown; this.KeyDown += MainWindow_KeyDown;
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click; menuSettingsSetUWP.Click += menuSettingsSetUWP_Click;
menuPromotion.Click += menuPromotion_Click; menuPromotion.Click += menuPromotion_Click;
@ -184,6 +178,11 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
} }
menuAddServerViaScan.IsVisible = false; menuAddServerViaScan.IsVisible = false;
if (_config.UiItem.AutoHideStartup)
{
this.WindowState = WindowState.Minimized;
}
AddHelpMenuItem(); AddHelpMenuItem();
} }

View file

@ -25,12 +25,6 @@ public partial class MainWindow
_config = AppManager.Instance.Config; _config = AppManager.Instance.Config;
ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false); ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false);
if (_config.UiItem.AutoHideStartup)
{
this.ShowActivated = false;
this.WindowState = WindowState.Minimized;
}
App.Current.SessionEnding += Current_SessionEnding; App.Current.SessionEnding += Current_SessionEnding;
this.Closing += MainWindow_Closing; this.Closing += MainWindow_Closing;
this.PreviewKeyDown += MainWindow_PreviewKeyDown; this.PreviewKeyDown += MainWindow_PreviewKeyDown;
@ -164,6 +158,10 @@ public partial class MainWindow
}); });
this.Title = $"{Utils.GetVersion()} - {(Utils.IsAdministrator() ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}"; this.Title = $"{Utils.GetVersion()} - {(Utils.IsAdministrator() ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
if (_config.UiItem.AutoHideStartup)
{
this.WindowState = WindowState.Minimized;
}
if (!_config.GuiItem.EnableHWA) if (!_config.GuiItem.EnableHWA)
{ {