78 lines
2.1 KiB
C#
78 lines
2.1 KiB
C#
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Input;
|
|
using Prism.Services.Dialogs;
|
|
using SWS.Commons;
|
|
using Telerik.Windows.Controls;
|
|
using DialogParameters = Prism.Services.Dialogs.DialogParameters;
|
|
|
|
namespace SWS.WPF.ViewModels
|
|
{
|
|
public class DialogTestViewModel : DialogBase, IDialogAware
|
|
{
|
|
private string _parText;
|
|
/// <summary>
|
|
/// 参数值
|
|
/// </summary>
|
|
public string parText
|
|
{
|
|
get { return _parText; }
|
|
set { _parText = value; OnPropertyChanged(nameof(parText)); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 命令事件
|
|
/// </summary>
|
|
public ICommand Command_Close1 { get; set; }
|
|
/// <summary>
|
|
/// 命令事件
|
|
/// </summary>
|
|
public ICommand Command_Close2 { get; set; }
|
|
|
|
public DialogTestViewModel()
|
|
{
|
|
Command_Close1 = new DelegateCommand(onClose1);
|
|
Command_Close2 = new DelegateCommand(onClose2);
|
|
title = "弹框测试页面";
|
|
|
|
|
|
}
|
|
|
|
|
|
public string Title => "弹框测试页面";
|
|
|
|
public event Action<IDialogResult> RequestClose;
|
|
|
|
public bool CanCloseDialog()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public void OnDialogClosed()
|
|
{
|
|
|
|
}
|
|
|
|
public void OnDialogOpened(IDialogParameters parameters)
|
|
{
|
|
parText = parameters.GetValue<string>(GlobalObject.dialogPar.para1.ToString());
|
|
}
|
|
|
|
public void onClose1(object o)
|
|
{
|
|
IDialogParameters par = new DialogParameters();
|
|
par.Add(GlobalObject.dialogPar.para1.ToString(), "xxx");
|
|
DialogResult result = new DialogResult(ButtonResult.Yes, par);
|
|
RequestClose.Invoke(result);
|
|
}
|
|
public void onClose2(object o)
|
|
{
|
|
IDialogParameters par = new DialogParameters();
|
|
par.Add(GlobalObject.dialogPar.para1.ToString(), "zzz");
|
|
DialogResult result = new DialogResult(ButtonResult.No, par);
|
|
RequestClose.Invoke(result);
|
|
}
|
|
}
|
|
}
|