Hello,
Firstly, please enable multi-window support on iPadOS and Mac Catalyst by iPadOS and macOS configuration.
Then open App.xaml.cs
create a window and rewrite the Backgrounding event. After getting value of res, your application will be closed in the background.
// in the App class
protected override Window CreateWindow(IActivationState? activationState)
{
Window window = base.CreateWindow(activationState);
window.Backgrounding += Window_Backgrounding;
return window;
}
private async void Window_Backgrounding(object? sender, BackgroundingEventArgs e)
{
try
{
if (!string.IsNullOrEmpty(LoginConfigurations.GetInstance().SessionToken) )
{
var container = new Bootstrapper().Bootstrap();
IAutomationApiClient automationApiClient = container.Resolve<IAutomationApiClient>();
var res = await automationApiClient.PostLogOut($"{LoginConfigurations.GetInstance().Portal}/api/GSPortal/PostLogOut/false", LoginConfigurations.GetInstance().SessionToken).ContinueWith(t => {
// if you get the result. then your application will be quit.
App.Current.Quit();
});
}
}
catch (Exception)
{
}
}
Best Regards,
Leon Lu
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.