ProcessViewModel.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using Aitex.Core.UI.MVVM;
  2. using Prism.Mvvm;
  3. using Prism.Commands;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using Microsoft.Win32;
  10. namespace Venus_MainPages.ViewModels
  11. {
  12. public class ProcessViewModel : BindableBase
  13. {
  14. #region 私有字段
  15. private string m_SelectedRecipe;
  16. #endregion
  17. #region 属性
  18. public string SelectedRecipe
  19. {
  20. get { return m_SelectedRecipe; }
  21. set { SetProperty(ref m_SelectedRecipe, value); }
  22. }
  23. #endregion
  24. #region 命令
  25. private DelegateCommand _LoadRecipeCommand;
  26. public DelegateCommand LoadRecipeCommand =>
  27. _LoadRecipeCommand ?? (_LoadRecipeCommand = new DelegateCommand(OnLoadRecipe));
  28. #endregion
  29. #region 命令方法
  30. private void OnLoadRecipe()
  31. {
  32. OpenFileDialog dialog = new OpenFileDialog();
  33. dialog.Filter = ".rcp|*.rcp";
  34. dialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
  35. if (dialog.ShowDialog() == false) return;
  36. SelectedRecipe = dialog.SafeFileName.Split('.')[0];
  37. }
  38. #endregion
  39. }
  40. }