12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 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();
- }
- protected override CreateParams CreateParams
- {
- get
- {
- CreateParams paras = base.CreateParams;
- paras.ExStyle |= 0x02000000;
- return paras;
- }
- }
- 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";
- }
- }
- }
- }
- }
- }
|