39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
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);
|
||
// //}
|
||
//}
|
||
}
|
||
} |