Skip to content

Allow Windows sign-out and shutdown to proceed (#58) - #67

Open
elgegeto wants to merge 2 commits into
NikolayIT:masterfrom
elgegeto:fix/issue-58-windows-session-end
Open

elgegeto wants to merge 2 commits into
NikolayIT:masterfrom
elgegeto:fix/issue-58-windows-session-end

Conversation

@elgegeto

Copy link
Copy Markdown

Closes #58.

On Windows, Avalonia raises ShutdownRequested for WM_QUERYENDSESSION. Cancelling that event aborts sign-out or shutdown. The main window also intercepts non-programmatic closes for the close-to-tray feature, so both paths need to allow the Windows request through.

This change saves the current session and settings synchronously, then lets Avalonia handle the Windows session end without cancelling it. It also bypasses close-to-tray interception for that request. A failed save is best-effort and won't block sign-out.

Normal application Exit still sends stopped announces and performs the existing timed cleanup. The non-Windows shutdown handler is unchanged.

Verification: Code reviewed against Avalonia 12.1.4's Windows platform and desktop lifetime implementations. The .NET SDK isn't available in this environment, so I haven't run the build or a Windows sign-out test. The PR needs CI plus a manual Windows shutdown/sign-out check (ideally with close-to-tray enabled), followed by a normal File > Exit check.

Changed: App.axaml.cs, MainWindow.axaml.cs, and MainWindowViewModel.cs.

Persist the current session synchronously for WM_QUERYENDSESSION without cancelling it. Bypass close-to-tray interception during the Windows session-ending path, preserving the normal application quit behavior on other platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Shutting down or signing out of Windows is cancelled while RatioMaster runs

1 participant