//globalVars Globals = new globalVars(); private void commandOptions(int a) { InputDialog dialog = new InputDialog(); InputCombo frmDir = new InputCombo(); speedSelect spdSel = new speedSelect(); // globalVars.robotName = txtRobotName.Text;//has to be replaced by something getting the robots name thru http request string nameIn = "abc"; switch (a) { case 0: { if (dialog.ShowDialog(this) == DialogResult.OK) { if (dialog.Value.Equals("")) { MessageBox.Show("Please enter a valid name for the bot"); } else { nameIn = dialog.Value.ToString(); globalVars.robotCommand = globalVars.robotName + " rename to " + nameIn; } } else if (dialog.DialogResult == DialogResult.Cancel) { RobotPie.ActiveForm.Activate(); } } break; case 1: { GoTo frmGoTo = new GoTo(); frmGoTo.Show(); } break; case 2: { if (frmDir.ShowDialog(this) == DialogResult.OK) { if (frmDir.Value.Equals("") || frmDir.Value.Equals("Please Select Direction to Face")) { MessageBox.Show("Please Choose a valid Direction to face"); } else { string faceDirection = frmDir.Value; globalVars.robotCommand = globalVars.robotName + " face " + faceDirection.ToLower(); MessageBox.Show(globalVars.robotCommand); } } else if (frmDir.DialogResult == DialogResult.Cancel) { RobotPie.ActiveForm.Activate(); } } break; case 3: { drop frmdropObj = new drop(); frmdropObj.Show(); } break; case 4: { if (spdSel.ShowDialog(this) == DialogResult.OK) { if (spdSel.Value.Equals("") || spdSel.Value.Equals("Please Select the speed")) { MessageBox.Show("Please Choose a valid speed to assign"); } else { string speedVal = spdSel.Value.ToString(); globalVars.robotCommand = globalVars.robotName + " speed " + speedVal.ToLower(); MessageBox.Show(globalVars.robotCommand); } } else if (spdSel.DialogResult == DialogResult.Cancel) { RobotPie.ActiveForm.Activate(); } } break; case 5: { grab frmGrab = new grab(); frmGrab.Show(); } break; } }
private void commandOptions(int a) //command central which houses all commands executed when a button is clicked on the pie! { InputDialog dialog = new InputDialog(); InputCombo frmDir = new InputCombo(); speedSelect spdSel = new speedSelect(); string nameIn = "abc"; switch (a) { case 0: //rename { if (dialog.ShowDialog(this) == DialogResult.OK) { if (dialog.Value.Equals("")) { MessageBox.Show("Please enter a valid name for the bot"); } else { nameIn = dialog.Value.ToString(); globalVars.robotCommand = globalVars.robotName + " rename to " + nameIn; } } else if (dialog.DialogResult == DialogResult.Cancel) { RobotPie.ActiveForm.Activate(); } } break; case 1: //Go to location { GoTo frmGoTo = new GoTo(); frmGoTo.Show(); } break; case 2: //Change facing direction { if (frmDir.ShowDialog(this) == DialogResult.OK) { if (frmDir.Value.Equals("") || frmDir.Value.Equals("Please Select Direction to Face")) { MessageBox.Show("Please Choose a valid Direction to face"); } else { string faceDirection = frmDir.Value; globalVars.robotCommand = globalVars.robotName + " face " + faceDirection.ToLower(); MessageBox.Show(globalVars.robotCommand); } } else if (frmDir.DialogResult == DialogResult.Cancel) { RobotPie.ActiveForm.Activate(); } } break; case 3: //Drop { drop frmdropObj = new drop(); frmdropObj.Show(); } break; case 4: //Select Speed { if (spdSel.ShowDialog(this) == DialogResult.OK) { if (spdSel.Value.Equals("") || spdSel.Value.Equals("Please Select the speed")) { MessageBox.Show("Please Choose a valid speed to assign"); } else { string speedVal = spdSel.Value.ToString(); globalVars.robotCommand = globalVars.robotName + " speed " + speedVal.ToLower(); MessageBox.Show(globalVars.robotCommand); } } else if (spdSel.DialogResult == DialogResult.Cancel) { RobotPie.ActiveForm.Activate(); } } break; case 5: //grab object { grab frmGrab = new grab(); frmGrab.Show(); } break; } }