51 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C#
		
	
	
	
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 WarnDialogViewModel:BindableBase, IDialogAware, IRegionMemberLifetime
 | 
						|
    {
 | 
						|
        private string _warnMessage;
 | 
						|
        public string WarnMessage
 | 
						|
        {
 | 
						|
            get => _warnMessage;
 | 
						|
            set => SetProperty(ref _warnMessage, value);
 | 
						|
        }
 | 
						|
 | 
						|
        public string Title => "警告";
 | 
						|
 | 
						|
        public bool KeepAlive => false;
 | 
						|
 | 
						|
        public event Action<IDialogResult> RequestClose;
 | 
						|
 | 
						|
        public bool CanCloseDialog()
 | 
						|
        {
 | 
						|
            return true;
 | 
						|
        }
 | 
						|
 | 
						|
        public void OnDialogClosed()
 | 
						|
        {
 | 
						|
        }
 | 
						|
 | 
						|
        public void OnDialogOpened(IDialogParameters parameters)
 | 
						|
        {
 | 
						|
            WarnMessage=parameters.GetValue<string>("warnMessage");
 | 
						|
 | 
						|
        }
 | 
						|
        public DelegateCommand CancleTake
 | 
						|
        {
 | 
						|
            get => new DelegateCommand(() =>
 | 
						|
            {
 | 
						|
                RequestClose?.Invoke(new DialogResult(ButtonResult.Cancel));
 | 
						|
            });
 | 
						|
        }
 | 
						|
    }
 | 
						|
}
 |