using MECF.Framework.Common.DataCenter; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Threading; namespace Venus_MainPages.ViewModels { public class GetRtAllData { private List m_RtConfigKeys; private List m_RtDataKeys; public static Dictionary RtConfigValues; public static Dictionary RtDataValues; private string ModuleName = "PMA"; DispatcherTimer timer = new DispatcherTimer(); public GetRtAllData() { m_RtConfigKeys = new List(); m_RtDataKeys = new List(); addConfigKeys(); addDataKeys(); timer.Interval = TimeSpan.FromSeconds(1); timer.Tick += timer_Tick; timer.Start(); } void timer_Tick(object sender, EventArgs e) { RtConfigValues = QueryDataClient.Instance.Service.PollConfig(m_RtConfigKeys); var t = RtConfigValues.Values.Count; RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys); } private void addConfigKeys() { m_RtConfigKeys.Add($"{ModuleName}.MfcGas1.GasName"); m_RtConfigKeys.Add($"{ModuleName}.MfcGas2.GasName"); m_RtConfigKeys.Add($"{ModuleName}.MfcGas3.GasName"); m_RtConfigKeys.Add($"{ModuleName}.MfcGas4.GasName"); m_RtConfigKeys.Add($"{ModuleName}.MfcGas5.GasName"); m_RtConfigKeys.Add($"{ModuleName}.MfcGas6.GasName"); m_RtConfigKeys.Add($"{ModuleName}.MfcGas7.GasName"); m_RtConfigKeys.Add($"{ModuleName}.MfcGas8.GasName"); } private void addDataKeys() { m_RtDataKeys.Add($"{ModuleName}.FsmState"); m_RtDataKeys.Add($"{ModuleName}.MfcGas1.FeedBack"); m_RtDataKeys.Add($"{ModuleName}.MfcGas2.FeedBack"); m_RtDataKeys.Add($"{ModuleName}.MfcGas3.FeedBack"); m_RtDataKeys.Add($"{ModuleName}.MfcGas4.FeedBack"); m_RtDataKeys.Add($"{ModuleName}.MfcGas5.FeedBack"); m_RtDataKeys.Add($"{ModuleName}.MfcGas6.FeedBack"); m_RtDataKeys.Add($"{ModuleName}.MfcGas7.FeedBack"); m_RtDataKeys.Add($"{ModuleName}.MfcGas8.FeedBack"); } } }