Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions v2rayN/v2rayN/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ public MainWindow()
{
InitializeComponent();
_config = LazyConfig.Instance.GetConfig();

WindowState = WindowState.Minimized;
Activated += MainWindow_Activated;

App.Current.SessionEnding += Current_SessionEnding;
this.Closing += MainWindow_Closing;
Expand Down Expand Up @@ -217,6 +220,14 @@ private void MainWindow_Closing(object? sender, CancelEventArgs e)
e.Cancel = true;
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)
{
Expand Down