private void removeSpecifier() { if (specifiers.Count == 0) { return; } SingleTableSpecifierPanel panel = specifiers[specifiers.Count - 1]; OracleTableViewForm form = oracleForms .Where(x => x.Name == string.Concat("oracleForm", panel.SpecifierId)) .FirstOrDefault(); if (form != null && form.Visible) { form.Hide(); } ComboBox cb = panel.Controls.Cast <Control>() .Where(y => y is ComboBox) .First() as ComboBox; this.Controls.Remove(panel); specifiers.Remove(panel); comboBoxes.Remove(cb); updateControls(oracleHandler.IsConnectionUp()); }
private void displayControl(SingleTableSpecifierPanel panel) { if (string.IsNullOrWhiteSpace(panel.TableName)) //not found { return; } OracleTableViewForm form = oracleForms .Where(x => x.Name == string.Concat("oracleForm", panel.SpecifierId)) .FirstOrDefault(); if (!panel.ViewChecked) { if (form != null) //while unchecked, only needs to do something when it is found { form.Hide(); } return; } if (form == null) //form does not exist, create a new form { form = new OracleTableViewForm(); form.Name = string.Concat("oracleForm", panel.SpecifierId); form.SetOracleHandler(oracleHandler); form.FormClosing += form_FormClosing; oracleForms.Add(form); } form.Text = string.Concat(form.OriginalTitle, " [", panel.SpecifierId, "] ", panel.TableName); form.DisplayTableResult(panel.TableName, panel.ColumnsClause, panel.WhereClause, panel.MaxRows, panel.IndexAdded); form.Show(); }