private async void btnPark_Click(object sender, EventArgs e) { if (UIisActive) { if (telescope.CanPark && telescope.CanUnpark) { if (telescope.AtPark) { labelValStatus.Text = "Unparking..."; setTracking(true); telescope.Unpark(); labelValStatus.Text = "Connected"; btnPark.Text = "Park"; } else { labelValStatus.Text = "Parking..."; setTracking(false); telescope.Park(); labelValStatus.Text = "Connected"; btnPark.Text = "Unpark"; } } } }
private void ejecutaTest(MountCheck test) { // Si el usuario aun no escoge un test if (this.runningTest == null) { return; } // Si el test escogido esta en ejecucion if (this.runningTest.IsRunning) { return; } this.runningTest.start(); switch (runningTest.Id) { case 1: //telescopio.Connected = true; timerReadSerial.Stop(); telescopio.Park(); timerReadSerial.Start(); break; case 2: telescopio.Unpark(); telescopio.MoveAxis(TelescopeAxes.axisSecondary, -5); break; case 3: telescopio.MoveAxis(TelescopeAxes.axisSecondary, 5); break; case 4: telescopio.Unpark(); telescopio.SlewToAltAzAsync(270, 89); break; case 5: this.setMonturaProtection(false); telescopio.MoveAxis(TelescopeAxes.axisPrimary, 5); break; case 6: telescopio.Unpark(); telescopio.SlewToAltAzAsync(90, 89); break; case 7: this.setMonturaProtection(false); telescopio.MoveAxis(TelescopeAxes.axisPrimary, -5); break; } }
public async Task <bool> ParkTelescope() { bool result = true; await Task.Run(async() => { Logger.Trace("Telescope has been commanded to park"); try { if (Telescope.CanPark) { if (!Telescope.AtPark) { progress?.Report(new ApplicationStatus { Status = Locale.Loc.Instance["LblWaitingForTelescopeToPark"] }); Telescope.Park(); while (!Telescope.AtPark) { await Utility.Utility.Delay(TimeSpan.FromSeconds(2), CancellationToken.None); } } else { Logger.Info("Telescope commanded to park but it is already parked"); } } else // Telescope is incapable of parking. Slew safely to the celestial pole and stop tracking instead { Coordinates targetCoords = GetHomeCoordinates(telescopeInfo.Coordinates); Logger.Trace($"Telescope cannot park. Will slew to RA {targetCoords.RAString}, Dec {targetCoords.DecString}"); await SlewToCoordinatesAsync(targetCoords); Logger.Trace("Telescope will stop tracking"); result = SetTracking(false); } } catch (Exception e) { Logger.Error($"An error occured while attmepting to park: {e}"); Notification.ShowError(e.Message); result = false; } finally { progress?.Report(new ApplicationStatus { Status = string.Empty }); } Logger.Trace("Telescope has parked"); }); return(result); }
/// <inheritdoc/> public void Park() { try { lock (locker) { if (telescope != null && !telescope.AtPark && telescope.CanSetPark) { Task.Run(() => telescope.Park()); NotifyPropertyChanged(nameof(IsSlewing)); } } } catch (Exception ex) { RaiseOnMessageShow("$Ascom.Messages.UnablePark"); Log.Error($"Unable to park telescope: {ex}"); } }
private void btnPark_Click(object sender, EventArgs e) { // 望远镜复位 nftele_.state = TELESCOPE_STATE.TELESCOPE_PARKING; telescope_.Park(); }