private void buttonValidators_Click(object sender, EventArgs e) { if (comboBoxType.SelectedItem != null) { var form = new ValidatorsForm(validators, (SupportedTypes)comboBoxType.SelectedItem, false, _serviceProvider); form.ShowDialog(); if (form.IsChanged) { validators = form.Validators; if (validators.Count > 0) { comboBoxType.Enabled = false; } else { comboBoxType.Enabled = true; } } } else { MessageBox.Show(Constants.TableSchemaForm.ChooseType); } }
private void ValidatorsButton_Click(object sender, EventArgs e) { var field = (Field)((Button)sender).Tag; var form = new ValidatorsForm(field.Validators, field.Type, true, _serviceProvider); form.ShowDialog(); }
private void ValidatorsButton_Click(object sender, EventArgs e) { var button = (Button)sender; var name = button.Name; var combobox = (ComboBox)tableLayoutPanelConditions.Controls.Find(name.Split('.').First() + "." + nameof(ComboBox), false).First(); var field = (Field)combobox.SelectedItem; var validators = SelectConditions.Validators.ContainsKey(field.Name) ? SelectConditions.Validators[field.Name] : new List <DBMS_Core.Interfaces.IValidator>(); var form = new ValidatorsForm(validators, field.Type, false, _serviceProvider); form.ShowDialog(); if (form.IsChanged) { if (SelectConditions.Validators.ContainsKey(field.Name)) { SelectConditions.Validators[field.Name] = form.Validators; } else { SelectConditions.Validators.Add(field.Name, form.Validators); } if (form.Validators.Count > 0) { combobox.Enabled = false; } else { combobox.Enabled = true; } } }