private void mnuDriveModeDefaultsTurn_Click(object sender, EventArgs e) { // Lock the form to prevent multiple calls LockForm(true); Keypad frmKeypad; // Show the keypad frmKeypad = new Keypad("Degrees", this); frmKeypad.Show(); // Wait until the keypad has returned while (!bolKeypadReturn) { // Waste time Application.DoEvents(); System.Threading.Thread.Sleep(50); } // Add the command if (intKeypadReturn > 0) { intDriveSimpleTurnDefault = intKeypadReturn; mnuDriveModeDefaultsTurn.Text = "Turn - " + intDriveSimpleTurnDefault.ToString(); } // Reset the Keypad return bolKeypadReturn = false; intKeypadReturn = 0; // Unlock the form LockForm(false); }
private void ProcessDriveCommand(string Command) { // Lock the form to prevent multiple calls LockForm(true); Keypad frmKeypad; // Show the keypad if applicable switch (Command) { case "Forward": case "Back": frmKeypad = new Keypad("Length", this); frmKeypad.Show(); break; case "Left" : case "Right" : if (bolDriveModeAdvanced) { frmKeypad = new Keypad("Degrees", this); frmKeypad.Show(); } else { bolKeypadReturn = true; intKeypadReturn = intDriveSimpleTurnDefault; } break; case "Speed" : frmKeypad = new Keypad("cm/s", this, 10,50); frmKeypad.Show(); break; case "Wait": frmKeypad = new Keypad("Secs", this,0,10); frmKeypad.Show(); break; default : bolKeypadReturn = true; intKeypadReturn = -2; break; } // Wait until the keypad has returned while (!bolKeypadReturn) { // Waste time Application.DoEvents(); System.Threading.Thread.Sleep(50); } // Add the command if (intKeypadReturn == -2) { AddDriveCommand(Command); } else if (intKeypadReturn > 0) { AddDriveCommand(Command + " - " + intKeypadReturn.ToString()); } // Reset the Keypad return bolKeypadReturn = false; intKeypadReturn = 0; // Unlock the form LockForm(false); }
private void lstDrive_DoubleClick(object sender, EventArgs e) { LockForm(true); string Command = lstDrive.SelectedItem.ToString(); Parser parse = new Parser(); string Argument = parse.GetDriveArgument(Command); Keypad key = new Keypad("TBC", int.Parse(Argument), this); key.Show(); // Wait until the keypad has returned while (!bolKeypadReturn) { // Waste time Application.DoEvents(); System.Threading.Thread.Sleep(50); } // Reset the Keypad return bolKeypadReturn = false; intKeypadReturn = 0; // Unlock the form LockForm(false); }