Exemplo n.º 1
0
        //---------------------------------------BEGIN HOUSEKEEPING----------------------------------------
        public void housekeeping()
        {
            if (GV.debug == false)
            {
                this.Controls["savePackPanel"].Controls["testButton"].Hide();
            }
            if (GV.debug == true)
            {
                AllocConsole();
            }

            //this segment gets the location of where the text file will be saved
            textFilePath = System.Reflection.Assembly.GetEntryAssembly().Location;
            string temp = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
            textFilePath = textFilePath.Remove(textFilePath.Length - temp.Length - 4);

            missionPackage.MF = this;

            //-------------------------------------Begin top panel creation----------------------------
            GoalCreatorPanel goalCreatorPanel = new GoalCreatorPanel();
            goalCreatorPanel.Name = GV.goalCreatorPanelName;
            this.Controls.Add(goalCreatorPanel);

            GoalDetailPanel goalDetailPanel = new GoalDetailPanel();
            goalDetailPanel.Name = GV.goalDetailPanelName;
            this.Controls.Add(goalDetailPanel);

            MissionInfoPanel missionInfoPanel = new MissionInfoPanel();
            missionInfoPanel.Name = GV.missionInfoPanelName;
            this.Controls.Add(missionInfoPanel);

            MissionPackagePanel missionPackagePanel = new MissionPackagePanel();
            missionPackagePanel.Name = GV.missionPackagePanelName;
            this.Controls.Add(missionPackagePanel);

            AllMissionInfoPanel allMissionInfoPanel = new AllMissionInfoPanel();
            allMissionInfoPanel.Name = GV.allMissionInfoPanelName;
            this.Controls.Add(allMissionInfoPanel);
            //-------------------------------------End top panel creation----------------------------

            //-------------------------------------Begin bottom panel creation----------------------------
            int numberGoalTypes = GV.goalTypeList[0].GetLength(1);      //returns number of types of goals
            for (int i = 0; i < numberGoalTypes; i++)
            {

                Panel panel = new Panel();
                panel.Name = GV.goalTypeList[0][0, i];
                createPanel(panel, GV.goalTypeList[i + 1]);
                panel.Location = new Point(5, GV.detailPanelInitialY);
                this.Controls[GV.goalDetailPanelName].Controls.Add(panel);
                panel.Hide();
                panel.BackgroundImage = GV.goaLPanelImage;
                panel.BackgroundImageLayout = ImageLayout.Stretch;
                //panel.BackColor = GV.goalPanelColor;
                panel.BackColor = Color.Transparent;
                panel.SizeChanged += new EventHandler(panel_SizeChanged);
                //panel.VisibleChanged +=new EventHandler(panel_VisibleChanged);

                Label titleLabel = new Label();
                titleLabel.Text = GV.goalTypeList[0][0, i] + " Parameters";
                titleLabel.AutoSize = true;
                titleLabel.BackColor = Color.Transparent;
                titleLabel.Font = GV.titleFont;
                int titleLocationX = (GV.goalPanelHeight - TextRenderer.MeasureText(titleLabel.Text, titleLabel.Font).Width) / 2;
                titleLabel.Location = new Point(titleLocationX, 6);
                panel.Controls.Add(titleLabel);
            }

            //string[] t = GV.goalTypeList[0];

            //This code automatically turns the orbit radioButton on
            RadioButton rb = (RadioButton)goalCreatorPanel.Controls["orbitGoalRadioButton"];
            rb.Checked = true;
            rb.ForeColor = Color.Lime;

            for (int i = missionPackage.missionList.Count - 1; i >= 0; i--)
            {
                missionPackage.missionList.RemoveAt(i);
            }
            missionPackage.addMission();

            //This segment does final preparations for stuff
            exceptionObjectHandling();

            missionPackage.changeActiveMission(0);
            missionPackage.clearAllFields();
            missionPackage.populateGoalPanels();
        }
Exemplo n.º 2
0
        public GoalPanel(MissionInfoPanel P)
        {
            this.Size = new Size(260, 85);
            this.BackColor = GV.activeGoalColor;
            this.MouseDown += new MouseEventHandler(panel_mouseDown);
            this.MouseMove +=new MouseEventHandler(panel_mouseMove);
            this.MouseUp +=new MouseEventHandler(panel_mouseUp);
            this.AllowDrop = false;

            parent = P;
            this.Location = P.panelStartingLocation;

            Label goalTypeLabel = new Label();
            goalTypeLabel.Name = "goalTypeLabel";
            goalTypeLabel.Text = "Orbit";
            goalTypeLabel.BackColor = Color.Transparent;
            goalTypeLabel.AutoSize = true;
            goalTypeLabel.Location = new Point(9, 9);
            goalTypeLabel.Font = GV.generalFont;
            goalTypeLabel.MouseDown += new MouseEventHandler(panel_mouseDown);
            goalTypeLabel.MouseMove += new MouseEventHandler(panel_mouseMove);
            this.Controls.Add(goalTypeLabel);

            Label rewardLabel = new Label();
            rewardLabel.Name = "rewardLabel";
            rewardLabel.AutoSize = true;
            rewardLabel.Location = new Point(120 - rewardLabel.PreferredWidth / 2, 65);
            rewardLabel.TextAlign = (ContentAlignment)HorizontalAlignment.Center;
            rewardLabel.Font = GV.generalFont;
            rewardLabel.MouseDown += new MouseEventHandler(panel_mouseDown);
            rewardLabel.MouseMove += new MouseEventHandler(panel_mouseMove);
            rewardLabel.Text = "0 K";
            rewardLabel.MaximumSize = new Size(100, 50);
            this.Controls.Add(rewardLabel);
            rewardLabel.BringToFront();

            //need to give icon up arrow
            Button upButton = new Button();
            upButton.Name = "goalUpButton";
            upButton.Location = new Point(226, 30);
            upButton.Size = new Size(25, 25);
            upButton.Font = GV.generalFont;
            upButton.Click += new EventHandler(goalChange_Click);
            upButton.BackgroundImage = GV.upArrowIcon;
            upButton.BackgroundImageLayout = ImageLayout.Stretch;
            upButton.BackColor = Color.Transparent;
            this.Controls.Add(upButton);
            upButton.BringToFront();

            //need to give this down arrow Icon
            Button downButton = new Button();
            downButton.Name = "goalDownButton";
            downButton.Location = new Point(226, 57);
            downButton.Size = new Size(25, 25);
            downButton.Font = GV.generalFont;
            downButton.Click += new EventHandler(goalChange_Click);
            downButton.BackgroundImage = GV.downArrowIcon;
            downButton.BackgroundImageLayout = ImageLayout.Stretch;
            downButton.BackColor = Color.Transparent;
            this.Controls.Add(downButton);
            downButton.BringToFront();

            Button removeButton = new Button();
            removeButton.Name = "removeButton";
            removeButton.Location = new Point(226, 5);
            removeButton.Size = new Size(25, 25);
            removeButton.Font = GV.generalFont;
            removeButton.Click += new EventHandler(removeGoal_Click);
            removeButton.BackgroundImage = GV.removeIcon;
            removeButton.BackgroundImageLayout = ImageLayout.Stretch;
            removeButton.BackColor = Color.Transparent;
            this.Controls.Add(removeButton);
            removeButton.BringToFront();
        }