Пример #1
0
        private void _cb_opcode_SelectedIndexChanged(object sender, EventArgs e)
        {
            //_gb_edit.Enabled = true;

            //ni.opcode = (NavigationInstruction.navigation_command)_cb_opcode.SelectedIndex;

            // already a navigationcommand on the panel? delete it so we can add a new one.
            if (tableLayoutPanel.Controls.Count > 0)
            {
                tableLayoutPanel.Controls.RemoveAt(tableLayoutPanel.Controls.Count - 1);
            }

            string directoryname = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Documentation";

            if (GluonCS.Properties.Settings.Default.Language == "Deutsch")
            {
                directoryname = directoryname + "\\de";
            }
            else
            {
                directoryname = directoryname + "\\en";
            }

            // Add the correct usercontrol
            Control c;

            if (_cb_opcode.Text == "CIRCLE")
            {
                webBrowser.Navigate(directoryname + "\\circle.html");
                c = new NavigationCommands.Circle(ni);
            }
            else if (_cb_opcode.Text.StartsWith("GOTO"))
            {
                webBrowser.Navigate(directoryname + "\\goto.html");
                c = new NavigationCommands.Goto(ni);
            }
            else if (_cb_opcode.Text.StartsWith("CALL"))
            {
                webBrowser.Navigate(directoryname + "\\call.html");
                c = new NavigationCommands.Call(ni);
            }
            else if (_cb_opcode.Text.StartsWith("RETURN"))
            {
                webBrowser.Navigate(directoryname + "\\return.html");
                c = new NavigationCommands.Return(ni);
            }
            else if (_cb_opcode.Text.StartsWith("CLIMB"))
            {
                webBrowser.Navigate(directoryname + "\\climb.html");
                c = new NavigationCommands.Climb(ni);
            }
            else if (_cb_opcode.Text.StartsWith("SERVO_SET"))
            {
                webBrowser.Navigate(directoryname + "\\servoset.html");
                c = new NavigationCommands.ServoSet(ni);
            }
            else if (_cb_opcode.Text.StartsWith("SERVO_TRIGGER_START"))
            {
                webBrowser.Navigate(directoryname + "\\servotriggerstart.html");
                c = new NavigationCommands.ServoStartTrigger(ni);
            }
            else if (_cb_opcode.Text.StartsWith("SERVO_TRIGGER_STOP"))
            {
                webBrowser.Navigate(directoryname + "\\servotriggerstop.html");
                c = new NavigationCommands.ServoStopTrigger(ni);
            }
            else if (_cb_opcode.Text.StartsWith("SERVO_TRIGGER"))
            {
                webBrowser.Navigate(directoryname + "\\servotrigger.html");
                c = new NavigationCommands.ServoTrigger(ni);
            }
            else if (_cb_opcode.Text.StartsWith("FLY_TO"))
            {
                webBrowser.Navigate(directoryname + "\\flyto.html");
                c = new NavigationCommands.FlyTo(ni);
            }
            else if (_cb_opcode.Text.StartsWith("FROM_TO"))
            {
                webBrowser.Navigate(directoryname + "\\fromto.html");
                c = new NavigationCommands.FromTo(ni);
            }
            else if (_cb_opcode.Text.StartsWith("FLARE_TO"))
            {
                webBrowser.Navigate(directoryname + "\\flareto.html");
                c = new NavigationCommands.FlareTo(ni);
            }
            else if (_cb_opcode.Text.StartsWith("GLIDE_TO"))
            {
                webBrowser.Navigate(directoryname + "\\glideto.html");
                c = new NavigationCommands.GlideTo(ni);
            }
            else if (_cb_opcode.Text.StartsWith("CIRCLE_TO"))
            {
                webBrowser.Navigate(directoryname + "\\circleto.html");
                c = new NavigationCommands.CircleTo(ni);
            }
            else if (_cb_opcode.Text.StartsWith("IF"))
            {
                webBrowser.Navigate(directoryname + "\\if.html");
                c = new NavigationCommands.If(ni);
            }
            else if (_cb_opcode.Text.StartsWith("UNTIL"))
            {
                webBrowser.Navigate(directoryname + "\\until.html");
                c = new NavigationCommands.Until(ni);
            }
            else if (_cb_opcode.Text.StartsWith("BLOCK"))
            {
                c = new NavigationCommands.Block(ni);
                webBrowser.Navigate(directoryname + "\\block.html");
            }
            else if (_cb_opcode.Text.StartsWith("SET_BATTERY_ALARM"))
            {
                c = new NavigationCommands.BattAlarm(ni);
                webBrowser.Navigate(directoryname + "\\setbatteryalarm.html");
            }
            else if (_cb_opcode.Text.StartsWith("EMPTY"))
            {
                c = new NavigationCommands.Empty(ni);
                webBrowser.Navigate(directoryname + "\\emptycmd.html");
            }
            else if (_cb_opcode.Text.StartsWith("SET_LOITER_POSITION"))
            {
                c = new NavigationCommands.SetLoiterPosition(ni);
                webBrowser.Navigate(directoryname + "\\setloiterposition.html");
            }
            else if (_cb_opcode.Text.StartsWith("LOITER_CIRCLE"))
            {
                c = new NavigationCommands.LoiterCircle(ni);
                webBrowser.Navigate(directoryname + "\\loitercircle.html");
            }
            else if (_cb_opcode.Text.StartsWith("SET_FLIGHTPLAN_SWITCH"))
            {
                c = new NavigationCommands.FlightplanSwitch(ni);
                webBrowser.Navigate(directoryname + "\\setflightplanswitch.html");
            }
            else if (_cb_opcode.Text.StartsWith("SET_MAXIMUM_RANGE"))
            {
                c = new NavigationCommands.SetMaximumRange(ni);
                webBrowser.Navigate(directoryname + "\\setmaximumrange.html");
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.FLY_TO_REL)
            {
                c = new NavigationCommands.FlyToRel(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.CIRCLE_ABS)
            {
                c = new NavigationCommands.CircleAbs(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.FLY_TO_ABS)
            {
                c = new NavigationCommands.FlyToAbs(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.FROM_TO_REL)
            {
                c = new NavigationCommands.FromToRel(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.FROM_TO_ABS)
            {
                c = new NavigationCommands.FromToAbs(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.UNTIL_GR)
            {
                c = new NavigationCommands.UntilGr(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.UNTIL_SM)
            {
                c = new NavigationCommands.UntilSm(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.UNTIL_EQ)
            {
                c = new NavigationCommands.UntilEq(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.UNTIL_NE)
            {
                c = new NavigationCommands.UntilNe(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.IF_GR)
            {
                c = new NavigationCommands.IfGr(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.IF_SM)
            {
                c = new NavigationCommands.IfSm(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.IF_EQ)
            {
                c = new NavigationCommands.IfEq(ni);
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.IF_NE)
            {
                c = new NavigationCommands.IfNe(ni);
            }
            else //if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.EMPTY)
            {
                webBrowser.Navigate(directoryname + "\\emptycmd.html");
                c = new NavigationCommands.Empty(ni);
            }

            // add our edit-control
            tableLayoutPanel.Controls.Add(c);
            tableLayoutPanel.SetCellPosition(c, new TableLayoutPanelCellPosition(0, 1));

            c.Anchor = AnchorStyles.None;
            //groupBox1.Height = tableLayoutPanel.Height + 30;
            //groupBox1.Width = tableLayoutPanel.Width + 20;
        }
        private void _cb_opcode_SelectedIndexChanged(object sender, EventArgs e)
        {
            //_gb_edit.Enabled = true;

            //ni.opcode = (NavigationInstruction.navigation_command)_cb_opcode.SelectedIndex;

            // already a navigationcommand on the panel? delete it so we can add a new one.
            if (tableLayoutPanel.Controls.Count > 0)
                tableLayoutPanel.Controls.RemoveAt(tableLayoutPanel.Controls.Count - 1);

            string directoryname = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Documentation";
            if (GluonCS.Properties.Settings.Default.Language == "Deutsch")
                directoryname = directoryname + "\\de";
            else
                directoryname = directoryname + "\\en";

            // Add the correct usercontrol
            Control c;
            if (_cb_opcode.Text == "CIRCLE")
            {
                webBrowser.Navigate(directoryname + "\\circle.html");
                c = new NavigationCommands.Circle(ni);
            }
            else if (_cb_opcode.Text.StartsWith("GOTO"))
            {
                webBrowser.Navigate(directoryname + "\\goto.html");
                c = new NavigationCommands.Goto(ni);
            }
            else if (_cb_opcode.Text.StartsWith("CALL"))
            {
                webBrowser.Navigate(directoryname + "\\call.html");
                c = new NavigationCommands.Call(ni);
            }
            else if (_cb_opcode.Text.StartsWith("RETURN"))
            {
                webBrowser.Navigate(directoryname + "\\return.html");
                c = new NavigationCommands.Return(ni);
            }
            else if (_cb_opcode.Text.StartsWith("CLIMB"))
            {
                webBrowser.Navigate(directoryname + "\\climb.html");
                c = new NavigationCommands.Climb(ni);
            }
            else if (_cb_opcode.Text.StartsWith("SERVO_SET"))
            {
                webBrowser.Navigate(directoryname + "\\servoset.html");
                c = new NavigationCommands.ServoSet(ni);
            }
            else if (_cb_opcode.Text.StartsWith("SERVO_TRIGGER_START"))
            {
                webBrowser.Navigate(directoryname + "\\servotriggerstart.html");
                c = new NavigationCommands.ServoStartTrigger(ni);
            }
            else if (_cb_opcode.Text.StartsWith("SERVO_TRIGGER_STOP"))
            {
                webBrowser.Navigate(directoryname + "\\servotriggerstop.html");
                c = new NavigationCommands.ServoStopTrigger(ni);
            }
            else if (_cb_opcode.Text.StartsWith("SERVO_TRIGGER"))
            {
                webBrowser.Navigate(directoryname + "\\servotrigger.html");
                c = new NavigationCommands.ServoTrigger(ni);
            }
            else if (_cb_opcode.Text.StartsWith("FLY_TO"))
            {
                webBrowser.Navigate(directoryname + "\\flyto.html");
                c = new NavigationCommands.FlyTo(ni);
            }
            else if (_cb_opcode.Text.StartsWith("FROM_TO"))
            {
                webBrowser.Navigate(directoryname + "\\fromto.html");
                c = new NavigationCommands.FromTo(ni);
            }
            else if (_cb_opcode.Text.StartsWith("FLARE_TO"))
            {
                webBrowser.Navigate(directoryname + "\\flareto.html");
                c = new NavigationCommands.FlareTo(ni);
            }
            else if (_cb_opcode.Text.StartsWith("GLIDE_TO"))
            {
                webBrowser.Navigate(directoryname + "\\glideto.html");
                c = new NavigationCommands.GlideTo(ni);
            }
            else if (_cb_opcode.Text.StartsWith("CIRCLE_TO"))
            {
                webBrowser.Navigate(directoryname + "\\circleto.html");
                c = new NavigationCommands.CircleTo(ni);
            }
            else if (_cb_opcode.Text.StartsWith("IF"))
            {
                webBrowser.Navigate(directoryname + "\\if.html");
                c = new NavigationCommands.If(ni);
            }
            else if (_cb_opcode.Text.StartsWith("UNTIL"))
            {
                webBrowser.Navigate(directoryname + "\\until.html");
                c = new NavigationCommands.Until(ni);
            }
            else if (_cb_opcode.Text.StartsWith("BLOCK"))
            {
                c = new NavigationCommands.Block(ni);
                webBrowser.Navigate(directoryname + "\\block.html");
            }
            else if (_cb_opcode.Text.StartsWith("SET_BATTERY_ALARM"))
            {
                c = new NavigationCommands.BattAlarm(ni);
                webBrowser.Navigate(directoryname + "\\setbatteryalarm.html");
            }
            else if (_cb_opcode.Text.StartsWith("EMPTY"))
            {
                c = new NavigationCommands.Empty(ni);
                webBrowser.Navigate(directoryname + "\\emptycmd.html");
            }
            else if (_cb_opcode.Text.StartsWith("SET_LOITER_POSITION"))
            {
                c = new NavigationCommands.SetLoiterPosition(ni);
                webBrowser.Navigate(directoryname + "\\setloiterposition.html");
            }
            else if (_cb_opcode.Text.StartsWith("LOITER_CIRCLE"))
            {
                c = new NavigationCommands.LoiterCircle(ni);
                webBrowser.Navigate(directoryname + "\\loitercircle.html");
            }
            else if (_cb_opcode.Text.StartsWith("SET_FLIGHTPLAN_SWITCH"))
            {
                c = new NavigationCommands.FlightplanSwitch(ni);
                webBrowser.Navigate(directoryname + "\\setflightplanswitch.html");
            }
            else if (_cb_opcode.Text.StartsWith("SET_MAXIMUM_RANGE"))
            {
                c = new NavigationCommands.SetMaximumRange(ni);
                webBrowser.Navigate(directoryname + "\\setmaximumrange.html");
            }
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.FLY_TO_REL)
                c = new NavigationCommands.FlyToRel(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.CIRCLE_ABS)
                c = new NavigationCommands.CircleAbs(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.FLY_TO_ABS)
                c = new NavigationCommands.FlyToAbs(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.FROM_TO_REL)
                c = new NavigationCommands.FromToRel(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.FROM_TO_ABS)
                c = new NavigationCommands.FromToAbs(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.UNTIL_GR)
                c = new NavigationCommands.UntilGr(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.UNTIL_SM)
                c = new NavigationCommands.UntilSm(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.UNTIL_EQ)
                c = new NavigationCommands.UntilEq(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.UNTIL_NE)
                c = new NavigationCommands.UntilNe(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.IF_GR)
                c = new NavigationCommands.IfGr(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.IF_SM)
                c = new NavigationCommands.IfSm(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.IF_EQ)
                c = new NavigationCommands.IfEq(ni);
            else if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.IF_NE)
                c = new NavigationCommands.IfNe(ni);
            else //if (_cb_opcode.SelectedIndex == (int)NavigationInstruction.navigation_command.EMPTY)
            {
                webBrowser.Navigate(directoryname + "\\emptycmd.html");
                c = new NavigationCommands.Empty(ni);
            }

            // add our edit-control
            tableLayoutPanel.Controls.Add(c);
            tableLayoutPanel.SetCellPosition(c, new TableLayoutPanelCellPosition(0, 1));

            c.Anchor = AnchorStyles.None;
            //groupBox1.Height = tableLayoutPanel.Height + 30;
            //groupBox1.Width = tableLayoutPanel.Width + 20;
        }