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/ManualControl/InitAction.cs

45 lines
1.9 KiB
C#

using Mesnac.Action.Base;
using Mesnac.Controls.Base;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.ManualControl
{
public class InitAction : ChemicalWeighingAction, IAction
{
List<DbMCControl> McControllist;
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须要调用的
List<DbMCControl> mcControllist = GetAllDbMCControlsByOption(DbOptionTypes.Query);//获取所有待初始化控件
//IBaseControl startdate = mcControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey.ToLower() == "startdate").FirstOrDefault().BaseControl;
McControllist = GetAllDbMCControlsByOption(DbOptionTypes.InitData);//获取所有待初始化控件
IBaseControl WaterActualValue1 = GetBaseControl("WaterActualValue1");
IBaseControl WaterActualValue2 = GetBaseControl("WaterActualValue2");
IBaseControl WaterActualValue3 = GetBaseControl("WaterActualValue3");
IBaseControl WaterActualValue4 = GetBaseControl("WaterActualValue4");
IBaseControl SpiralActValue1 = GetBaseControl("SpiralActValue1");
IBaseControl SpiralActValue2 = GetBaseControl("SpiralActValue2");
IBaseControl SpiralActValue3 = GetBaseControl("SpiralActValue3");
IBaseControl SpiralActValue4 = GetBaseControl("SpiralActValue4");
MessageBox.Show("LoadingSuccess!");
}
private IBaseControl GetBaseControl(string name)
{
return McControllist.Where(t => t.BaseControl.MCKey != null && t.BaseControl.MCKey == name).FirstOrDefault().BaseControl;
}
}
}