81 lines
2.2 KiB
C#
81 lines
2.2 KiB
C#
using Prism.Services.Dialogs;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Globalization;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows;
|
|
using Telerik.Windows.Controls;
|
|
using Unity;
|
|
using DialogParameters = Prism.Services.Dialogs.DialogParameters;
|
|
|
|
namespace DI_Electrical.ViewModels
|
|
{
|
|
public class DialogInputViewModel : DialogBase, IDialogAware
|
|
{
|
|
|
|
public DialogInputViewModel()
|
|
{
|
|
|
|
}
|
|
|
|
public event Action<IDialogResult> RequestClose;
|
|
|
|
public bool CanCloseDialog()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public void OnDialogClosed()
|
|
{
|
|
|
|
}
|
|
|
|
private string _TextInfo;
|
|
/// <summary>
|
|
/// 文本内容
|
|
/// </summary>
|
|
public string TextInfo
|
|
{
|
|
get { return _TextInfo; }
|
|
set { _TextInfo = value; RaisePropertyChanged(nameof(TextInfo)); }
|
|
}
|
|
private string _TextRemark;
|
|
/// <summary>
|
|
/// 注释
|
|
/// </summary>
|
|
public string TextRemark
|
|
{
|
|
get { return _TextRemark; }
|
|
set { _TextRemark = value; RaisePropertyChanged(nameof(TextRemark)); }
|
|
}
|
|
|
|
string IDialogAware.Title => throw new NotImplementedException();
|
|
|
|
public void OnDialogOpened(IDialogParameters parameters)
|
|
{
|
|
title = parameters.GetValue<string>(GlobalObject.dialogPar.title.ToString());
|
|
TextRemark = parameters.GetValue<string>(GlobalObject.dialogPar.info.ToString());
|
|
}
|
|
public override void ExecuteOKCommandAsync(object para)
|
|
{
|
|
IDialogParameters res = new DialogParameters();
|
|
res.Add(GlobalObject.dialogPar.info.ToString(), $"{TextInfo}");
|
|
DialogResult result = new DialogResult(ButtonResult.Yes, res);
|
|
RequestClose.Invoke(result);
|
|
}
|
|
public override void ExecuteCloseCommand(object parameter)
|
|
{
|
|
IDialogParameters par = new DialogParameters();
|
|
DialogResult result = new DialogResult(ButtonResult.No, par);
|
|
RequestClose.Invoke(result);
|
|
this.Dispose();
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|