public void SetAxisAndInitGUI(HardwareController hwc, Axis axis) { HWC = hwc; MyAxis = axis; Data.AxisName = MyAxis.ControlIdent; EnableChange(axis, axis.IsEnable); HasFaultChange(axis, axis.HasFault); this.Data.AbsPosStr = Axis.SConvertIntToStr(MyAxis.Position, true); this.Data.RelPosStr = Axis.SConvertIntToStr(HWC.ConvertCoordinatesAlways(MyAxis.ControlIdent, -MyAxis.Position) * (-1), true); //Verbinde Notifyer MyAxis.IsEnableChanged += EnableChange; MyAxis.HasFaultChange += HasFaultChange; MyAxis.PositionChange += PositionChange; MyAxis.VelocityChange += VelocityChange; //Load Values DataSafe ds = new DataSafe(Paths.SettingsPath, "MainWindow"); Speed = ds.Ints[axis.ControlIdent + "-FR-Speed", 0]; Distance = ds.Ints[axis.ControlIdent + "-FR-Distance", 0]; UseDistance = ds.Bools[axis.ControlIdent + "-FR-UseDis", false]; DisplayFreeRunValues(); FreeRunThread = new TrackedThread("Free Run Distance Thread: " + MyAxis, this.FreeRunThreadMethod); FreeRunQueue = new Queue <Action>(); FreeRunThread.Start(); }
protected void PositionChange(Axis a, int pos) { this.Data.AbsPosStr = Axis.SConvertIntToStr(pos, true); this.Data.RelPosStr = Axis.SConvertIntToStr(HWC.ConvertCoordinatesAlways(MyAxis.ControlIdent, -pos) * (-1), true); }