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.

62 lines
2.2 KiB
C#

using Mesnac.Action.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.ProjectDebug
{
public class Item
{
public Item(string name,string value)
{
Name = name;
Value = value;
}
public string Name { get; }
public string Value { get; }
}
class InitProjectDebugInfo : ChemicalWeighingAction, IAction
{
string readEquipRunName = String.Empty;
public static bool IsFirstRun = true; //是否首次运行
private string ReadGroupName = "DB101_ProjectDebug";
public static List<Item> DataType = null;
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须要调用
ComboBox comboBox1 = base.GetControlById("MCCombobox1") as ComboBox;
ComboBox comboBox2 = base.GetControlById("MCCombobox2") as ComboBox;
comboBox1.DataSource = null;
List<Item> DataType1 = new List<Item>();
List<Item> DataType2 = new List<Item>();
//获取工程调试器件列表
foreach (Mesnac.Equips.BaseEquip equip in Equips.Factory.Instance.AllEquips.Values)
{
if (equip.Group.ContainsKey(ReadGroupName))
{
foreach (Mesnac.Equips.BaseInfo.Data data in equip.Group[ReadGroupName].Data.Values)
{
if (data.KeyName.Contains("Status"))
{
DataType1.Add(new Item(data.Remark, data.Name));
}
else if (data.KeyName.Contains("Speed"))
{
DataType2.Add(new Item(data.Remark, data.Name));
}
}
}
}
comboBox1.DataSource = DataType1;
comboBox1.ValueMember = "Value";
comboBox1.DisplayMember = "Name";
comboBox2.DataSource = DataType2;
comboBox2.ValueMember = "Value";
comboBox2.DisplayMember = "Name";
}
}
}