VisionSolutionViewModel.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. namespace TeamAAS_VP.ViewModels.DebugMod
  10. {
  11. public class VisionSolutionViewModel : BindableBase
  12. {
  13. IContainerProvider _container;
  14. private DelegateCommand _LoadedCommand;
  15. public DelegateCommand LoadedCommand =>
  16. _LoadedCommand ?? (_LoadedCommand = new DelegateCommand(ExecuteLoadedCommand));
  17. public VisionSolutionViewModel(IContainerProvider container)
  18. {
  19. _container = container;
  20. }
  21. void ExecuteLoadedCommand()
  22. {
  23. try
  24. {
  25. if (_container.Resolve<Management>().CurrentUser.userPart == Enums.UserPart.Operator)
  26. {
  27. IsAllowEdit = false;
  28. }
  29. else
  30. {
  31. IsAllowEdit = true;
  32. }
  33. }
  34. catch (Exception)
  35. {
  36. }
  37. }
  38. private bool _IsAllowEdit = false;
  39. public bool IsAllowEdit
  40. {
  41. get { return _IsAllowEdit; }
  42. set { SetProperty(ref _IsAllowEdit, value); }
  43. }
  44. private void LoginChange(Models.User user)
  45. {
  46. if (user.userPart == Enums.UserPart.Operator)
  47. {
  48. IsAllowEdit = false;
  49. }
  50. else
  51. {
  52. IsAllowEdit = true;
  53. }
  54. }
  55. }
  56. }