protected override void addItem() { if (validateSpecificItemAttributes(out object[] elements) && base.validateGeneralItemAttributes()) { this.watchType = (Watch.watchType)elements[0]; this.DialogResult = DialogResult.OK; this.Close(); } }
public bool validateSpecificItemAttributes(out object[] elements) { bool valid = true; uiSpecificItemAttributesErrorProvider.Clear(); elements = new object[1]; Watch.watchType?watchType = null; if (uiWatchTypeComboBox.SelectedIndex < 0) { uiSpecificItemAttributesErrorProvider.SetError(uiWatchTypeComboBox, "Please select watch type"); uiSpecificItemAttributesErrorProvider.SetIconPadding(uiWatchTypeComboBox, 10); valid = false; } else { watchType = (Watch.watchType)uiWatchTypeComboBox.SelectedItem; } elements[0] = watchType; return(valid); }