ShowCalibrationResultViewModel.cs 2.5 KB

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