private void getCodeInfoToolStripMenuItem_Click(object sender, EventArgs e) { try { MessageBox.Show(GCode.GetInfo(PromptBox.ShowDialog("Enter Command", "Enter Command Name"))); //MessageBox.Show(GCode.GetInfo("A")); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error"); } }
public static string ShowDialog(string text, string caption) { PromptBox prompt = new PromptBox(); prompt.label_text.Text = text; prompt.Text = caption; prompt.button_OK.Click += (sender, e) => { prompt.Close(); }; prompt.ShowDialog(); return(prompt.textBox_Input.Text); }
private void generateMachineCodeToolStripMenuItem_Click(object sender, EventArgs e) { string Code = PromptBox.ShowDialog("Enter GCode", "Enter GCode to convert to machine code"); switch (GCode.GetCode(Code)) { case "G00": G00 g0 = new G00(Code); break; case "G01": G01 g1 = new G01(Code); MessageBox.Show(g1.MachineCodeFromLocation(0, 0, 0)); break; default: throw new NotSupportedException("OpCode " + GCode.GetCode(Code) + " not supported"); } }