ShowCalibrationResultViewModel.cs 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. using TeamAAS_VP.Models.Calibration;
  20. namespace TeamAAS_VP.ViewModels.Calibration
  21. {
  22. public class ShowCalibrationResultViewModel : BindableBase, IDialogAware
  23. {
  24. IRegionManager _regionManager;
  25. IRegionNavigationService _regionNavigationService;
  26. IContainerProvider _container;
  27. IDialogService _dialogService;
  28. IEventAggregator _eventAggregator;
  29. #region 属性
  30. public string Title => "校准结果";
  31. private CalibrationResult _Result;
  32. public CalibrationResult Result
  33. {
  34. get { return _Result; }
  35. set { SetProperty(ref _Result,value); }
  36. }
  37. #endregion
  38. #region 命令
  39. private DelegateCommand _ConfirmCommand;
  40. public DelegateCommand ConfirmCommand =>
  41. _ConfirmCommand ?? (_ConfirmCommand = new DelegateCommand(ExecuteConfirmCommand));
  42. #endregion
  43. #region 事件
  44. public event Action<IDialogResult> RequestClose;
  45. #endregion
  46. public ShowCalibrationResultViewModel(IRegionManager regionManager, IEventAggregator ea, IRegionNavigationService regionNavigationService, IContainerProvider container, IDialogService dialogService)
  47. {
  48. _regionManager = regionManager;
  49. _regionNavigationService = regionNavigationService;
  50. _container = container;
  51. _dialogService = dialogService;
  52. _eventAggregator = ea;
  53. }
  54. #region 方法
  55. /// <summary>
  56. /// 确定
  57. /// </summary>
  58. void ExecuteConfirmCommand()
  59. {
  60. RequestClose?.Invoke(new DialogResult(ButtonResult.OK, null));
  61. }
  62. public bool CanCloseDialog()
  63. {
  64. return true;
  65. }
  66. public void OnDialogClosed()
  67. {
  68. }
  69. public void OnDialogOpened(IDialogParameters parameters)
  70. {
  71. Result = parameters.GetValue<CalibrationResult>("Result");
  72. }
  73. #endregion
  74. }
  75. }