123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Aitex.Core.RT.Device;
- using Aitex.Core.RT.Device.Unit;
- using Aitex.Core.RT.IOCore;
- using Aitex.Core.Util;
- namespace Aitex.Core.Backend
- {
- public partial class PumpView : UserControl
- {
- PeriodicJob _thread;
- private IoPump _pump;
- public PumpView()
- {
- InitializeComponent();
- this.Load +=PumpView_Load;
- }
- private void PumpView_Load(object sender, EventArgs e)
- {
- if (_thread == null)
- _thread = new PeriodicJob(500, OnTimer, "Pump View Update", false, true);
- VisibleChanged += (sender1, e1) =>
- {
- if (Visible)
- _thread.Start();
- else
- _thread.Pause();
- };
- _pump = DEVICE.GetDevice<IoPump>("MainPump");
- }
- bool OnTimer()
- {
- if (_pump == null)
- return true;
- Invoke(new Action(() =>
- {
- txtWaterFlow.Text = _pump.WaterFlowValue.ToString("F1");
- txtWaterWarning.Text = _pump.H2OSensorMassWarningThreshold.ToString("F1");
- txtWaterWarningTime.Text = _pump.H2OSensorMassWarningTime.ToString("F1");
- txtN2Flow.Text = _pump.N2PurgeFlow.ToString("f1");
- txtN2FlowWarning.Text = _pump.N2PurgeFlowWarningThreshold.ToString("F1");
- txtN2FlowWarningTime.Text = _pump.N2PurgeFlowWarningTime.ToString("F1");
- txtExhaustPressure.Text = _pump.ExhaustPressure.ToString("F1");
- txtPressureWarning.Text = _pump.ExhaustPressurePreWarningThreshold.ToString("F1");
- txtPressureWarningTime.Text = _pump.ExhaustPressurePreWarningTime.ToString("F1");
- }));
- return true;
- }
- private void btnWaterWarning_Click(object sender, EventArgs e)
- {
- if (_pump == null)
- return;
- float value;
- if (float.TryParse(txtWaterWarningSet.Text, out value))
- _pump.H2OSensorMassWarningThreshold = value;
- }
- private void btnWaterWarningTime_Click(object sender, EventArgs e)
- {
- if (_pump == null)
- return;
- float value;
- if (float.TryParse(txtWaterWarningTimeSet.Text, out value))
- _pump.H2OSensorMassWarningTime = value;
- }
- private void btnN2Warning_Click(object sender, EventArgs e)
- {
- if (_pump == null)
- return;
- float value;
- if (float.TryParse(txtN2WarningSet.Text, out value))
- _pump.N2PurgeFlowWarningThreshold = value;
- }
- private void btnN2WarningTime_Click(object sender, EventArgs e)
- {
- if (_pump == null)
- return;
- float value;
- if (float.TryParse(txtN2WarningTimeSet.Text, out value))
- _pump.N2PurgeFlowWarningTime = value;
- }
- private void btnExhaustPressure_Click(object sender, EventArgs e)
- {
- if (_pump == null)
- return;
- float value;
- if (float.TryParse(txtPressureWarningSet.Text, out value))
- _pump.ExhaustPressurePreWarningThreshold = value;
- }
- private void btnExhaustPressureTime_Click(object sender, EventArgs e)
- {
- if (_pump == null)
- return;
- float value;
- if (float.TryParse(txtPressureWarningTimeSet.Text, out value))
- _pump.ExhaustPressurePreWarningTime = value;
- }
- }
- }
|