Problem with rewrite the Backgrounding event

Dani_S 3,276 Reputation points
2024-06-18T06:41:00.6+00:00

Hi,

In continue to https://learn.microsoft.com/en-us/answers/questions/1690214/register-close-button-in-mac

All my work in pages stop working.

Working with http + tasks.

it fire the close button event and close the app.

Thanks in advance,

.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,176 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 28,876 Reputation points Microsoft Vendor
    2024-06-19T06:46:53.17+00:00

    Hello,

    From your description, your app can go to background, but all the tasks on the page have been end.

    As I understand, you want to remove the token when the app is going to close, and you have to remove the token in a task.

    If so, please create Background-Safe Tasks, and remove the token in the task. After removing the token, you can refer to the solution in the previous thread to close the app.

    App.Current.Quit();
    

    If you have any other issues, please feel free to let me know.

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.