GetRtAllData.cs 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using MECF.Framework.Common.DataCenter;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows.Threading;
  8. namespace Venus_MainPages.ViewModels
  9. {
  10. public class GetRtAllData
  11. {
  12. private List<string> m_RtConfigKeys;
  13. private List<string> m_RtDataKeys;
  14. public static Dictionary<string, object> RtConfigValues;
  15. public static Dictionary<string, object> RtDataValues;
  16. private string ModuleName = "PMA";
  17. DispatcherTimer timer = new DispatcherTimer();
  18. public GetRtAllData()
  19. {
  20. m_RtConfigKeys = new List<string>();
  21. m_RtDataKeys = new List<string>();
  22. addConfigKeys();
  23. addDataKeys();
  24. timer.Interval = TimeSpan.FromSeconds(1);
  25. timer.Tick += timer_Tick;
  26. timer.Start();
  27. }
  28. void timer_Tick(object sender, EventArgs e)
  29. {
  30. RtConfigValues = QueryDataClient.Instance.Service.PollConfig(m_RtConfigKeys);
  31. var t = RtConfigValues.Values.Count;
  32. RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);
  33. }
  34. private void addConfigKeys()
  35. {
  36. m_RtConfigKeys.Add($"{ModuleName}.MfcGas1.GasName");
  37. m_RtConfigKeys.Add($"{ModuleName}.MfcGas2.GasName");
  38. m_RtConfigKeys.Add($"{ModuleName}.MfcGas3.GasName");
  39. m_RtConfigKeys.Add($"{ModuleName}.MfcGas4.GasName");
  40. m_RtConfigKeys.Add($"{ModuleName}.MfcGas5.GasName");
  41. m_RtConfigKeys.Add($"{ModuleName}.MfcGas6.GasName");
  42. m_RtConfigKeys.Add($"{ModuleName}.MfcGas7.GasName");
  43. m_RtConfigKeys.Add($"{ModuleName}.MfcGas8.GasName");
  44. }
  45. private void addDataKeys()
  46. {
  47. m_RtDataKeys.Add($"{ModuleName}.FsmState");
  48. m_RtDataKeys.Add($"{ModuleName}.MfcGas1.FeedBack");
  49. m_RtDataKeys.Add($"{ModuleName}.MfcGas2.FeedBack");
  50. m_RtDataKeys.Add($"{ModuleName}.MfcGas3.FeedBack");
  51. m_RtDataKeys.Add($"{ModuleName}.MfcGas4.FeedBack");
  52. m_RtDataKeys.Add($"{ModuleName}.MfcGas5.FeedBack");
  53. m_RtDataKeys.Add($"{ModuleName}.MfcGas6.FeedBack");
  54. m_RtDataKeys.Add($"{ModuleName}.MfcGas7.FeedBack");
  55. m_RtDataKeys.Add($"{ModuleName}.MfcGas8.FeedBack");
  56. }
  57. }
  58. }