2023-11-22 21:02:42 +08:00
|
|
|
|
using CPF.Controls;
|
|
|
|
|
using System;
|
2023-11-22 17:30:26 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace CPF.Toolkit.Demo
|
|
|
|
|
{
|
|
|
|
|
internal class MainViewModel : ViewModelBase
|
|
|
|
|
{
|
2023-11-22 21:02:42 +08:00
|
|
|
|
bool isClose = false;
|
|
|
|
|
public void Test()
|
|
|
|
|
{
|
|
|
|
|
if (this.Dialog.Ask("确定要关闭吗") == "确定")
|
|
|
|
|
{
|
|
|
|
|
this.isClose = true;
|
|
|
|
|
this.Close();
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-11-22 17:30:26 +08:00
|
|
|
|
|
2023-11-22 21:02:42 +08:00
|
|
|
|
protected override void OnClose(ClosingEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
e.Cancel = !this.isClose;
|
|
|
|
|
base.OnClose(e);
|
|
|
|
|
}
|
2023-11-22 17:30:26 +08:00
|
|
|
|
}
|
|
|
|
|
}
|