using System; using System.Windows.Input; using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.CommandWpf; using HandyControl.Controls; using HandyControl.Tools.Extension; using HandyControlDemo.Properties.Langs; using HandyControlDemo.UserControl; using HandyControlDemo.UserControl.Basic; using HandyControlDemo.ViewModel.Basic; namespace HandyControlDemo.ViewModel { public class DialogDemoViewModel : ViewModelBase { private string _dialogResult; public RelayCommand ShowTextCmd => new Lazy(() => new RelayCommand(ShowText)).Value; public string DialogResult { get => _dialogResult; set => Set(ref _dialogResult, value); } public ICommand ShowInteractiveDialogCmd { get; } public DialogDemoViewModel() { DialogResult = Lang.PleaseInput; ShowInteractiveDialogCmd = new RelayCommand(async message => { DialogResult = await Dialog.Show() .Initialize(vm => vm.Message = message) .GetResultAsync(); }); } private void ShowText() { Dialog.Show(new TextDialog()); } } }