private void ButtonSlewStop_Click(object sender, EventArgs e) { try { TelescopeHardware.AbortSlew(); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.ToString(), MessageBoxButtons.OK); } }
private void ButtonUnpark_Click(object sender, EventArgs e) { if (TelescopeHardware.IsParked) { TelescopeHardware.ChangePark(false); TelescopeHardware.Tracking = true; } else { TelescopeHardware.ChangePark(true); TelescopeHardware.Tracking = false; TelescopeHardware.Park(); } }
private void ButtonHome_Click(object sender, EventArgs e) { try { TelescopeHardware.FindHome(); } catch (ParkedException ex) { MessageBox.Show(ex.Message, "Parked Exception", MessageBoxButtons.OK, MessageBoxIcon.Stop); } catch (Exception ex) { MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
// // Constructor - Must be public for COM registration! // public Telescope() { try { driverID = Marshal.GenerateProgIdForType(this.GetType()); m_Util = new ASCOM.Utilities.Util(); // get a unique instance id objectId = TelescopeHardware.GetId(); TelescopeHardware.TL.LogMessage("New", "Instance ID: " + objectId + ", new: " + "Driver ID: " + driverID); TrackingRates = new TrackingRateObject(TelescopeInstance.TrackingRates); } catch (Exception ex) { EventLogCode.LogEvent("ASCOM.SimulatorCore.Telescope", "Exception on New", EventLogEntryType.Error, GlobalConstants.EventLogErrors.TelescopeSimulatorNew, ex.ToString()); System.Windows.Forms.MessageBox.Show("Telescope New: " + ex.ToString()); } }
private void StopSlew(SlewDirection direction) { try { if (this.radioButtonPulseGuide.Checked) { // Nothing to do for pulse guiding here. return; } TelescopeAxes axes = TelescopeAxes.axisPrimary; switch (direction) { case SlewDirection.SlewEast: case SlewDirection.SlewRight: case SlewDirection.SlewWest: case SlewDirection.SlewLeft: axes = TelescopeAxes.axisPrimary; break; case SlewDirection.SlewNorth: case SlewDirection.SlewUp: case SlewDirection.SlewSouth: case SlewDirection.SlewDown: axes = TelescopeAxes.axisSecondary; break; case SlewDirection.SlewNone: default: break; } TelescopeHardware.MoveAxis(axes, 0); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.ToString(), MessageBoxButtons.OK); } }
private void ButtonSlewStop_Click(object sender, EventArgs e) { TelescopeHardware.AbortSlew(); }
private void FrmMain_Load(object sender, EventArgs e) { SetSlewButtons(); TelescopeHardware.Start(); }
private void StartSlewGuide(SlewDirection direction) { try { if (this.radioButtonPulseGuide.Checked) { // Do Pulse Guiding instead GuideDirections dir = GuideDirections.guideEast; switch (direction) { case SlewDirection.SlewNorth: case SlewDirection.SlewUp: dir = GuideDirections.guideNorth; break; case SlewDirection.SlewSouth: case SlewDirection.SlewDown: dir = GuideDirections.guideSouth; break; case SlewDirection.SlewEast: case SlewDirection.SlewRight: dir = GuideDirections.guideEast; break; case SlewDirection.SlewWest: case SlewDirection.SlewLeft: dir = GuideDirections.guideWest; break; case SlewDirection.SlewNone: default: return; } TelescopeHardware.Guide(dir, GuideDuration()); return; } double rate = GetSlewSpeed(); TelescopeAxes axes = TelescopeAxes.axisPrimary; //if (TelescopeHardware.AlignmentMode == DeviceInterface.AlignmentModes.algAltAz) //{ // slewDirection = direction; //} //else //{ switch (direction) { case SlewDirection.SlewEast: case SlewDirection.SlewRight: axes = TelescopeAxes.axisPrimary; break; case SlewDirection.SlewWest: case SlewDirection.SlewLeft: axes = TelescopeAxes.axisPrimary; rate = -rate; break; case SlewDirection.SlewNorth: case SlewDirection.SlewUp: axes = TelescopeAxes.axisSecondary; break; case SlewDirection.SlewSouth: case SlewDirection.SlewDown: axes = TelescopeAxes.axisSecondary; rate = -rate; break; case SlewDirection.SlewNone: default: return; } //} TelescopeHardware.MoveAxis(axes, rate); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.ToString(), MessageBoxButtons.OK); } }