private void ModifyToolStripMenuItem_Click(object sender, EventArgs e) { if (currentConfiguration != null) { queryForm = new QueryConfigurationForm(); queryForm.SetQueryConfiguration(currentConfiguration); DialogResult result = queryForm.ShowDialog(); if (DialogResult.OK == result) { currentConfiguration = queryForm.GetQueryConfiguration(); if (currentConfiguration.Name.Equals(((IQueryConfiguration)cbxQueries.SelectedItem).Name)) { cbxQueries.Items.RemoveAt(cbxQueries.SelectedIndex); cbxQueries.Items.Add(currentConfiguration); } int index = configurations.FindLastIndex(x => x != null && x.Name.Equals(currentConfiguration)); if (index != -1) { configurations.RemoveAt(index); configurations.Insert(index, currentConfiguration); } else { configurations.Add(currentConfiguration); } } } else { MessageBox.Show("Primero seleccione una configuración valida"); } }
private void BtnCreateQuery_Click(object sender, EventArgs e) { queryForm = new QueryConfigurationForm(); DialogResult result = queryForm.ShowDialog(); if (DialogResult.OK == result) { currentConfiguration = queryForm.GetQueryConfiguration(); int index = configurations.FindLastIndex(x => x.Name.Equals(currentConfiguration)); IQueryConfiguration cloneConfiguration = (IQueryConfiguration)currentConfiguration.Clone(); configurations.Add(cloneConfiguration); cbxQueries.Items.Add(cloneConfiguration); cbxQueries.SelectedItem = cloneConfiguration; } }