FSM.xaml.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System.Collections.Generic;
  2. using System.Windows.Controls;
  3. using Aitex.Core.RT.DataCenter;
  4. using Aitex.Core.UI.MVVM;
  5. using Aitex.Core.Util;
  6. namespace VirgoRT.Backends
  7. {
  8. /// <summary>
  9. /// Interaction logic for FSM.xaml
  10. /// </summary>
  11. public partial class FSMView : UserControl
  12. {
  13. public FSMView()
  14. {
  15. InitializeComponent();
  16. this.DataContext = new FsmViewModel();
  17. this.IsVisibleChanged += FSM_IsVisibleChanged;
  18. }
  19. private void FSM_IsVisibleChanged(object sender, System.Windows.DependencyPropertyChangedEventArgs e)
  20. {
  21. if (this.DataContext is FsmViewModel vm)
  22. {
  23. vm.EnableTimer(this.IsVisible);
  24. }
  25. }
  26. }
  27. public class FsmViewModel : SubscriptionViewModelBase
  28. {
  29. [Subscription("EFEM.FsmPrevState")]
  30. public string EFEMPrevState { get; set; }
  31. [Subscription("EFEM.FsmState")]
  32. public string EFEMState { get; set; }
  33. [Subscription("EFEM.FsmLastMessage")]
  34. public string EFEMLastMsg { get; set; }
  35. //LP1
  36. [Subscription("LP1.FsmPrevState")]
  37. public string LP1PrevState { get; set; }
  38. [Subscription("LP1.FsmState")]
  39. public string LP1State { get; set; }
  40. [Subscription("LP1.FsmLastMessage")]
  41. public string LP1LastMsg { get; set; }
  42. //LP1
  43. [Subscription("LP2.FsmPrevState")]
  44. public string LP2PrevState { get; set; }
  45. [Subscription("LP2.FsmState")]
  46. public string LP2State { get; set; }
  47. [Subscription("LP2.FsmLastMessage")]
  48. public string LP2LastMsg { get; set; }
  49. // PMA
  50. [Subscription("PMA.FsmPrevState")]
  51. public string PMAPrevState { get; set; }
  52. [Subscription("PMA.FsmState")]
  53. public string PMAState { get; set; }
  54. [Subscription("PMA.FsmLastMessage")]
  55. public string PMALastMsg { get; set; }
  56. // PMB
  57. [Subscription("PMB.FsmPrevState")]
  58. public string PMBPrevState { get; set; }
  59. [Subscription("PMB.FsmState")]
  60. public string PMBState { get; set; }
  61. [Subscription("PMB.FsmLastMessage")]
  62. public string PMBLastMsg { get; set; }
  63. // Constructor
  64. //
  65. public FsmViewModel() : base(nameof(FsmViewModel))
  66. {
  67. PollDataFunction = PerformPollDataFunction;
  68. }
  69. private Dictionary<string, object> PerformPollDataFunction(IEnumerable<string> arg)
  70. {
  71. return DATA.PollData(arg);
  72. }
  73. }
  74. }