VisionSolutionViewModel.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. using Prism.Commands;
  2. using Prism.Ioc;
  3. using Prism.Mvvm;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. using Team.FFFeederService;
  8. using TeamAAS_VP.Core;
  9. using TeamAAS_VP.Interfaces;
  10. namespace TeamAAS_VP.ViewModels.DebugMod
  11. {
  12. public class VisionSolutionViewModel : BindableBase
  13. {
  14. IContainerProvider _container;
  15. ISystemDatabaseService _systemDatabaseService;
  16. private DelegateCommand _LoadedCommand;
  17. public DelegateCommand LoadedCommand =>
  18. _LoadedCommand ?? (_LoadedCommand = new DelegateCommand(ExecuteLoadedCommand));
  19. public VisionSolutionViewModel(IContainerProvider container, ISystemDatabaseService systemDatabaseService)
  20. {
  21. _container = container;
  22. _systemDatabaseService = systemDatabaseService;
  23. }
  24. void ExecuteLoadedCommand()
  25. {
  26. try
  27. {
  28. if (_systemDatabaseService.GetCurrentUser().userPart == Enums.UserPart.Operator)
  29. {
  30. IsAllowEdit = false;
  31. }
  32. else
  33. {
  34. IsAllowEdit = true;
  35. }
  36. }
  37. catch (Exception)
  38. {
  39. }
  40. }
  41. private bool _IsAllowEdit = false;
  42. public bool IsAllowEdit
  43. {
  44. get { return _IsAllowEdit; }
  45. set { SetProperty(ref _IsAllowEdit, value); }
  46. }
  47. private void LoginChange(Models.User user)
  48. {
  49. if (user.userPart == Enums.UserPart.Operator)
  50. {
  51. IsAllowEdit = false;
  52. }
  53. else
  54. {
  55. IsAllowEdit = true;
  56. }
  57. }
  58. }
  59. }