1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- 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<string>()
- {
- 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<string> keys = new List<string>();
- Application.Current.Dispatcher.Invoke(new Action(() =>
- {
- Dictionary<string, Tuple<string, string, bool>> 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);
- }));
- }
- }
- }
|