Some more cleanup.
This commit is contained in:
@@ -3,6 +3,7 @@ using Microsoft.UI.Windowing;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Wino.Core.Domain.Interfaces;
|
||||
using Wino.Mail.WinUI.Helpers;
|
||||
using Wino.Mail.WinUI.Interfaces;
|
||||
using WinUIEx;
|
||||
|
||||
@@ -11,6 +12,7 @@ namespace Wino.Mail.WinUI;
|
||||
public sealed partial class WelcomeWindow : WindowEx
|
||||
{
|
||||
private bool _allowClose;
|
||||
private bool _isPreparedForClose;
|
||||
|
||||
public Frame GetRootFrame() => RootFrame;
|
||||
|
||||
@@ -25,6 +27,7 @@ public sealed partial class WelcomeWindow : WindowEx
|
||||
|
||||
ConfigureWindowChrome();
|
||||
AppWindow.Closing += OnAppWindowClosing;
|
||||
Closed += OnWindowClosed;
|
||||
}
|
||||
|
||||
private void ConfigureWindowChrome()
|
||||
@@ -55,4 +58,20 @@ public sealed partial class WelcomeWindow : WindowEx
|
||||
{
|
||||
_allowClose = true;
|
||||
}
|
||||
|
||||
public void PrepareForClose()
|
||||
{
|
||||
if (_isPreparedForClose)
|
||||
return;
|
||||
|
||||
_isPreparedForClose = true;
|
||||
WindowCleanupHelper.CleanupFrame(RootFrame);
|
||||
}
|
||||
|
||||
private void OnWindowClosed(object sender, WindowEventArgs e)
|
||||
{
|
||||
Closed -= OnWindowClosed;
|
||||
AppWindow.Closing -= OnAppWindowClosing;
|
||||
PrepareForClose();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user