mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-13 11:59:13 +00:00
Fix: AutoHideStartup's bug of displaying window before hiding it. (#8083)
* Fix: AutoHideStartup's bug of displaying window before hiding it.
* Disable AutoHideStartup for Linux
* Revert "Disable AutoHideStartup for Linux"
This reverts commit 09f27e3455
.
---------
Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
parent
9c58fec8d4
commit
40c90d5b3b
3 changed files with 24 additions and 1 deletions
|
@ -274,7 +274,7 @@ public class MainWindowViewModel : MyReactiveObject
|
|||
|
||||
BlReloadEnabled = true;
|
||||
await Reload();
|
||||
await AutoHideStartup();
|
||||
// await AutoHideStartup();
|
||||
}
|
||||
|
||||
#endregion Init
|
||||
|
@ -576,6 +576,7 @@ public class MainWindowViewModel : MyReactiveObject
|
|||
await CoreManager.Instance.LoadCore(node);
|
||||
}
|
||||
|
||||
/*
|
||||
private async Task AutoHideStartup()
|
||||
{
|
||||
if (_config.UiItem.AutoHideStartup)
|
||||
|
@ -584,6 +585,7 @@ public class MainWindowViewModel : MyReactiveObject
|
|||
}
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
*/
|
||||
|
||||
#endregion core job
|
||||
|
||||
|
|
|
@ -31,6 +31,12 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
|||
_config = AppManager.Instance.Config;
|
||||
_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;
|
||||
menuSettingsSetUWP.Click += menuSettingsSetUWP_Click;
|
||||
menuPromotion.Click += menuPromotion_Click;
|
||||
|
@ -438,6 +444,11 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
|||
protected override void OnLoaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(sender, e);
|
||||
if (_config.UiItem.AutoHideStartup)
|
||||
{
|
||||
this.ShowHideWindow(false);
|
||||
_config.UiItem.ShowInTaskbar = true;
|
||||
}
|
||||
RestoreUI();
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,12 @@ public partial class MainWindow
|
|||
_config = AppManager.Instance.Config;
|
||||
ThreadPool.RegisterWaitForSingleObject(App.ProgramStarted, OnProgramStarted, null, -1, false);
|
||||
|
||||
if (_config.UiItem.AutoHideStartup)
|
||||
{
|
||||
this.ShowActivated = false;
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
App.Current.SessionEnding += Current_SessionEnding;
|
||||
this.Closing += MainWindow_Closing;
|
||||
this.PreviewKeyDown += MainWindow_PreviewKeyDown;
|
||||
|
@ -390,6 +396,10 @@ public partial class MainWindow
|
|||
protected override void OnLoaded(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
base.OnLoaded(sender, e);
|
||||
if (_config.UiItem.AutoHideStartup)
|
||||
{
|
||||
ShowHideWindow(false);
|
||||
}
|
||||
RestoreUI();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue