78 lines
1.9 KiB
C#
78 lines
1.9 KiB
C#
![]() |
using Prism.Dialogs;
|
|||
|
using SWS.CAD.Models;
|
|||
|
using SWS.CAD.Services;
|
|||
|
using SWS.CAD.ViewModels.myViewModelBase;
|
|||
|
using SWS.CAD.Views;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Collections.ObjectModel;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Unity;
|
|||
|
|
|||
|
namespace SWS.CAD.ViewModels
|
|||
|
{
|
|||
|
public class Dialog2SelectViewModel : DialogBase, IDialogAware
|
|||
|
{
|
|||
|
|
|||
|
public Dialog2SelectViewModel()
|
|||
|
{
|
|||
|
title = "选择对话框";
|
|||
|
}
|
|||
|
|
|||
|
public DialogCloseListener RequestClose { get; }
|
|||
|
|
|||
|
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());
|
|||
|
|
|||
|
}
|
|||
|
public override void ExecuteOKCommandAsync(object para)
|
|||
|
{
|
|||
|
RequestClose.Invoke(ButtonResult.Yes);
|
|||
|
}
|
|||
|
public override void ExecuteCloseCommand(object parameter)
|
|||
|
{
|
|||
|
if (parameter as string == "ClickNo")
|
|||
|
{
|
|||
|
RequestClose.Invoke(ButtonResult.No);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
RequestClose.Invoke(ButtonResult.Cancel);
|
|||
|
}
|
|||
|
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
|
|||
|
}
|
|||
|
}
|