InputFileNameDialogViewModel.cs 977 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Input;
  7. using OpenSEMI.ClientBase;
  8. namespace VirgoUI.Client.Models.Recipe
  9. {
  10. public class InputFileNameDialogViewModel : DialogViewModel<string>
  11. {
  12. public InputFileNameDialogViewModel(string dialogName = "")
  13. {
  14. this.DisplayName = dialogName;
  15. }
  16. public string FileName { get; set; }
  17. public void Cancel()
  18. {
  19. IsCancel = true;
  20. TryClose(false);
  21. }
  22. protected override void OnViewLoaded(object view)
  23. {
  24. base.OnViewLoaded(view);
  25. InputFileNameDialogView v = (InputFileNameDialogView)view;
  26. FocusManager.SetFocusedElement(v, v.tbName);
  27. }
  28. public void OK()
  29. {
  30. this.DialogResult = FileName;
  31. IsCancel = false;
  32. TryClose(true);
  33. }
  34. }
  35. }