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

ShutdownRequested not working on macOS #7389

Closed
WanderingForLove opened this issue Jan 19, 2022 · 0 comments · Fixed by #7400
Closed

ShutdownRequested not working on macOS #7389

WanderingForLove opened this issue Jan 19, 2022 · 0 comments · Fixed by #7400
Labels

Comments

@WanderingForLove
Copy link

Describe the bug
Hi, I tried to add ShutdownRequested in OnFrameworkInitializationCompleted function, however it does not seem to work.

To Reproduce
Steps to reproduce the behavior:

public override async void OnFrameworkInitializationCompleted()
{
    if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
    {
        ...... // Some code here
        desktop.ShutdownRequested += Desktop_ShutdownRequested;
        ...... // Some code here
        if (!string.IsNullOrWhiteSpace(Global.Settings.Cookie) && !CookieToolkit.IsExpired(Global.Settings.Cookie))
        {
            desktop.MainWindow = Global.PageToolkit.GetMainPage();
        }
        else
        {
            desktop.MainWindow = Global.PageToolkit.GetLoginPage();
        }
    }

    base.OnFrameworkInitializationCompleted();
}

private void Desktop_ShutdownRequested(object sender, ShutdownRequestedEventArgs e)
{
    LogToolkit.Error("Hello World");
}

Expected behavior

LogToolkit.Error("Hello World");

was executed

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: macOS Big Sur
  • Version: 10.999-cibuild0017974-beta

Additional context
Add any other context about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant