コード例 #1
0
ファイル: FormDevices.cs プロジェクト: rrskybox/Humason
 public FormDevices()
 {
     InitializeComponent();
     //Populate entries with stored entries, if any
     ResetConfiguration();
     NHUtil.ButtonGreen(RefreshFiltersButton);
 }
コード例 #2
0
        private void AutoGuideOnButton_Click(object sender, EventArgs e)
        {
            //Execute TSX_AutoGuide class
            //  Open and connect to autoguider
            //  if (not calibrated,) { abort
            //  Find guidestar
            //  Turn on Autoguide
            SessionControl openSession = new SessionControl();
            TargetPlan     tPlan       = new TargetPlan(openSession.CurrentTargetName);

            if (NHUtil.IsButtonRed(AutoGuideOnButton))
            {
                AutoGuide.AutoGuideStop();
                AutoGuideOnButton.Text = "Start\r\nAutoguiding";
                NHUtil.ButtonGreen(AutoGuideOnButton);
            }
            else
            {
                //First, save the guider cycle time and anything else in the future that might be hanging around
                tPlan.GuiderCycleTime = (double)GuiderCycleTimeNum.Value;
                if (tPlan.DitherEnabled)
                {
                    AutoGuide.DitherAndStart();
                }
                else
                {
                    AutoGuide.AutoGuideStart();
                }
                AutoGuideOnButton.Text = "Stop\r\nAutoguiding";
                NHUtil.ButtonRed(AutoGuideOnButton);
            }
        }
コード例 #3
0
        private void FindStarButton_Click(object sender, EventArgs e)
        {
            NHUtil.ButtonRed(FindStarButton);

            SessionControl openSession = new SessionControl();
            TargetPlan     tPlan       = new TargetPlan(openSession.CurrentTargetName);

            bool fsbresult = AutoGuide.SetAutoGuideStar();

            //if there is an error, then assume that the exposure is just too low
            // reset the guide exposure to maximum and try again
            if (!fsbresult)
            {
                tPlan.GuideExposure        = tPlan.MaximumGuiderExposure;
                GuideExposureTimeBox.Value = (decimal)tPlan.MaximumGuiderExposure;
                fsbresult = AutoGuide.SetAutoGuideStar();
            }
            //If it worked this time then update the guide star position, otherwise just leave it
            if (fsbresult)
            {
                GuideStarXBox.Text = Convert.ToInt32(tPlan.GuideStarX).ToString();
                GuideStarYBox.Text = Convert.ToInt32(tPlan.GuideStarY).ToString();
            }
            NHUtil.ButtonGreen(FindStarButton);
        }
コード例 #4
0
ファイル: FormPlan.cs プロジェクト: rrskybox/Humason
        private void ToTSXButton_Click(object sender, EventArgs e)
        {
            //Tries to look up the name in the target box.  If found, then a new target plan is
            //opened.  Disconnect the telescope (in case centering is forced), use the target box to find
            //and and center the star chart and FOV on the target.
            //If not throw a log entry and return;
            //Remove spaces from target name if any
            //PlanTargetBox.Text = PlanTargetBox.Text.Replace(" ", "");
            LogEvent       lg          = new LogEvent();
            SessionControl openSession = new SessionControl();

            NHUtil.ButtonRed(SelectButton);
            TSXLink.Target tgt = TSXLink.StarChart.FindTarget(PlanTargetBox.Text);
            if (tgt != null)
            {
                TSXLink.Connection.DisconnectDevice(TSXLink.Connection.Devices.Mount);
                TargetPlan newtPlan = new TargetPlan(tgt.Name);
                newtPlan.TargetPA            = TSXLink.FOVI.GetFOVPA;
                newtPlan.TargetAdjustEnabled = false;
                PlanTargetBox.Text           = newtPlan.TargetName;
                TSXLink.StarChart.SetFOV(2);
                LoadTargetPlanList();
                openSession.CurrentTargetName = newtPlan.TargetName;
                lg.LogIt("A new target plan has been created for " + newtPlan.TargetName);
            }
            else
            {
                lg.LogIt(PlanTargetBox.Text + ": target not found.");
            }
            NHUtil.ButtonGreen(SelectButton);
            Show();
        }
コード例 #5
0
 private void CalibrateButton_Click(object sender, EventArgs e)
 {
     //Calibrate the mount (direct guide), then calibrate AO, if set
     NHUtil.ButtonRed(CalibrateButton);
     AutoGuide.CalibrateAutoguiding(SubframeCheckBox.Checked, (double)XAxisMoveTime.Value, (double)YAxisMoveTime.Value);
     //Restore original target position if (a new star was used
     NHUtil.ButtonGreen(CalibrateButton);
 }
コード例 #6
0
 private void ColorButtonsGreen()
 {
     NHUtil.ButtonGreen(AutoGuideOnButton);
     NHUtil.ButtonGreen(FindStarButton);
     NHUtil.ButtonGreen(OptimizeExposureButton);
     NHUtil.ButtonGreen(CalibrateButton);
     NHUtil.ButtonGreen(GuiderAutoCalibrateButton);
 }
コード例 #7
0
ファイル: FormHumason.cs プロジェクト: rrskybox/Humason
 private void ConnectButton_Click(object sender, EventArgs e)
 {
     if (NHUtil.IsButtonGreen(ConnectButton))
     {
         NHUtil.ButtonRed(ConnectButton);
         Operations.InitializeSystem();
         NHUtil.ButtonGreen(ConnectButton);
     }
 }
コード例 #8
0
ファイル: FormFlats.cs プロジェクト: rrskybox/Humason
        private void FlatManStageButton_Click(object sender, EventArgs e)
        {
            FlatMan flmn = new FlatMan();

            NHUtil.ButtonRed(FlatManStageButton);
            flmn.FlatManStage();
            NHUtil.ButtonGreen(FlatManStageButton);
            return;
        }
コード例 #9
0
ファイル: FormHumason.cs プロジェクト: rrskybox/Humason
 private void AbortButton_Click(object sender, EventArgs e)
 {
     NHUtil.ButtonRed(AbortButton);
     //AbortEvent ab = new AbortEvent();
     SetAbort();
     //ab.AbortIt("Abort Button Clicked");
     NHUtil.ButtonGreen(AbortButton);
     StartButton.Text = "Aborted";
     NHUtil.ButtonRed(StartButton);
 }
コード例 #10
0
        private void SaveDefaultButton_Click(object sender, EventArgs e)
        {
            //Saves the current active target file as the default file
            SessionControl openSession = new SessionControl();

            NHUtil.ButtonRed(SaveDefaultButton);
            TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName);

            tPlan.SavePlanAsDefaultPlan();
            NHUtil.ButtonGreen(SaveDefaultButton);
        }
コード例 #11
0
ファイル: FormFlats.cs プロジェクト: rrskybox/Humason
        private void TakeFlatsButton_Click(object sender, EventArgs e)
        {
            NHUtil.ButtonRed(TakeFlatsButton);
            SessionControl openSession = new SessionControl();
            FlatManager    fmgr        = new FlatManager();

            fmgr.TakeFlats();
            FlatManBrightnessNum.Value = openSession.FlatManBrightness;
            NHUtil.ButtonGreen(TakeFlatsButton);
            return;
        }
コード例 #12
0
ファイル: FormAutoFocus.cs プロジェクト: rrskybox/Humason
 public FormAutoFocus()
 {
     InitializeComponent();
     {
         ResetConfiguration();
         //Set button colors
         NHUtil.ButtonGreen(Presetbutton);
         NHUtil.ButtonGreen(AtFocus2Button);
         NHUtil.ButtonGreen(AtFocus3Button);
     }
 }
コード例 #13
0
ファイル: FormAutoFocus.cs プロジェクト: rrskybox/Humason
        private void Presetbutton_Click(object sender, EventArgs e)
        {
            //Moves focuser to critical focus position for current temperature based on "Current.foc" focus training file:
            //   Checks for focuser connection
            //   Gets current temperature from focuser
            //   Calls function to compute new position from a selected focus training data file and current temperature
            //   Moves focuser to new position from current position

            NHUtil.ButtonRed(Presetbutton);
            LogEvent       lg          = new LogEvent();
            SessionControl openSession = new SessionControl();
            TargetPlan     tPlan       = new TargetPlan(openSession.CurrentTargetName);

            //Get a filter focus file path from the configuration file, then validate/change via dialog
            FilterFileDialog.InitialDirectory = openSession.FocuserDataFolder;
            FilterFileDialog.FileName         = "";

            DialogResult focusfilelist = FilterFileDialog.ShowDialog();

            //Check for a null return (e.g. no file selected)
            //  just log it and return if nothing there
            if (focusfilelist != DialogResult.OK)
            {
                lg.LogIt("No focus preset file selected");
                NHUtil.ButtonGreen(Presetbutton);
                return;
            }
            //Else...
            string focusfile = FilterFileDialog.FileNames[0];

            //Save the new (or unchanged) file path
            int baseFilterId = tPlan.FocusFilter;

            lg.LogIt("Presetting focus position");

            double currenttemp      = TSXLink.Focus.GetTemperature();
            double newfocusposition = AutoFocus.ComputeNewFocusPosition(focusfile, currenttemp, baseFilterId);

            if (newfocusposition == 0)
            {
                //Insufficient data to compute new position so, just leave it.
                lg.LogIt("Focus preset aborted -- insufficient data to compute new position");
                NHUtil.ButtonGreen(Presetbutton);
                return;
            }
            else
            {
                TSXLink.Focus.MoveTo(newfocusposition);
            }
            lg.LogIt("Focus preset completed");
            NHUtil.ButtonGreen(Presetbutton);
            return;
        }
コード例 #14
0
ファイル: FormPlan.cs プロジェクト: rrskybox/Humason
 private void LoadPlanButton_Click(object sender, EventArgs e)
 {
     //Sets the active plan to the plan selected in the target list box
     NHUtil.ButtonRed(LoadPlanButton);
     if (!(PlanListBox.SelectedItem == null))
     {
         string tname = PlanListBox.SelectedItem.ToString();
         LoadNewTargetPlan(tname);
     }
     LoadTargetPlanList();
     NHUtil.ButtonGreen(LoadPlanButton);
 }
コード例 #15
0
        private void OptimizeExposureButton_Click(object sender, EventArgs e)
        {
            SessionControl openSession = new SessionControl();
            TargetPlan     tPlan       = new TargetPlan(openSession.CurrentTargetName);

            NHUtil.ButtonRed(OptimizeExposureButton);
            double optExposure = AutoGuide.OptimizeExposure();

            GuideExposureTimeBox.Value = (decimal)optExposure;
            tPlan.GuideExposure        = optExposure;
            NHUtil.ButtonGreen(OptimizeExposureButton);
        }
コード例 #16
0
ファイル: FormHumason.cs プロジェクト: rrskybox/Humason
 private void ColorButtonsGreen()
 {
     NHUtil.ButtonGreen(ConnectButton);
     NHUtil.ButtonGreen(CloseButton);
     NHUtil.ButtonGreen(DisconnectButton);
     NHUtil.ButtonGreen(StartButton);
     NHUtil.ButtonGreen(AbortButton);
     NHUtil.ButtonGreen(CloseButton);
     NHUtil.ButtonGreen(OptionsButton);
     NHUtil.ButtonGreen(AboutButton);
     return;
 }
コード例 #17
0
ファイル: FormPlan.cs プロジェクト: rrskybox/Humason
        private void MosaicButton_Click(object sender, EventArgs e)
        {
            //Reads and constructs mosaic entry as a set of target plans after a mosaic has
            //  been constructed and copied to the clipboard in TSX
            //
            // Button will be held red until the user has prepared mosaic in TSX and
            //  copied to clipboard
            SessionControl openSession = new SessionControl();

            if (NHUtil.IsButtonGreen(MosaicButton))
            {
                //Verify that a target has been loaded, if not, post error and return
                //  otherwise, set the button color to read, change the text and zero the FOVI
                //  in anticipation of loading a mosaic target set
                TargetPlan tPlan = new TargetPlan(openSession.CurrentTargetName);
                if (TSXLink.StarChart.IsValidTarget(tPlan))
                {
                    NHUtil.ButtonRed(MosaicButton);
                    MosaicButton.Text = "Clipboard Ready";
                    TSXLink.FOVI.SetFOVPA(0);
                }
            }
            else
            {
                Mosaic nhms = new Mosaic();
                List <Mosaic.MosaicTarget> nhmtgts = nhms.ReadTSXMosaic();
                //Just return if no targets are found
                if (nhmtgts != null)
                {
                    //Save the mosaic entries as versions of the current configuration file
                    // For each of the entries in the mosaic,
                    //  Load the values into the configuration file
                    //  Save the configuration file with a prefix tName-Set-Frame
                    string tName = openSession.CurrentTargetName;
                    foreach (Mosaic.MosaicTarget mt in nhmtgts)
                    {
                        string     prefixName = tName + "-" + mt.Set + "-" + mt.Frame;
                        TargetPlan tPlan      = new TargetPlan(prefixName)
                        {
                            TargetName          = prefixName,
                            TargetRA            = mt.RA,
                            TargetDec           = mt.Dec,
                            TargetPA            = mt.PositionAngle,
                            TargetAdjustEnabled = true
                        };
                    }
                }
                LoadTargetPlanList();
                MosaicButton.Text = "Build Mosaic";
                NHUtil.ButtonGreen(MosaicButton);
            }
        }
コード例 #18
0
ファイル: FormRotate.cs プロジェクト: rrskybox/Humason
        private void RotateToRPAButton_Click(object sender, EventArgs e)
        {
            NHUtil.ButtonRed(RotateToRPAButton);
            Rotator.PlateSolveIt();
            DisplayResults();
            double rotate = (double)MoveToRPANum.Value;

            Rotator.RotateToRotatorPA(rotate);
            Rotator.PlateSolveIt();
            DisplayResults();
            NHUtil.ButtonGreen(RotateToRPAButton);
            return;
        }
コード例 #19
0
ファイル: FormPlan.cs プロジェクト: rrskybox/Humason
        public FormPlan()
        {
            InitializeComponent();

            PlanTargetBox.Text = FormHumason.fTargetForm.TargetBox.Text;
            NHUtil.ButtonGreen(AcquireButton);
            NHUtil.ButtonGreen(SelectButton);
            NHUtil.ButtonGreen(AdjustButton);
            NHUtil.ButtonGreen(MosaicButton);
            NHUtil.ButtonGreen(LoadPlanButton);
            NHUtil.ButtonGreen(ImageForecastButton);
            LoadTargetPlanList();
        }
コード例 #20
0
ファイル: FormRotate.cs プロジェクト: rrskybox/Humason
        private void RotateToIPAButton_Click(object sender, EventArgs e)
        {
            NHUtil.ButtonRed(RotateToIPAButton);
            DisplayResults();
            double rotate = (double)MoveToIPANum.Value;

            if (Rotator.RotateToImagePA(rotate))
            {
                DisplayResults();
            }
            NHUtil.ButtonGreen(RotateToIPAButton);
            return;
        }
コード例 #21
0
ファイル: FormRotate.cs プロジェクト: rrskybox/Humason
        private void InitializeButton_Click(object sender, EventArgs e)
        {
            //Get location and PA of FOV on chart
            NHUtil.ButtonRed(InitializeButton);
            LogEvent lg = new LogEvent();

            DisplayResults();
            Show();
            Rotator.CalibrateRotator();
            DisplayResults();
            Show();
            NHUtil.ButtonGreen(InitializeButton);
            return;
        }
コード例 #22
0
ファイル: FormPlan.cs プロジェクト: rrskybox/Humason
        private void FromTSXButton_Click(object sender, EventArgs e)
        {
            /* Method gets whatever target is showing in the find function in TSX
             * normally by using a click on a star chart object.  If no object has been
             * choosen (Mouse click position) or simply no target (null) then return
             * Otherwise, clear the spaces out of the name and check for characters (like ":")
             * that won't work in a file name.  If illegal characters, then return
             * Otherwise, find an existing or open new target plan for this target name
             * and make it the target plan for the current session
             */

            LogEvent       lg          = new LogEvent();
            SessionControl openSession = new SessionControl();

            //get the current target name from TSX and save it.
            NHUtil.ButtonRed(AcquireButton);
            //Retrieve current target from TSX
            TSXLink.Target tgt = TSXLink.StarChart.FindTarget();
            //Check to see if we're looking at a "Mouse Click Postion"
            //   if so, just get out of this
            if ((tgt.Name != "Mouse click position") && (tgt != null))
            {
                //Remove spaces from target name if any
                tgt.Name = tgt.Name.Replace(" ", "");
                //Remove known "illegal" characters
                if (tgt.Name.Contains(":"))
                {
                    lg.LogIt("Unsupported filename characters in target name " + tgt.Name);
                    MessageBox.Show("Unsupported characters in target name : " + tgt.Name);
                }
                else
                {
                    TargetPlan newtPlan = new TargetPlan(tgt.Name)
                    {
                        TargetAdjustEnabled = false,
                        TargetRA            = tgt.RA,
                        TargetDec           = tgt.Dec
                    };
                    newtPlan.TargetPA  = TSXLink.FOVI.GetFOVPA;
                    PlanTargetBox.Text = newtPlan.TargetName;
                    TSXLink.StarChart.SetFOV(2);
                    LoadTargetPlanList();
                    openSession.CurrentTargetName = newtPlan.TargetName;
                    lg.LogIt("A new target plan has been created for " + newtPlan.TargetName);
                }
            }
            NHUtil.ButtonGreen(AcquireButton);
            this.Show();
        }
コード例 #23
0
ファイル: FormAutoFocus.cs プロジェクト: rrskybox/Humason
        private void AtFocus2Button_Click(object sender, EventArgs e)
        {
            //Execute TSX_AutoFocus class
            //  Save current object information
            //  Open and connect Autofocus
            //  Run Focus@2 for all five filters
            //  Save datepoints
            //  Turn on temperature compensation
            //  Return telescope to object with CloseLoopSlew

            NHUtil.ButtonRed(AtFocus2Button);
            AutoFocus.FocusIt(2);
            NHUtil.ButtonGreen(AtFocus2Button);
            return;
        }
コード例 #24
0
ファイル: FormPlan.cs プロジェクト: rrskybox/Humason
        private void ImageForecastButton_Click(object sender, EventArgs e)
        {
            //Launches ImageForecast to create target plans
            NHUtil.ButtonRed(ImageForecastButton);
            string  toolName   = "Image Planner.appref-ms";
            string  ttdir      = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Microsoft\\Windows\\Start Menu\\Programs\\TSXToolkit\\TSXToolkit";
            Process pSystemExe = new Process();
            string  ifbPath    = ttdir + "\\" + toolName;

            pSystemExe.StartInfo.FileName = ifbPath;
            if (System.IO.File.Exists(ifbPath))
            {
                pSystemExe.Start();
            }
            NHUtil.ButtonGreen(ImageForecastButton);
        }
コード例 #25
0
ファイル: FormHumason.cs プロジェクト: rrskybox/Humason
        private void DisconnectButton_Click(object sender, EventArgs e)
        {
            LogEvent lg = new LogEvent();

            NHUtil.ButtonRed(DisconnectButton);
            lg.LogIt("Disconnecting");
            if (ParkMountCheckBox.Checked)
            {
                lg.LogIt("Parking mount");
                TSXLink.Connection.SecureMount();
                ParkMountCheckBox.Checked = false;
            }
            TSXLink.Connection.DisconnectAllDevices();
            NHUtil.ButtonGreen(DisconnectButton);
            return;
        }
コード例 #26
0
        public FormTarget()
        {
            //Build form
            InitializeComponent();
            //Initialize from/to configuration file
            SBInitialConfiguration();
            //Create default sequence
            imgseq = new Sequencer();
            //Subscribe this form to the log event
            ProgressEvent prgEvent = new ProgressEvent();

            prgEvent.ProgressUpdateEventHandler += ProgressUpdate_Handler;
            //Set command button colors
            NHUtil.ButtonGreen(UpdateButton);
            NHUtil.ButtonGreen(SaveDefaultButton);
            //Add the method for handling target reset events to the queue of such handlers (if any others.._
            targetreset.TargetEventHandler += TargetResetEvent_Handler;
        }
コード例 #27
0
ファイル: FormRotate.cs プロジェクト: rrskybox/Humason
        private void PlateSolveButton_Click(object sender, EventArgs e)
        {
            //Run a plate solve (image link) to determine the current rotator PA
            //Connect to camera.
            //Set autosave.
            //Take an image
            NHUtil.ButtonRed(PlateSolveButton);
            LogEvent lg = new LogEvent();

            if (!Rotator.PlateSolveIt())
            {
                NHUtil.ButtonGreen(PlateSolveButton);
                return;
            }
            DisplayResults();
            NHUtil.ButtonGreen(PlateSolveButton);
            return;
        }
コード例 #28
0
ファイル: FormRotate.cs プロジェクト: rrskybox/Humason
        private void TargetButton_Click(object sender, EventArgs e)
        {
            //POint telescope at target RA/Dec and rotate to PA
            //Slew scope to RA,Dec
            NHUtil.ButtonRed(TargetButton);
            SessionControl openSession = new SessionControl();
            TargetPlan     tPlan       = new TargetPlan(openSession.CurrentTargetName);

            TSXLink.StarChart.ChartRA  = tPlan.TargetRA;
            TSXLink.StarChart.ChartDec = tPlan.TargetDec;
            DisplayResults();
            if (Rotator.RotateToImagePA(tPlan.TargetPA))
            {
                DisplayResults();
            }
            NHUtil.ButtonGreen(TargetButton);
            return;
        }
コード例 #29
0
ファイル: FormFlats.cs プロジェクト: rrskybox/Humason
        private void FlatManOnButton_Click(object sender, EventArgs e)
        {
            SessionControl openSession = new SessionControl();
            SessionControl tplan       = openSession;

            if (NHUtil.IsButtonGreen(FlatManOnButton))
            {
                FlatMan flmn = new FlatMan();
                NHUtil.ButtonRed(FlatManOnButton);
                FlatManOnButton.Text = "Turn Off";
                flmn.Light           = true;
            }
            else
            {
                NHUtil.ButtonGreen(FlatManOnButton);
                FlatManOnButton.Text = "Turn On";
                FlatMan flmn = new FlatMan();
                flmn.Light = false;
            }
        }
コード例 #30
0
ファイル: FormHumason.cs プロジェクト: rrskybox/Humason
        private void StartButton_Click(object sender, EventArgs e)
        {
            NHUtil.ButtonRed(StartButton);
            StartButton.Text = "Running";
            SetRunning();
            //One can minimize TSX to help with performance, but don't
            //ManageTSX.MinimizeTSX();
            //Set the form to display the target tab
            HumasonTabs.SelectedIndex = 1;
            SessionState = SessionStateFlag.Running;
            //Light off the overall imaging control process
            bool successReport = Operations.ImagingControl();

            //All done
            //Clear the Running and Abort buttons
            StartButton.Text = "Start";
            NHUtil.ButtonGreen(StartButton);
            AbortButton.Text = "Stop";
            NHUtil.ButtonGreen(AbortButton);
        }