public CylinderEx(EleCylinder cy, MotionCardWrapper wrapper = null) { var props = cy.GetType().GetProperties(); foreach (var p in props) { p.SetValue(this, p.GetValue(cy)); } DriverCard = new MotionCardWrapper((IMotionCard)DevPrimsManager.Instance.GetPrimByName(Driver)); }
public static ICylinderEx Cast(this EleCylinder ele) { if (MotionWrappers.ContainsKey(ele.Driver)) { return(new CylinderEx(ele, MotionWrappers[ele.Driver])); } else { MotionWrappers.Add(ele.Driver, new MotionCardWrapper((IMotionCard)DevPrimsManager.Instance.GetPrimByName(ele.Driver))); return(new CylinderEx(ele, MotionWrappers[ele.Driver])); } }
public void LoadEle(EleCylinder newEle) { if (newEle != null) { EleName = newEle.Name; EleDescription = newEle.Description; EleType = newEle.Type; CurEle = newEle; label1.BackColor = Color.Lime; } else { label1.BackColor = Color.LightGray; } }
public int LoadCylinder(EleCylinder config) { var iRet = 0; if (config == null) { return(-1); } _cy = config; lbCylinderName.Text = config.Name; if (DevPrimsManager.Instance.Prims.Count > 0) { comboBoxPrimDev.Items.AddRange(DevPrimsManager.Instance.Prims.FindAll(p => p is IMotionCard).Select(p => p.Name).ToArray()); } if (string.IsNullOrEmpty(_cy.Driver)) { comboBoxPrimDev.Text = ""; } else { comboBoxPrimDev.Text = _cy.Driver; } cBoxCylinderEnable.Checked = _cy.Enable; tBoxDI1.Text = _cy.DiOrg.ToString(); tBoxDI2.Text = _cy.DiWork.ToString(); tBoxDO1.Text = _cy.DoOrg.ToString(); tBoxDO2.Text = _cy.DoWork.ToString(); cBoxDIEnable1.Checked = _cy.DiOrgEnable; cBoxDIEnable2.Checked = _cy.DiWorkEnable; cBoxDOEnable1.Checked = _cy.DoOrgEnable; cBoxDOEnable2.Checked = _cy.DoWorkEnable; btnRun.PerformClick(); return(iRet); }
public EleCylinderControl() { InitializeComponent(); CurEle = new EleCylinder(); }