コード例 #1
0
 protected override void addItem()
 {
     if (validateSpecificItemAttributes(out object[] elements) && base.validateGeneralItemAttributes())
     {
         this.watchType    = (Watch.watchType)elements[0];
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
 }
コード例 #2
0
        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);
        }