private bool SelectingStarSpectra(Point location, bool shiftHeld, bool controlHeld)
        {
            IVideoFrame currentVideoFrame = m_VideoRenderingController.GetCurrentFrame();
            if (currentVideoFrame != null)
            {
                var astroImg = new AstroImage(currentVideoFrame, m_VideoRenderingController.Width, m_VideoRenderingController.Height, currentVideoFrame.MaxSignalValue);
                uint[,] areaPixels = astroImg.GetMeasurableAreaPixels(location.X, location.Y);

                PSFFit psfFit = new PSFFit(location.X, location.Y);
                psfFit.Fit(areaPixels);

                if (psfFit.IsSolved && psfFit.Certainty > Settings.Default.TrackingMinGuidingCertainty)
                {
                    float angle = LocateSpectraAngle(psfFit, astroImg);

                    if (!float.IsNaN(angle))
                    {
                        TrackingContext.Current.GuidingStar = new LastTrackedPosition(m_Bpp)
                        {
                            FWHM = (float)psfFit.FWHM,
                            X = (float)psfFit.XCenter,
                            Y = (float)psfFit.YCenter,
                            IsFixed = false
                        };

                        TrackingContext.Current.ReConfigureNativeTracking(m_VideoRenderingController.Width, m_VideoRenderingController.Height);
                        TrackingContext.Current.SpectraAngleDeg = angle;

                        return true;
                    }
                }
            }

            return false;
        }
        private bool SelectingTargetStar(Point location, bool shiftHeld, bool controlHeld)
        {
            IVideoFrame currentVideoFrame = m_VideoRenderingController.GetCurrentFrame();
            if (currentVideoFrame != null)
            {
                var astroImg = new AstroImage(currentVideoFrame, m_VideoRenderingController.Width, m_VideoRenderingController.Height);
                uint[,] areaPixels = astroImg.GetMeasurableAreaPixels(location.X, location.Y);

                PSFFit psfFit = new PSFFit(location.X, location.Y);
                psfFit.Fit(areaPixels);

                TrackingContext.Current.TargetStar = new LastTrackedPosition(m_Bpp)
                {
                    FWHM = (float)psfFit.FWHM,
                    X = (float)psfFit.XCenter,
                    Y = (float)psfFit.YCenter
                };

                TrackingContext.Current.TargetStar.IsFixed = !psfFit.IsSolved || psfFit.Certainty < Settings.Default.TrackingMinForcedFixedObjCertainty || controlHeld;
                TrackingContext.Current.TargetStar.IsFullDisapearance = shiftHeld;
                TrackingContext.Current.ReConfigureNativeTracking(m_VideoRenderingController.Width, m_VideoRenderingController.Height);

                return true;

            }

            return false;
        }
        private bool SelectGuidingStar(Point location, bool shiftHeld, bool controlHeld)
        {
            IVideoFrame currentVideoFrame = m_VideoRenderingController.GetCurrentFrame();
            if (currentVideoFrame != null)
            {
                // Find the object at the location and set it as a guiding star
                var astroImg = new AstroImage(currentVideoFrame, m_VideoRenderingController.Width, m_VideoRenderingController.Height);
                uint[,] areaPixels = astroImg.GetMeasurableAreaPixels(location.X, location.Y);

                PSFFit psfFit = new PSFFit(location.X, location.Y);
                psfFit.Fit(areaPixels);
                if (psfFit.IsSolved && psfFit.Certainty > Settings.Default.TrackingMinGuidingCertainty)
                {
                    TrackingContext.Current.GuidingStar = new LastTrackedPosition(m_Bpp)
                    {
                        FWHM = (float)psfFit.FWHM,
                        X = (float)psfFit.XCenter,
                        Y = (float)psfFit.YCenter,
                        IsFixed = false
                    };

                    TrackingContext.Current.ReConfigureNativeTracking(m_VideoRenderingController.Width, m_VideoRenderingController.Height);
                    TrackingContext.Current.SpectraAngleDeg = float.NaN;

                    return true;
                }
                else
                {
                    // NOTE: Too faint to be used as a guiding star
                    MessageBox.Show(m_MainForm, "This object is not bright enought for a Guiding star.", "OccuRec", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

            }

            return false;
        }