public ICommand CreateCommand() { using (CreateObjectCollectionDialog dlg = new CreateObjectCollectionDialog(parent)) { bool showAgain = false; DialogResult result; do { result = dlg.ShowDialog(); showAgain = false; if (result == DialogResult.OK) { // do validation here // if validation fails, set showAgain to true showAgain = ((result == DialogResult.OK) && (!dlg.OkButton_Validate())); } else { if (result == DialogResult.Cancel) { return null; } } } while (showAgain); return new CreateWorldCollectionCommand(app, ((IWorldContainer)parent), dlg.NameTextBoxText); } }
public ICommand CreateCommand() { using (CreateObjectCollectionDialog dlg = new CreateObjectCollectionDialog(parent)) { bool showAgain = false; DialogResult result; do { result = dlg.ShowDialog(); showAgain = false; if (result == DialogResult.OK) { // do validation here // if validation fails, set showAgain to true showAgain = ((result == DialogResult.OK) && (!dlg.OkButton_Validate())); } else { if (result == DialogResult.Cancel) { return(null); } } } while (showAgain); return(new CreateWorldCollectionCommand(app, ((IWorldContainer)parent), dlg.NameTextBoxText)); } }