4d8da05540
App applied a fixed Normal state after MainWindow had restored the saved placement, so the saved maximized flag never took effect (since 1.7.7).
47 lines
1.6 KiB
C#
47 lines
1.6 KiB
C#
namespace ThreadPilot.Helpers
|
|
{
|
|
using System.Windows;
|
|
|
|
public readonly record struct StartupWindowBehavior(
|
|
bool ShouldShowWindow,
|
|
bool ShowInTaskbar,
|
|
Visibility Visibility,
|
|
WindowState WindowState,
|
|
bool HideAfterShow,
|
|
bool ActivateAfterShow)
|
|
{
|
|
public static StartupWindowBehavior Resolve(bool isAutostart, bool startMinimized, bool restoreMaximized = false)
|
|
{
|
|
if (isAutostart && startMinimized)
|
|
{
|
|
return new StartupWindowBehavior(
|
|
ShouldShowWindow: false,
|
|
ShowInTaskbar: false,
|
|
Visibility: Visibility.Hidden,
|
|
WindowState: WindowState.Minimized,
|
|
HideAfterShow: false,
|
|
ActivateAfterShow: false);
|
|
}
|
|
|
|
if (startMinimized)
|
|
{
|
|
return new StartupWindowBehavior(
|
|
ShouldShowWindow: false,
|
|
ShowInTaskbar: false,
|
|
Visibility: Visibility.Hidden,
|
|
WindowState: WindowState.Minimized,
|
|
HideAfterShow: false,
|
|
ActivateAfterShow: false);
|
|
}
|
|
|
|
return new StartupWindowBehavior(
|
|
ShouldShowWindow: true,
|
|
ShowInTaskbar: true,
|
|
Visibility: Visibility.Visible,
|
|
WindowState: restoreMaximized ? WindowState.Maximized : WindowState.Normal,
|
|
HideAfterShow: false,
|
|
ActivateAfterShow: true);
|
|
}
|
|
}
|
|
}
|