using System; using System.Collections.Generic; using System.Diagnostics.Eventing.Reader; using System.Globalization; using System.Linq; using System.Text; using System.Windows.Forms; using Aitex.Core.RT.SCCore; using Aitex.Core.UI.ControlDataContext; using Aitex.Core.Utilities; using Application = System.Windows.Application; namespace Aitex.Triton160.UI.ViewModel { class RecipeMonitorViewModel : UIViewModelBase { private string _culture = CultureSupported.English; public ProcessDataChartDataItem ProcessChartData { get; set; } public RecipeMonitorViewModel() : base("RecipeMonitorViewModel") { ProcessChartData = new ProcessDataChartDataItem(60* 60 * 5); //留5个小时的数据 Triton160UiSystem.Instance.CultureChanged += CultureChanged; SCLocal.SetKeys(new List() { SCName.GasLineConfig_Gas1Enable, SCName.GasLineConfig_Gas1Name, SCName.GasLineConfig_Gas2Enable, SCName.GasLineConfig_Gas2Name, SCName.GasLineConfig_Gas3Enable, SCName.GasLineConfig_Gas3Name, SCName.GasLineConfig_Gas4Enable, SCName.GasLineConfig_Gas4Name, SCName.GasLineConfig_Gas5Enable, SCName.GasLineConfig_Gas5Name, SCName.RfConfig_EnablePulsingFunction, SCName.PressureControlConfig_EnableThrottleValve, SCName.PressureControlConfig_PumpEnableN2Pressure, SCName.PressureControlConfig_PumpEnableWaterFlow, }); } private void CultureChanged(string s) { _culture = s; } protected override void Poll() { List keys = new List(); Application.Current.Dispatcher.Invoke(new Action(() => { Dictionary> dicItems = GetDataElements(_culture); keys = dicItems.Keys.ToList(); ProcessChartData.UpdateColumns(dicItems); })); var result = Triton160UiSystem.Instance.WCF.Query.PollData(keys); Application.Current.Dispatcher.Invoke(new Action(() => { ProcessChartData.AppendData(result); })); } } }