// public static bool ChooseCommandFromList(out NoteCommands command) { command = NoteCommands.eCmd_End; using (CommandChooser chooser = new CommandChooser()) { DialogResult result = chooser.ShowDialog(); command = chooser.acceptedCommand; return(chooser.accepted); } }
private void buttonOK_Click(object sender, EventArgs e) { if (listBoxCommands.SelectedIndex >= 0) { KeyValuePair <NoteCommands, string> entry = (KeyValuePair <NoteCommands, string>)listBoxCommands.SelectedItem; acceptedCommand = entry.Key; if (acceptedCommand != NoteCommands.eCmd_End) { accepted = true; } } Close(); }