You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lj_plc/Actions/ChemicalWeighing/Mesnac.Action.ChemicalWeighing/Qu/Sb.cs

61 lines
1.6 KiB
C#

using Mesnac.Controls.Default;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.Qu
{
public class Sb
{
List<Control> Controls;
public Sb(List<Control> c)
{
this.Controls = c;
PropertyInfo[] sourcePropertyInfoList = this.GetType().GetProperties();
foreach (PropertyInfo sourceProperty in sourcePropertyInfoList)
{
string name = sourceProperty.Name;
var pro = Controls.FirstOrDefault(x => x.Name == name) as SpecialLabelBlue;
sourceProperty.SetValue(this, pro);
}
}
public void Action()
{
PropertyInfo[] sourcePropertyInfoList = this.GetType().GetProperties();
foreach (PropertyInfo sourceProperty in sourcePropertyInfoList)
{
object value = sourceProperty.GetValue(this);
SpecialLabelBlue stu = value as SpecialLabelBlue;
if (stu.BackColor == Color.Yellow)
{
SetWhite(stu);
sourceProperty.SetValue(this, stu);
}
}
}
public void SetWhite(SpecialLabelBlue special)
{
special.BackColor = Color.White;
}
public void SetLightGreen(SpecialLabelBlue special)
{
special.BackColor = Color.Yellow;
}
}
}