Files
DevToolsAvalonia/常用工具集/Views/MainWindow.axaml.cs
2025-08-26 08:37:44 +08:00

39 lines
1.1 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using Avalonia.Controls;
using System;
using System.Threading.Tasks;
using Ursa.Controls;
namespace .Views
{
public partial class MainWindow : UrsaWindow
{
public MainWindow()
{
InitializeComponent();
}
protected override async Task<bool> CanClose()
{
var result = await MessageBox.ShowOverlayAsync("Are you sure you want to exit?\n您确定要退出吗", "Exit", button: MessageBoxButton.YesNo);
if (result != MessageBoxResult.Yes)
{
return false;
}
Environment.Exit(0);
return true;
}
//private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
//{
// //MessageBoxResult result = MessageBox.Show("确定退出程序?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Warning, MessageBoxResult.No);
// //if (result == MessageBoxResult.No)
// //{
// // e.Cancel = true;
// //}
// //else
// //{
// Environment.Exit(0);
// //}
//}
}
}