updated the closing logic of the dialog

This commit is contained in:
NaBian committed 2019-07-06 13:54:39 +08:00
1 parent cb4f5b4907
commit c295bf91c9
4 files changed
+15 -15

No files matched your search

@@ -6,13 +6,12 @@ using GalaSoft.MvvmLight.Command;
using GalaSoft.MvvmLight.CommandWpf;
#endif
using HandyControl.Tools.Extension;
using HandyControlDemo.Data;
namespace HandyControlDemo.ViewModel.Basic
{
public class InteractiveDialogViewModel : ViewModelBase, IDialogResultable<string>
{
public Action<string> CloseAction { get; set; }
public Action CloseAction { get; set; }
private string _result;
@@ -38,6 +37,6 @@ namespace HandyControlDemo.ViewModel.Basic
#endif
}
public RelayCommand CloseCmd => new Lazy<RelayCommand>(() => new RelayCommand(() => CloseAction?.Invoke(MessageToken.MainWindow))).Value;
public RelayCommand CloseCmd => new Lazy<RelayCommand>(() => new RelayCommand(() => CloseAction?.Invoke())).Value;
}
}
@@ -9,6 +9,7 @@ using GalaSoft.MvvmLight.CommandWpf;
#endif
using HandyControl.Controls;
using HandyControl.Tools.Extension;
using HandyControlDemo.Data;
using HandyControlDemo.UserControl;
using HandyControlDemo.ViewModel.Basic;
using HandyControlDemo.Window;
@@ -51,7 +52,7 @@ namespace HandyControlDemo.ViewModel
}
else
{
Dialog.Show<TextDialogWithTimer>().GetResultAsync<string>();
Dialog.Show<TextDialogWithTimer>(MessageToken.MainWindow).GetResultAsync<string>();
}
}
#else
@@ -68,7 +69,7 @@ namespace HandyControlDemo.ViewModel
}
else
{
await Dialog.Show<TextDialogWithTimer>().GetResultAsync<string>();
await Dialog.Show<TextDialogWithTimer>(MessageToken.MainWindow).GetResultAsync<string>();
}
}
#endif