EventViewModel.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Aitex.Core.RT.Event;
  6. using Aitex.Core.UI.MVVM;
  7. using Aitex.Core.UI.View.Common;
  8. using Aitex.Triton160.Common;
  9. using Aitex.Triton160.UI;
  10. using Aitex.Triton160.UI.ViewModel;
  11. namespace Triton160.UI.ViewModel
  12. {
  13. class JetEventViewModel : UIViewModelBase
  14. {
  15. string AlarmEventParam = ModuleNameString.System + "." + StateData.AlarmEvent.ToString();
  16. public MonitorViewModel MonitorVM { get; set; }
  17. public EventViewModel EventVM { get; set; }
  18. public JetEventViewModel()
  19. : base("JetEventViewModel")
  20. {
  21. MonitorVM = new MonitorViewModel();
  22. EventVM = new EventViewModel();
  23. Subscribe(AlarmEventParam);
  24. EventVM.QueryDBEventFunc = (sql) => Triton160UiSystem.Instance.WCF.Query.QueryDBEvent(sql);
  25. EventVM.QueryEventList = () =>
  26. {
  27. List<string> result = new List<string>();
  28. foreach (var eventName in Enum.GetNames(typeof(EventEnum)))
  29. result.Add(eventName);
  30. return result;
  31. };
  32. }
  33. protected override void InvokeBeforeUpdateProperty(Dictionary<string, object> data)
  34. {
  35. if (data.ContainsKey(AlarmEventParam))
  36. MonitorVM.UpdateAlarmEvent((List<EventItem>)data[AlarmEventParam]);
  37. }
  38. }
  39. }