using Prism.Commands; using Prism.Mvvm; using Prism.Services.Dialogs; using System; using System.Collections.Generic; using System.ComponentModel; using System.DirectoryServices.Protocols; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Interop; namespace DM_Weight.ViewModels { internal class ConfirmMessageDialogViewModel :BindableBase, IDialogAware { public string Title => "确认"; private string _msg; public string Msg { get => _msg; set { SetProperty(ref _msg, value); } } public event Action RequestClose; public bool CanCloseDialog() { return true; } public void OnDialogClosed() { } public void OnDialogOpened(IDialogParameters parameters) { if (parameters.ContainsKey("msgInfo")) { List strPara = parameters.GetValue>("msgInfo"); Msg = strPara[0]; } } public DelegateCommand NoCommand { get => new DelegateCommand(NoAction);} public DelegateCommand YesCommand { get => new DelegateCommand(YesAction); } private void NoAction() { RequestClose?.Invoke(new DialogResult(ButtonResult.No)); } private void YesAction() { RequestClose?.Invoke(new DialogResult(ButtonResult.Yes)); } } }