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 09f27e345575f9044c035a7fea055a83f5136fa2. --------- Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
@@ -274,7 +274,7 @@ public class MainWindowViewModel : MyReactiveObject
|
|||||||
|
|
||||||
BlReloadEnabled = true;
|
BlReloadEnabled = true;
|
||||||
await Reload();
|
await Reload();
|
||||||
await AutoHideStartup();
|
// await AutoHideStartup();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Init
|
#endregion Init
|
||||||
@@ -576,6 +576,7 @@ public class MainWindowViewModel : MyReactiveObject
|
|||||||
await CoreManager.Instance.LoadCore(node);
|
await CoreManager.Instance.LoadCore(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
private async Task AutoHideStartup()
|
private async Task AutoHideStartup()
|
||||||
{
|
{
|
||||||
if (_config.UiItem.AutoHideStartup)
|
if (_config.UiItem.AutoHideStartup)
|
||||||
@@ -584,6 +585,7 @@ public class MainWindowViewModel : MyReactiveObject
|
|||||||
}
|
}
|
||||||
await Task.CompletedTask;
|
await Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#endregion core job
|
#endregion core job
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,12 @@ 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;
|
||||||
@@ -438,6 +444,11 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
|||||||
protected override void OnLoaded(object? sender, RoutedEventArgs e)
|
protected override void OnLoaded(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnLoaded(sender, e);
|
base.OnLoaded(sender, e);
|
||||||
|
if (_config.UiItem.AutoHideStartup)
|
||||||
|
{
|
||||||
|
this.ShowHideWindow(false);
|
||||||
|
_config.UiItem.ShowInTaskbar = true;
|
||||||
|
}
|
||||||
RestoreUI();
|
RestoreUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,12 @@ 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;
|
||||||
@@ -390,6 +396,10 @@ public partial class MainWindow
|
|||||||
protected override void OnLoaded(object? sender, RoutedEventArgs e)
|
protected override void OnLoaded(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
base.OnLoaded(sender, e);
|
base.OnLoaded(sender, e);
|
||||||
|
if (_config.UiItem.AutoHideStartup)
|
||||||
|
{
|
||||||
|
ShowHideWindow(false);
|
||||||
|
}
|
||||||
RestoreUI();
|
RestoreUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user