ShowCalibrationResultViewModel.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. using MathNet.Numerics.LinearAlgebra;
  2. using Prism.Commands;
  3. using Prism.Events;
  4. using Prism.Ioc;
  5. using Prism.Mvvm;
  6. using Prism.Regions;
  7. using Prism.Services.Dialogs;
  8. using System;
  9. using System.Collections.Generic;
  10. using System.Linq;
  11. using System.Security.Cryptography;
  12. using System.Threading.Tasks;
  13. using System.Windows;
  14. using Team.FFFeederService.Interfaces;
  15. using TeamAAS_VP.Events;
  16. using TeamAAS_VP.Core;
  17. using TeamAAS_VP.Interfaces;
  18. using TeamAAS_VP.Models;
  19. namespace TeamAAS_VP.ViewModels.Calibration
  20. {
  21. public class ShowCalibrationResultViewModel : BindableBase, IDialogAware
  22. {
  23. IRegionManager _regionManager;
  24. IRegionNavigationService _regionNavigationService;
  25. IContainerProvider _container;
  26. IDialogService _dialogService;
  27. IEventAggregator _eventAggregator;
  28. #region 属性
  29. public string Title => "校准结果";
  30. private CalibrationResult _Result;
  31. public CalibrationResult Result
  32. {
  33. get { return _Result; }
  34. set { SetProperty(ref _Result,value); }
  35. }
  36. #endregion
  37. #region 命令
  38. private DelegateCommand _ConfirmCommand;
  39. public DelegateCommand ConfirmCommand =>
  40. _ConfirmCommand ?? (_ConfirmCommand = new DelegateCommand(ExecuteConfirmCommand));
  41. #endregion
  42. #region 事件
  43. public event Action<IDialogResult> RequestClose;
  44. #endregion
  45. public ShowCalibrationResultViewModel(IRegionManager regionManager, IEventAggregator ea, IRegionNavigationService regionNavigationService, IContainerProvider container, IDialogService dialogService)
  46. {
  47. _regionManager = regionManager;
  48. _regionNavigationService = regionNavigationService;
  49. _container = container;
  50. _dialogService = dialogService;
  51. _eventAggregator = ea;
  52. }
  53. #region 方法
  54. /// <summary>
  55. /// 确定
  56. /// </summary>
  57. void ExecuteConfirmCommand()
  58. {
  59. RequestClose?.Invoke(new DialogResult(ButtonResult.OK, null));
  60. }
  61. public bool CanCloseDialog()
  62. {
  63. return true;
  64. }
  65. public void OnDialogClosed()
  66. {
  67. }
  68. public void OnDialogOpened(IDialogParameters parameters)
  69. {
  70. Result = parameters.GetValue<CalibrationResult>("Result");
  71. }
  72. #endregion
  73. }
  74. }