Esempio n. 1
0
        //public static LogEvent lg;

        public FormHumason()
        {
            settings = new Properties.Settings();

            InitializingHumason = true;

            InitializeComponent();
            ColorButtonsGreen();

            //Event Handlers
            //Add the method for handling target reset events to the queue of such handlers (if any others.._
            //AbortEvent ag = new AbortEvent();
            //ag.AbortEventHandler += AbortReportEvent_Handler;

            //Add log event generator
            StatusReportEvent = new LogEvent();
            StatusReportEvent.LogEventHandler += LogReportUpdate_Handler;

            //Open session and default target xml data
            SessionControl openSession = new SessionControl();
            TargetPlan     dtPlan      = new TargetPlan("Default");

            openSession.DefaultTargetPlanPath = dtPlan.DefaultPlanPath;

            //Initialize tab forms
            fSessionForm = new FormSessionControl {
                TopLevel = false
            };
            SessionTab.Controls.Add(fSessionForm);
            fSessionForm.Show();

            fTargetForm = new FormTarget {
                TopLevel = false
            };
            TargetTab.Controls.Add(fTargetForm);
            fTargetForm.Show();

            fDeviceForm = new FormDevices {
                TopLevel = false
            };
            DevicesTab.Controls.Add(fDeviceForm);
            fDeviceForm.Show();

            fFlatsForm = new FormFlats {
                TopLevel = false
            };
            FlatsTab.Controls.Add(fFlatsForm);
            fFlatsForm.Show();

            fGuideForm = new FormAutoGuide {
                TopLevel = false
            };
            GuideTab.Controls.Add(fGuideForm);
            fGuideForm.Show();

            fFocusForm = new FormAutoFocus {
                TopLevel = false
            };
            FocusTab.Controls.Add(fFocusForm);
            fFocusForm.Show();

            if (settings.RotatorDeviceEnabled)
            {
                fRotateForm = new FormRotate {
                    TopLevel = false
                };
                RotatorTab.Controls.Add(fRotateForm);
                fRotateForm.Show();
            }
            else
            {
                HumasonTabs.TabPages.Remove(RotatorTab);
            }

            fPlanForm = new FormPlan {
                TopLevel = false
            };
            PlanTab.Controls.Add(fPlanForm);
            fPlanForm.Show();

            if (settings.HasDomeAddOn)
            {
                fDomeForm = new FormDome {
                    TopLevel = false
                };
                DomeTab.Controls.Add(fDomeForm);
                fDomeForm.Show();
            }
            else
            {
                HumasonTabs.TabPages.Remove(DomeTab);
            }

            //Open log and subscribe this form to the log event
            StatusReportEvent.CreateLog();

            // Acquire the version information and put it in the form header
            try { this.Text = ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(); }
            catch { this.Text = " in Debug"; } //probably in debug, no version info available
            this.Text = "Humason V" + this.Text;
            // Place initial inforamtion in Log
            StatusReportEvent.LogIt("********* New Humason Run **********\r\n");
            StatusReportEvent.LogIt("* " + this.Text + "  " + DateTime.Now.ToShortDateString() + " **" + "\r\n");
            StatusReportEvent.LogIt("******* Humason Initialized ********");
            // All done with initialization
            InitializingHumason = false;
            TopMost             = true;
        }