Esempio n. 1
0
        private void SolveAndSync(string fileName, CancellationToken token)
        {
            _settings.LastImagePath = Path.GetFullPath(fileName);

            var coordinate = _plateSolver.StartPlateSolve(fileName,
                                                          _telescope.RightAscension,
                                                          _telescope.Declination,
                                                          _settings.FieldWidth,
                                                          _settings.FieldHeight,
                                                          _settings.SearchTiles,
                                                          _settings.SolverPath, token);

            isProcessing = false;
            if (coordinate != null)
            {
                _telescope.SyncToCoordinates(coordinate.Ra, coordinate.Dec);
                _synchronizationContext.Post(o =>
                {
                    tbSolvedCoordinates.Text = string.Format("{0}, Angle: {1:0.##}", GetCoordinatesStr(coordinate.Ra, coordinate.Dec), coordinate.CameraAngle);
                    lblSolvedFileName.Text   = Path.GetFileName(fileName);
                    Update("Solve successful");
                }, null);
            }
            else
            {
                _synchronizationContext.Post(o =>
                {
                    tbSolvedCoordinates.Text = string.Empty;
                    lblSolvedFileName.Text   = string.Empty;
                    Update("Solve failed");
                }, null);
            }
        }
Esempio n. 2
0
        /// <inheritdoc/>
        public void Sync(CrdsEquatorial eq)
        {
            try
            {
                lock (locker)
                {
                    if (telescope != null && telescope.Connected)
                    {
                        UnparkIfPossible();
                        EnableTrackingIfPossible();

                        if (telescope.CanSync)
                        {
                            var eqT = ConvertCoordinatesToTelescopeEpoch(eq);
                            telescope.SyncToCoordinates(eqT.Alpha / 15, eqT.Delta);
                        }
                        else
                        {
                            RaiseOnMessageShow("$Ascom.Messages.SyncNotSupported");
                        }
                    }
                    else
                    {
                        Trace.TraceError("Unable to sync (telescope disconnected).");
                    }
                }
            }
            catch (Exception ex)
            {
                RaiseOnMessageShow("$Ascom.Messages.UnableSync");
                Trace.TraceError($"Unable to sync {ex}");
            }
        }