public AxisEx(EleAxis axis, MotionCardWrapper wrapper = null) { var props = axis.GetType().GetProperties(); foreach (var p in props) { p.SetValue(this, p.GetValue(axis)); } DriverCard = new MotionCardWrapper((IMotionCard)DevPrimsManager.Instance.GetPrimByName(Driver)); }
public int LoadAxis(EleAxis axis) { var iRet = 0; tmrUpdateAxis.Stop(); if (axis == null) { return(-1); } _axis = axis; lbAxisName.Text = _axis.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(_axis.Driver)) { comboBoxPrimDev.Text = ""; } else { comboBoxPrimDev.Text = _axis.Driver; } tBoxAxisIdx.Text = _axis.AxisChannel.ToString(); tBoxAxisLead.Text = _axis.AxisLead.ToString(); cBoxAxisEnable.Checked = _axis.Enable; tBoxPosLimit.Text = _axis.PosCheckDI.ToString(); cBoxPosLimitEnable.Checked = _axis.PosCheckDIEnable; tBoxNegLimit.Text = _axis.NegCheckDI.ToString(); cBoxNegLimitEnable.Checked = _axis.NegCheckDIEnable; tBoxOrigin.Text = _axis.OriginCheckDI.ToString(); cBoxOriginEnable.Checked = _axis.OriginCheckDIEnable; cmbHomeMode.SelectedIndex = _axis.HomeMode; cmbHomeDir.SelectedIndex = _axis.HomeDir; txtHomePraCurve.Text = _axis.HomeCurve.ToString(); txtHomePraAcc.Text = _axis.HomeAcc.ToString(); txtHomePraVm.Text = _axis.HomeVm.ToString(); btnRun.BackColor = Color.DimGray; btnStop.BackColor = Color.DimGray; btnRun.PerformClick(); return(iRet); }
public static IAxisEx Cast(this EleAxis ele) { if (MotionWrappers.ContainsKey(ele.Driver)) { return(new AxisEx(ele, MotionWrappers[ele.Driver])); } else { MotionWrappers.Add(ele.Driver, new MotionCardWrapper((IMotionCard)DevPrimsManager.Instance.GetPrimByName(ele.Driver))); return(new AxisEx(ele, MotionWrappers[ele.Driver])); } }
public void LoadEle(EleAxis newEle) { if (newEle != null) { EleName = newEle.Name; EleDescription = newEle.Description; EleType = newEle.Type; CurEle = newEle; label1.BackColor = Color.LightGreen; } else { label1.BackColor = Color.LightGray; } }
public EleAxisControl(EleAxis curEle) { InitializeComponent(); CurEle = curEle; }
public EleAxisControl() { InitializeComponent(); CurEle = new EleAxis(); }