启动时不显示窗口直接隐藏到任务栏,但仍会在托盘有短暂显示

This commit is contained in:
ShiinaRinne 2023-02-26 14:41:28 +08:00
parent 3ab992f5fb
commit 5dc5c175d8

View file

@ -28,6 +28,9 @@ namespace v2rayN.Views
InitializeComponent();
_config = LazyConfig.Instance.GetConfig();
WindowState = WindowState.Minimized;
Activated += MainWindow_Activated;
App.Current.SessionEnding += Current_SessionEnding;
this.Closing += MainWindow_Closing;
this.PreviewKeyDown += MainWindow_PreviewKeyDown;
@ -218,6 +221,14 @@ namespace v2rayN.Views
ViewModel?.ShowHideWindow(false);
}
private void MainWindow_Activated(object sender, EventArgs e)
{
if (WindowState == WindowState.Minimized)
{
WindowState = WindowState.Normal;
}
}
private void menuExit_Click(object sender, RoutedEventArgs e)
{
tbNotify.Dispose();