2025-09-04 18:28:02 +08:00
|
|
|
|
using Prism.Services.Dialogs;
|
2025-08-15 16:34:31 +08:00
|
|
|
|
using SWS.CAD.ViewModels.myViewModelBase;
|
2025-09-04 18:28:02 +08:00
|
|
|
|
using SWS.Commons;
|
2025-08-15 16:34:31 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace SWS.CAD.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public class Dialog2SelectViewModel : DialogBase, IDialogAware
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
public Dialog2SelectViewModel()
|
|
|
|
|
{
|
|
|
|
|
title = "选择对话框";
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-04 18:28:02 +08:00
|
|
|
|
public string Title => "";
|
|
|
|
|
|
|
|
|
|
public event Action<IDialogResult> RequestClose;
|
2025-08-15 16:34:31 +08:00
|
|
|
|
|
|
|
|
|
public bool CanCloseDialog()
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnDialogClosed()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void OnDialogOpened(IDialogParameters parameters)
|
|
|
|
|
{
|
|
|
|
|
title = parameters.GetValue<string>(GlobalObject.dialogPar.title.ToString());
|
|
|
|
|
textYes = parameters.GetValue<string>(GlobalObject.dialogPar.textYes.ToString());
|
|
|
|
|
textNo = parameters.GetValue<string>(GlobalObject.dialogPar.textNo.ToString());
|
2025-09-04 18:28:02 +08:00
|
|
|
|
|
2025-08-15 16:34:31 +08:00
|
|
|
|
}
|
|
|
|
|
public override void ExecuteOKCommandAsync(object para)
|
|
|
|
|
{
|
2025-09-04 18:28:02 +08:00
|
|
|
|
DialogResult res = new DialogResult(ButtonResult.Yes);
|
|
|
|
|
RequestClose.Invoke(res);
|
2025-08-15 16:34:31 +08:00
|
|
|
|
}
|
|
|
|
|
public override void ExecuteCloseCommand(object parameter)
|
|
|
|
|
{
|
|
|
|
|
if (parameter as string == "ClickNo")
|
|
|
|
|
{
|
2025-09-04 18:28:02 +08:00
|
|
|
|
DialogResult res = new DialogResult(ButtonResult.No);
|
|
|
|
|
RequestClose.Invoke(res);
|
2025-08-15 16:34:31 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2025-09-04 18:28:02 +08:00
|
|
|
|
DialogResult res = new DialogResult(ButtonResult.Cancel);
|
|
|
|
|
RequestClose.Invoke(res);
|
2025-08-15 16:34:31 +08:00
|
|
|
|
}
|
|
|
|
|
this.Dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region binding
|
|
|
|
|
private string _textYes;
|
|
|
|
|
|
|
|
|
|
public string textYes
|
|
|
|
|
{
|
|
|
|
|
get { return _textYes; }
|
|
|
|
|
set { _textYes = value; RaisePropertyChanged(nameof(textYes)); }
|
|
|
|
|
}
|
|
|
|
|
private string _textNo;
|
|
|
|
|
|
|
|
|
|
public string textNo
|
|
|
|
|
{
|
|
|
|
|
get { return _textNo; }
|
|
|
|
|
set { _textNo = value; RaisePropertyChanged(nameof(textNo)); }
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|