コード例 #1
0
        private void editButton_Click(object sender, EventArgs e)
        {
            logger.Info(Utilities.GetTimeStamp() + ": Edit Button Clicked");
            save_state = !save_state;

            formData.freeControlEnabled = save_state;
            if (!save_state)
            {
                editButton.Text               = "Edit Position";
                editButton.BackColor          = System.Drawing.Color.Red;
                freeControlGroupbox.BackColor = System.Drawing.Color.DarkGray;
                manualControlButton.BackColor = System.Drawing.Color.Red;
                decIncGroupbox.BackColor      = System.Drawing.Color.DarkGray;
                RAIncGroupbox.BackColor       = System.Drawing.Color.DarkGray;
                double newRA;
                double newDec;
                double.TryParse(TargetRATextBox.Text, out newRA);
                double.TryParse(TargetDecTextBox.Text, out newDec);
                Coordinate           new_coord        = new Coordinate(newRA, newDec);
                Entities.Orientation test_orientation = CoordCalc.CoordinateToOrientation(new_coord, DateTime.UtcNow);
                if (test_orientation.Azimuth >= 0 && test_orientation.Elevation >= 0)
                {
                    TargetCoordinate = new_coord;
                    CoordMove();
                }
                else
                {
                    errorLabel.Text = "Invalid Coordinate: orienation out of range";
                }
            }
            else
            {
                editButton.Text = "Save Position";
                manualControlButton.BackColor = System.Drawing.Color.DarkGray;
                editButton.BackColor          = System.Drawing.Color.LimeGreen;
                freeControlGroupbox.BackColor = System.Drawing.Color.Gainsboro;
                decIncGroupbox.BackColor      = System.Drawing.Color.Gray;
                RAIncGroupbox.BackColor       = System.Drawing.Color.Gray;
            }

            PosDecButton.Enabled      = save_state;
            NegDecButton.Enabled      = save_state;
            PosRAButton.Enabled       = save_state;
            NegRAButton.Enabled       = save_state;
            oneForthButton.Enabled    = save_state;
            oneForthButtonDec.Enabled = save_state;
            oneButton.Enabled         = save_state;
            oneButtonDec.Enabled      = save_state;
            fiveButton.Enabled        = save_state;
            fiveButtonDec.Enabled     = save_state;
            tenButton.Enabled         = save_state;
            tenButtonDec.Enabled      = save_state;
            TargetRATextBox.ReadOnly  = save_state;
            TargetDecTextBox.ReadOnly = save_state;

            manualControlButton.Enabled = !save_state;
        }
コード例 #2
0
        private void NegDecButton_Click(object sender, EventArgs e)
        {
            logger.Info("Negitive Declination Button Clicked");
            Coordinate new_coord = new Coordinate(TargetCoordinate.RightAscension, TargetCoordinate.Declination - Increment);

            Entities.Orientation test_orientation = CoordCalc.CoordinateToOrientation(new_coord, DateTime.UtcNow);
            if (test_orientation.Azimuth > 0 && test_orientation.Elevation > 0)
            {
                TargetCoordinate = new_coord;
                CoordMove();
            }
            else
            {
                errorLabel.Text = "Invalid Coordinate: orienation out of range";
            }
        }
コード例 #3
0
        private void PosRAButton_Click(object sender, EventArgs e)
        {
            logger.Info(Utilities.GetTimeStamp() + ": Positive Right Ascension Button Clicked");
            Coordinate new_coord = new Coordinate(TargetCoordinate.RightAscension + Increment, TargetCoordinate.Declination);

            Entities.Orientation test_orientation = CoordCalc.CoordinateToOrientation(new_coord, DateTime.UtcNow);
            if (test_orientation.Azimuth >= 0 && test_orientation.Elevation >= 0)
            {
                TargetCoordinate = new_coord;
                CoordMove();
            }
            else
            {
                errorLabel.Text = "Invalid Coordinate: orienation out of range";
            }
        }
コード例 #4
0
        private void editButton_Click(object sender, EventArgs e)
        {
            logger.Info("Edit Button Clicked");
            bool save_state = (editButton.Text == "Save Position");

            if (save_state)
            {
                editButton.Text = "Edit Position";
                double newRA;
                double newDec;
                double.TryParse(TargetRATextBox.Text, out newRA);
                double.TryParse(TargetDecTextBox.Text, out newDec);
                Coordinate           new_coord        = new Coordinate(newRA, newDec);
                Entities.Orientation test_orientation = CoordCalc.CoordinateToOrientation(new_coord, DateTime.UtcNow);
                if (test_orientation.Azimuth >= 0 && test_orientation.Elevation >= 0)
                {
                    TargetCoordinate = new_coord;
                    CoordMove();
                }
                else
                {
                    errorLabel.Text = "Invalid Coordinate: orienation out of range";
                }
            }
            else
            {
                editButton.Text = "Save Position";
            }

            PosDecButton.Enabled      = save_state;
            NegDecButton.Enabled      = save_state;
            PosRAButton.Enabled       = save_state;
            NegRAButton.Enabled       = save_state;
            CalibrateButton.Enabled   = save_state;
            TargetRATextBox.ReadOnly  = save_state;
            TargetDecTextBox.ReadOnly = save_state;
        }