change - 自动控制单选变色

wangsr
wangsr 1 year ago
parent b3638888ea
commit 24c668cb42

@ -12,14 +12,14 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl.Entity
{
public class GelerWeterControlsEntity
{
public IBaseControl Line1 { get; set; }
public IBaseControl Line2 { get; set; }
public IBaseControl Line3 { get; set; }
public IBaseControl Line4 { get; set; }
public IBaseControl Line5 { get; set; }
public IBaseControl Line6 { get; set; }
public IBaseControl Line7 { get; set; }
public IBaseControl Line8 { get; set; }
public MCRadioButton Line1 { get; set; }
public MCRadioButton Line2 { get; set; }
public MCRadioButton Line3 { get; set; }
public MCRadioButton Line4 { get; set; }
public MCRadioButton Line5 { get; set; }
public MCRadioButton Line6 { get; set; }
public MCRadioButton Line7 { get; set; }
public MCRadioButton Line8 { get; set; }
public MCCombobox ChooseMaterial1 { get; set; }
public MCCombobox ChooseMaterial2 { get; set; }

@ -615,14 +615,14 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
/// </summary>
private void ControlImport()
{
ControlsEntity.Line1 = GetBaseControl("Line1");
ControlsEntity.Line2 = GetBaseControl("Line2");
ControlsEntity.Line3 = GetBaseControl("Line3");
ControlsEntity.Line4 = GetBaseControl("Line4");
ControlsEntity.Line5 = GetBaseControl("Line5");
ControlsEntity.Line6 = GetBaseControl("Line6");
ControlsEntity.Line7 = GetBaseControl("Line7");
ControlsEntity.Line8 = GetBaseControl("Line8");
ControlsEntity.Line1 = GetMCRadioButtonControl("Line1");
ControlsEntity.Line2 = GetMCRadioButtonControl("Line2");
ControlsEntity.Line3 = GetMCRadioButtonControl("Line3");
ControlsEntity.Line4 = GetMCRadioButtonControl("Line4");
ControlsEntity.Line5 = GetMCRadioButtonControl("Line5");
ControlsEntity.Line6 = GetMCRadioButtonControl("Line6");
ControlsEntity.Line7 = GetMCRadioButtonControl("Line7");
ControlsEntity.Line8 = GetMCRadioButtonControl("Line8");
ControlsEntity.ChooseMaterial1 = GetComboBoxControl("ChooseMaterial1");
ControlsEntity.ChooseMaterial2 = GetComboBoxControl("ChooseMaterial2");
@ -672,6 +672,11 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
return McControls.First(x => x.Name == name) as MCCombobox;
}
private MCRadioButton GetMCRadioButtonControl(string name)
{
return McControls.First(x => x.Name == name) as MCRadioButton;
}
#endregion
}

@ -9,6 +9,7 @@ using Mesnac.Controls.Default;
using Microsoft.Office.Interop.Excel;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -21,6 +22,7 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
{
GelerWeterControlsEntity ControlsEntity = new GelerWeterControlsEntity();
private List<Control> McControls;
Color backColor = Color.Transparent;
public void Run(RuntimeParameter runtime)
{
@ -32,11 +34,35 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
ControlImport();
ControlsEntity.Line1.MCValue = true;
ControlsEntity.Line1.BackColor = System.Drawing.Color.LightGreen;
ControlsEntity.Line1.CheckedChanged += Mcradion_CheckedChanged;
ControlsEntity.Line2.CheckedChanged += Mcradion_CheckedChanged;
ControlsEntity.Line3.CheckedChanged += Mcradion_CheckedChanged;
ControlsEntity.Line4.CheckedChanged += Mcradion_CheckedChanged;
ControlsEntity.Line5.CheckedChanged += Mcradion_CheckedChanged;
ControlsEntity.Line6.CheckedChanged += Mcradion_CheckedChanged;
ControlsEntity.Line7.CheckedChanged += Mcradion_CheckedChanged;
ControlsEntity.Line8.CheckedChanged += Mcradion_CheckedChanged;
ControlInitFromPLC();
}
private void Mcradion_CheckedChanged(object sender, EventArgs e)
{
MCRadioButton mCRadio = sender as MCRadioButton;
ControlsEntity.Line1.BackColor = backColor;
ControlsEntity.Line2.BackColor = backColor;
ControlsEntity.Line3.BackColor = backColor;
ControlsEntity.Line4.BackColor = backColor;
ControlsEntity.Line5.BackColor = backColor;
ControlsEntity.Line6.BackColor = backColor;
ControlsEntity.Line7.BackColor = backColor;
ControlsEntity.Line8.BackColor = backColor;
mCRadio.BackColor = Color.LightGreen;
}
/// <summary>
/// 控件从Plc初始化
/// </summary>
@ -128,7 +154,14 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
/// </summary>
private void ControlImport()
{
ControlsEntity.Line1 = GetBaseControl("Line1");
ControlsEntity.Line1 = GetMCRadioButtonControl("Line1");
ControlsEntity.Line2 = GetMCRadioButtonControl("Line2");
ControlsEntity.Line3 = GetMCRadioButtonControl("Line3");
ControlsEntity.Line4 = GetMCRadioButtonControl("Line4");
ControlsEntity.Line5 = GetMCRadioButtonControl("Line5");
ControlsEntity.Line6 = GetMCRadioButtonControl("Line6");
ControlsEntity.Line7 = GetMCRadioButtonControl("Line7");
ControlsEntity.Line8 = GetMCRadioButtonControl("Line8");
ControlsEntity.ChooseMaterial1 = GetComboBoxControl("ChooseMaterial1");
ControlsEntity.ChooseMaterial2 = GetComboBoxControl("ChooseMaterial2");
@ -161,5 +194,11 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
{
return McControls.First(x => x.Name == name) as MCCombobox;
}
private MCRadioButton GetMCRadioButtonControl(string name)
{
return McControls.First(x => x.Name == name) as MCRadioButton;
}
}
}

@ -1,4 +1,6 @@
using Mesnac.Action.Base;
using DataBlockHelper.Entity.DB2106Entity;
using HslCommunication.Instrument.DLT;
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.AutoControl.DB;
using Mesnac.Action.ChemicalWeighing.AutoControl.Entity;
using Mesnac.Action.ChemicalWeighing.FreeDb;
@ -7,6 +9,7 @@ using Mesnac.Controls.Base;
using Mesnac.Controls.Default;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -32,6 +35,10 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
}
#region 控件初始化
/// <summary>
/// 控件从Plc初始化
/// </summary>
@ -220,6 +227,10 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
}
#endregion
#region 辅助类
/// <summary>
/// 单选选择
/// </summary>
@ -269,14 +280,14 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
/// </summary>
private void ControlImport()
{
ControlsEntity.Line1 = GetBaseControl("Line1");
ControlsEntity.Line2 = GetBaseControl("Line2");
ControlsEntity.Line3 = GetBaseControl("Line3");
ControlsEntity.Line4 = GetBaseControl("Line4");
ControlsEntity.Line5 = GetBaseControl("Line5");
ControlsEntity.Line6 = GetBaseControl("Line6");
ControlsEntity.Line7 = GetBaseControl("Line7");
ControlsEntity.Line8 = GetBaseControl("Line8");
ControlsEntity.Line1 = GetMCRadioButtonControl("Line1");
ControlsEntity.Line2 = GetMCRadioButtonControl("Line2");
ControlsEntity.Line3 = GetMCRadioButtonControl("Line3");
ControlsEntity.Line4 = GetMCRadioButtonControl("Line4");
ControlsEntity.Line5 = GetMCRadioButtonControl("Line5");
ControlsEntity.Line6 = GetMCRadioButtonControl("Line6");
ControlsEntity.Line7 = GetMCRadioButtonControl("Line7");
ControlsEntity.Line8 = GetMCRadioButtonControl("Line8");
ControlsEntity.ChooseMaterial1 = GetComboBoxControl("ChooseMaterial1");
ControlsEntity.ChooseMaterial2 = GetComboBoxControl("ChooseMaterial2");
@ -309,5 +320,13 @@ namespace Mesnac.Action.ChemicalWeighing.AutoControl
{
return McControls.First(x => x.Name == name) as MCCombobox;
}
private MCRadioButton GetMCRadioButtonControl(string name)
{
return McControls.First(x => x.Name == name) as MCRadioButton;
}
#endregion
}
}

Loading…
Cancel
Save