Some fixes

This commit is contained in:
2026-08-13 12:39:03 +02:00
parent 027fc683ef
commit ab46a16726
11 changed files with 373 additions and 14 deletions
+28
View File
@@ -1,4 +1,6 @@
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using System;
using System.IO;
@@ -14,6 +16,8 @@ namespace AmiReel_WinUI;
/// </summary>
public sealed partial class MainWindow : Window
{
private bool _exitConfirmed;
public MainWindow()
{
InitializeComponent();
@@ -27,5 +31,29 @@ public sealed partial class MainWindow : Window
// Navigate the root frame to the main page on startup.
RootFrame.Navigate(typeof(MainPage));
AppWindow.Closing += AppWindow_Closing;
}
private async void AppWindow_Closing(AppWindow sender, AppWindowClosingEventArgs args)
{
if (_exitConfirmed) return;
args.Cancel = true;
ContentDialog dialog = new()
{
Title = "Exit AmiReel?",
Content = "Are you sure you want to close the application?",
PrimaryButtonText = "Exit",
CloseButtonText = "Cancel",
DefaultButton = ContentDialogButton.Close,
XamlRoot = RootFrame.XamlRoot
};
ContentDialogResult result = await dialog.ShowAsync();
if (result != ContentDialogResult.Primary) return;
_exitConfirmed = true;
Close();
}
}