67 lines
1.7 KiB
C#
67 lines
1.7 KiB
C#
using DM_Weight.Models;
|
|
using Prism.Commands;
|
|
using Prism.Mvvm;
|
|
using Prism.Regions;
|
|
using Prism.Services.Dialogs;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DM_Weight.ViewModels
|
|
{
|
|
public class ConfirmDialogViewModel : BindableBase, IDialogAware, IRegionMemberLifetime
|
|
{
|
|
private string _title = "保存确认";
|
|
|
|
public string Title
|
|
{
|
|
get => _title;
|
|
set => SetProperty(ref _title, value);
|
|
}
|
|
|
|
private string _confirmInfo= "所选药品存在待取药或待入库数据是否确认保存?";
|
|
public string ConfirmInfo
|
|
{
|
|
get => _confirmInfo;
|
|
set => SetProperty(ref _confirmInfo, value);
|
|
}
|
|
|
|
public bool KeepAlive => false;
|
|
|
|
public event Action<IDialogResult> RequestClose;
|
|
|
|
public bool CanCloseDialog()
|
|
{
|
|
return true;
|
|
}
|
|
|
|
public void OnDialogClosed()
|
|
{
|
|
}
|
|
|
|
public void OnDialogOpened(IDialogParameters parameters)
|
|
{
|
|
|
|
ConfirmInfo = parameters.GetValue<string>("ConfirmInfo");
|
|
}
|
|
public DelegateCommand CancelCommand
|
|
{
|
|
get => new DelegateCommand(() =>
|
|
{
|
|
// 关闭当前窗口
|
|
RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
|
|
});
|
|
}
|
|
public DelegateCommand ConfirmCommand
|
|
{
|
|
get => new DelegateCommand(() =>
|
|
{
|
|
//确认
|
|
RequestClose?.Invoke(new DialogResult(ButtonResult.OK));
|
|
});
|
|
}
|
|
}
|
|
}
|