//Constructor
 public RCPRadioButton(Mode mode,ref List<Syntax> syntaxlist)
 {
     this.Mode = mode;
     this.Name = mode.modeName;
     this.Text = mode.modeName;
     this.CheckedChanged += new EventHandler(RCPRadioButton_CheckedChanged);
     foreach (CmdItem cmditem in mode.CmdItem)
     {
         if (cmditem.cmditemType == "generalbutton")
         {
             this.cmditemList.Add(new RCPButton(cmditem, ref syntaxlist));
         }
         else if (cmditem.cmditemType == "onoffbutton")
         {
             this.cmditemList.Add(new RCPOnOffButton(cmditem, ref syntaxlist));
         }
         else if ((cmditem.cmditemType != "controllerbuttondown") || (cmditem.cmditemType != "controllerbuttonup") || (cmditem.cmditemType != "controllerbuttonleft") || (cmditem.cmditemType != "controllerbuttonright") || (cmditem.cmditemType != "controllerbuttonstop"))
         {
             bool added = false;
             foreach (Control control in cmditemlist)
             {
                 if (control.Name == cmditem.cmditemType)
                 {
                     ((RCPComboBox)control).CmdItemList.Add(cmditem);
                     ((RCPComboBox)control).RCPComboBoxSet();
                     added = true;
                 }
             }
             if (!added)
             {
                 RCPComboBox combobox = new RCPComboBox(ref syntaxlist);
                 combobox.Name = cmditem.cmditemType;
                 combobox.CmdItemList.Add(cmditem);
                 combobox.RCPComboBoxSet();
                 this.cmditemlist.Add(combobox);
             }
         }
         foreach (Parameter parameter in cmditem.Cmd.parameterList)
         {
             if (parameter.parameterValue == null)
             {
                 if (parameter.parameterType == "trackbar")
                 {
                     this.parameterList.Add(new RCPTrackbar(parameter));
                 }
                 else if (parameter.parameterType == "numericupdown")
                 {
                     this.parameterList.Add(new RCPNumericUpDown(parameter));
                 }
                 else if (parameter.parameterType == "textbox")
                 {
                     this.parameterList.Add(new RCPTextBox(parameter));
                 }
                 else
                 {
                     MessageBox.Show("Unknown parameter type: '" + parameter.parameterType +
                         "' connected on the next parameter: '" + parameter.parameterName +
                         "'!!\r\n\r\nClick OK to continue!", "Parameter Error");
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private Mode readMode(string modeID)
 {
     Mode mode = new Mode();
     List<object> values = new List<object>();
     values = dbReader(Cmdstring.mode(modeID), Cmdstring.mode_fieldlist);
     mode.modeID = Convert.ToInt32(values[0]);
     mode.modeName = values[1].ToString();
     mode.modeOrder = Convert.ToInt32(values[2]);
     mode.modeComment = values[3].ToString();
     return mode;
 }
 //Constructor
 public RCPControllerRadioButton(Mode mode, ref List<Syntax> syntaxlist)
 {
     this.Mode = mode;
     this.Name = Mode.modeName;
     this.Text = Mode.modeName;
     this.CheckedChanged += new EventHandler(RCPControllerRadioButton_CheckedChanged);
     foreach (CmdItem cmditem in mode.CmdItem)
     {
         this.cmditemList.Add(new RCPButton(cmditem, ref syntaxlist));
         foreach (Parameter parameter in cmditem.Cmd.parameterList)
         {
             if (parameter.parameterValue == null)
             {
                 if (parameter.parameterType == "trackbar")
                 {
                     this.parameterList.Add(new RCPTrackbar(parameter));
                 }
                 else if (parameter.parameterType == "numericupdown")
                 {
                     this.parameterList.Add(new RCPNumericUpDown(parameter));
                 }
                 else if (parameter.parameterType == "textbox")
                 {
                     this.parameterList.Add(new RCPTextBox(parameter));
                 }
                 else
                 {
                     MessageBox.Show("Unknown parameter type: '" + parameter.parameterType +
                         "' connected on the next parameter: '" + parameter.parameterName +
                         "'!!\r\n\r\nClick OK to continue!", "Parameter Error");
                 }
             }
         }
     }
 }