Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ClassicDesktop Lifetime so that ShutdownRequested event is raised… #7400

Merged
merged 10 commits into from Jan 20, 2022

Conversation

danwalmsley
Copy link
Member

@danwalmsley danwalmsley commented Jan 20, 2022

… even with programatic calls to Shutdown.

What does the pull request do?

Many people are confused about the seperate concepts off "Application" shutdown and "Window" closing.

In OSX these are clearly seperate concepts, in Win32.. they also are but 99% of the time.. they are conflated to mean the same thing.

This makes sure that all programmatic and OS triggered "Application" shutdown requests raise the ShutdownRequested event and is cancellable.

It adds a method TryShutdown leaving the existing Shutdown method to be as it is now... shutdown immediately no matter what.

What is the current behavior?

OSX Application Menu Quit menu Item is not cancellable.

What is the updated/expected behavior with this PR?

It is cancellable.

End users can check both ApplicationLifetime.ShutdownRequested event and Window.Closing events to cancel shutdown.

How was the solution implemented (if it's not obvious)?

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

Fixes #7389
Fixes #7393

@maxkatz6 maxkatz6 merged commit 2950c45 into master Jan 20, 2022
@maxkatz6 maxkatz6 deleted the fixes/application-shutdown-osx branch January 20, 2022 17:46
danwalmsley pushed a commit that referenced this pull request Jan 24, 2022
Fix ClassicDesktop Lifetime so that ShutdownRequested event is raised…
# Conflicts:
#	src/Avalonia.Controls/ApiCompatBaseline.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Canceling the closing event is not working ShutdownRequested not working on macOS
3 participants