예제 #1
0
        private void DeleteTargetPlanButton_Click(Object sender, EventArgs e)  // Handles DeleteTargetPlanButton.Click
        {
            ButtonRed(DeleteTargetPlanButton);
            //Delete the Humason configuration file with this target name
            XFiles xfn     = new XFiles();
            string tgtName = ImagePlannerTargetList.SelectedItem.ToString();

            xfn.DeletePlan(tgtName);
            //clear current target list box and reload
            ImagePlannerTargetList.Items.Clear();;
            //Fill in Humason target plans
            XFiles        xf      = new XFiles();
            List <string> tgtList = xf.GetTargetFiles();

            foreach (string tgt in tgtList)
            {
                if (!(tgt.Contains("Default")))
                {
                    ImagePlannerTargetList.Items.Add(tgt);
                }
            }
            if (ImagePlannerTargetList.Items.Count > 0)
            {
                ImagePlannerTargetList.SelectedItem = ImagePlannerTargetList.Items[0];
            }
            ButtonGreen(DeleteTargetPlanButton);
            return;
        }
예제 #2
0
        public FormImagePlanner()
        {
            InitializeComponent();

            SelectionEnabled = false;
            ButtonGreen(DetailsButton);
            ButtonGreen(AltitudeButton);
            ButtonGreen(PreviewButton);
            ButtonGreen(AddTargetPlanButton);
            ButtonGreen(DeleteTargetPlanButton);
            ButtonGreen(PrintButton);
            ButtonGreen(DoneButton);
            ButtonGreen(InfoButton);
            ButtonGreen(ProspectButton);
            ButtonGreen(AssessButton);
            ButtonGreen(TrackButton);

            this.FontHeight        = 1;
            MonthCalendar.RowCount = 31;
            for (int i = 0; i <= 30; i++)
            {
                MonthCalendar.Rows[i].HeaderCell.Value = (i + 1).ToString();
            }

            //Compute current dates based on TSX star chart julian date
            //  this allows star charts to be in different locations and time zones
            //  as set up by user
            sky6StarChart tsxsc = new sky6StarChart();

            //Get the star chart julian date and convert to current date/time
            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_JulianDateNow);
            DateTime dateTSXutc = AstroMath.Celestial.JulianToDate(tsxsc.DocPropOut);

            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_Time_Zone);
            double tzTSX = tsxsc.DocPropOut;

            tsxsc.DocumentProperty(Sk6DocumentProperty.sk6DocProp_DaylightSavingTimeIndex);
            double   tzIndexTSX = tsxsc.DocPropOut;
            DateTime dateTSX    = dateTSXutc.AddHours(tzTSX + tzIndexTSX);

            CurrentYearPick.Value = dateTSX.Year;
            GenerateCalendar();
            Show();
            System.Windows.Forms.Application.DoEvents();
            SelectionEnabled = true;
            //Figure out the year and load it into the year box
            string thisyear = dateTSX.ToString("yyyy");

            CurrentYearPick.Value = Convert.ToInt16(thisyear);
            //Pick the current date as the selected cell
            SelectedDate = dateTSX;
            int jCol = dateTSX.Month - 1;
            int iRow = dateTSX.Day - 1;

            MonthCalendar.Rows[iRow].Cells[jCol].Selected = true;

            //Fill in Humason target plans
            XFiles xf = new XFiles();

            if (xf != null)
            {
                List <string> tgtList = xf.GetTargetFiles();
                foreach (string tgt in tgtList)
                {
                    if (!(tgt.Contains("Default")))
                    {
                        ImagePlannerTargetList.Items.Add(tgt);
                    }
                }
                if (ImagePlannerTargetList.Items.Count > 0)
                {
                    ImagePlannerTargetList.SelectedItem = ImagePlannerTargetList.Items[0];
                }
            }
            QPUpdate.WazzupEventHandler += WazzupEvent_Handler;

            return;
        }
예제 #3
0
        private void AddTargetPlanButton_Click(Object sender, EventArgs e)  // Handles AddTargetPlanButton.Click
        {
            ButtonRed(AddTargetPlanButton);
            //Save a new Humason configuration file with this target name, RA and Dec and about nothing else

            string tgtName = TargetNameBox.Text;

            sky6StarChart         tsxs = new sky6StarChart();
            sky6ObjectInformation tsxo = new sky6ObjectInformation();

            //if (the object is not found, just return
            try
            {
                tsxs.Find(tgtName);
            }
            catch
            {
                ButtonGreen(AddTargetPlanButton);
                return;
            }
            int cnt = tsxo.Count;

            tsxo.Index = 0;
            tsxo.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_RA_2000);
            double dRA = tsxo.ObjInfoPropOut;

            tsxo.Property(TheSky64Lib.Sk6ObjectInformationProperty.sk6ObjInfoProp_DEC_2000);
            double dDec = tsxo.ObjInfoPropOut;

            XFiles xfn = new XFiles(tgtName);

            if (xfn != null)
            {
                xfn.ReplaceItem(XFiles.sbTargetNameName, tgtName);
                xfn.ReplaceItem(XFiles.sbTargetAdjustCheckedName, false);
                xfn.ReplaceItem(XFiles.sbTargetRAName, dRA);
                xfn.ReplaceItem(XFiles.sbTargetDecName, dDec);
                xfn.SavePlan(tgtName);
            }
            //clear current target list box and reload
            ImagePlannerTargetList.Items.Clear();
            //Fill in Humason target plans
            XFiles        xf      = new XFiles();
            List <string> tgtList = xf.GetTargetFiles();

            foreach (string tgt in tgtList)
            {
                if (!(tgt.Contains("Default")))
                {
                    ImagePlannerTargetList.Items.Add(tgt);
                }
            }
            foreach (string tgt in ImagePlannerTargetList.Items)
            {
                if (tgt == tgtName)
                {
                    ImagePlannerTargetList.SelectedItem = tgt;
                }
            }
            ButtonGreen(AddTargetPlanButton);
            return;
        }