CalibrationViewModel.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using Prism.Commands;
  2. using Prism.Events;
  3. using Prism.Ioc;
  4. using Prism.Mvvm;
  5. using Prism.Regions;
  6. using Prism.Services.Dialogs;
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using TeamAAS_VP.Events;
  11. namespace TeamAAS_VP.ViewModels
  12. {
  13. public class CalibrationViewModel : BindableBase
  14. {
  15. IRegionManager _regionManager;
  16. IRegionNavigationService _regionNavigationService;
  17. IContainerProvider _container;
  18. IDialogService _dialogService;
  19. IEventAggregator _eventAggregator;
  20. #region 属性
  21. #endregion
  22. #region 命令
  23. private DelegateCommand _LoadedCommand;
  24. public DelegateCommand LoadedCommand =>
  25. _LoadedCommand ?? (_LoadedCommand = new DelegateCommand(ExecuteLoadedCommand));
  26. #endregion
  27. #region 事件
  28. #endregion
  29. public CalibrationViewModel(IRegionManager regionManager, IEventAggregator ea, IRegionNavigationService regionNavigationService, IContainerProvider container, IDialogService dialogService)
  30. {
  31. _regionManager = regionManager;
  32. _regionNavigationService = regionNavigationService;
  33. _container = container;
  34. _dialogService = dialogService;
  35. _eventAggregator = ea;
  36. //订阅权限登录事件
  37. _eventAggregator.GetEvent<UserLoginNotification>().Subscribe(LoginChange);
  38. }
  39. #region 方法
  40. bool isFirstShow = false;
  41. void ExecuteLoadedCommand()
  42. {
  43. if (!isFirstShow)
  44. {
  45. _regionManager.RequestNavigate("CalibrationRegionContext", "CalibrationHome");
  46. isFirstShow = true;
  47. }
  48. }
  49. #endregion
  50. private void LoginChange(Models.User user)
  51. {
  52. }
  53. }
  54. }