InputFileNameDialogViewModel.cs 876 B

1234567891011121314151617181920212223242526272829303132333435
  1. using System.Windows.Input;
  2. using OpenSEMI.ClientBase;
  3. namespace MECF.Framework.UI.Client.CenterViews.Editors
  4. {
  5. public class InputFileNameDialogViewModel : DialogViewModel<string>
  6. {
  7. public InputFileNameDialogViewModel(string dialogName = "")
  8. {
  9. this.DisplayName = dialogName;
  10. }
  11. public string FileName { get; set; }
  12. public void Cancel()
  13. {
  14. IsCancel = true;
  15. TryClose(false);
  16. }
  17. protected override void OnViewLoaded(object view)
  18. {
  19. base.OnViewLoaded(view);
  20. InputFileNameDialogView v = (InputFileNameDialogView)view;
  21. FocusManager.SetFocusedElement(v, v.tbName);
  22. }
  23. public void OK()
  24. {
  25. this.DialogResult = FileName;
  26. IsCancel = false;
  27. TryClose(true);
  28. }
  29. }
  30. }