1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- using HZY.Framework.DependencyInjection;
- using Sunny.UI;
- namespace Scada.Page
- {
- public partial class PageEquipmentMonitor3 : UIPage, ISingletonSelfDependency
- {
- private List<Control> controls;
- public PageEquipmentMonitor3()
- {
- InitializeComponent();
- controls = Globals.GetAllControls(this);
- this.timer1.Interval = 500;
- this.timer1.Tick += Timer1_Tick;
- this.timer1.Start();
- }
- private void Timer1_Tick(object? sender, EventArgs e)
- {
- if (Globals.SiemensClient.Connected)
- {
- //遍历所有控件
- foreach (Control control in controls)
- {
- if (control is UserDeviceState userDeviceState)
- {
- userDeviceState.State = Globals.DataDic[userDeviceState.VariableName].ToString() == "1";
- }
- else if (control is UserVarCurrentValue userCurrentValue)
- {
- userCurrentValue.VarValue = float.Parse(Globals.DataDic[userCurrentValue.VariableName].ToString());
- }
- else if (control is UserAlarmState userAlarmState)
- {
- userAlarmState.State = Globals.DataDic[userAlarmState.VariableName].ToString() != "1";
- }
- }
- }
- }
- }
- }
|