Make settings window independent and taskbar-aware

Convert the settings window into an independent top-level window with its own taskbar icon and open-or-focus semantics. Removed Owner/anchor/toggle semantics from SettingsWindowService and added ScreenReferenceWindow for centering; settings windows now ShowInTaskbar = true and are truly destroyed on close. Added SettingsWindowPlacementHelper and tests for placement/centering. Main window now respects an AppSettingsSnapshot.ShowInTaskbar flag (new setting exposed in GeneralSettings UI) and slide/visibility animations and "back to Windows" behavior no longer affect the independent settings window. Updated various callers to use OpenIndependentSettingsModule, adjusted window transitions/X offsets, and added/updated spec files documenting the feature and animation boundary.
This commit is contained in:
lincube
2026-04-22 20:46:43 +08:00
parent aa7c118d13
commit e20462ac2b
15 changed files with 367 additions and 180 deletions

View File

@@ -117,8 +117,8 @@ public partial class App : Application
$"Opening settings window. Source='{source}'; PageTag='{pageTag ?? "<default>"}'.");
_settingsWindowService?.Open(new SettingsWindowOpenRequest(
Source: source,
Owner: _mainWindow is { IsVisible: true } ? _mainWindow : null,
PageId: pageTag));
PageId: pageTag,
ScreenReferenceWindow: _mainWindow is { IsVisible: true } ? _mainWindow : null));
}
public App()
@@ -738,7 +738,7 @@ public partial class App : Application
var mainWindow = GetOrCreateMainWindow(desktop, source);
mainWindow.PrepareEnterAnimation();
mainWindow.ShowInTaskbar = true;
mainWindow.ShowInTaskbar = ShouldShowMainWindowInTaskbar();
if (!mainWindow.IsVisible)
{
@@ -1106,7 +1106,7 @@ public partial class App : Application
var mainWindow = new MainWindow
{
DataContext = new MainWindowViewModel(),
ShowInTaskbar = true
ShowInTaskbar = ShouldShowMainWindowInTaskbar()
};
_mainWindowOpened = false;
@@ -1296,6 +1296,11 @@ public partial class App : Application
}
}
private bool ShouldShowMainWindowInTaskbar()
{
return _settingsFacade.Settings.LoadSnapshot<AppSettingsSnapshot>(SettingsScope.App).ShowInTaskbar;
}
private void SetDesktopShellState(DesktopShellState state, string source)
{
if (_desktopShellState == state)