update pr/58

This commit is contained in:
NaBian committed 2019-04-03 22:07:17 +08:00
1 parent e9329ef982
commit ce93f34467
8 files changed
+65 -112

No files matched your search

@@ -1,36 +1,30 @@
using System;
using System.Windows.Input;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.CommandWpf;
using HandyControl.Tools.Extension;
namespace HandyControlDemo.ViewModel.Basic
{
public class InteractiveDialogViewModel : ViewModelBase, IDialogResultable
public class InteractiveDialogViewModel : ViewModelBase, IDialogResultable<string>
{
public Action CloseAction { get; set; }
private string _result;
public string Result
{
get => _result;
set => Set(ref _result, value);
}
private string _message;
public object Result { get; set; }
public Action ClosureToken { get; set; }
public ICommand CloseCommand { get; }
public string Message
{
get => _message;
set => Set(ref _message, value);
}
public InteractiveDialogViewModel()
{
CloseCommand = new RelayCommand<string>(result =>
{
Result = result;
ClosureToken();
});
}
public RelayCommand CloseCmd => new Lazy<RelayCommand>(() => new RelayCommand(() => CloseAction?.Invoke())).Value;
}
}