/// <summary> /// Invoke the editor /// </summary> /// <param name="qc">QueryColumn to edit</param> /// <returns></returns> public static bool Edit( QueryColumn qc) { //if (DebugMx.True) return CriteriaYesNo.Edit(qc); if (qc.MetaColumn.DictionaryMultipleSelect) { return(CriteriaDictMultSelect.Edit(qc)); } else if (Lex.Eq(qc.MetaColumn.Dictionary, "yes_no")) { return(CriteriaYesNo.Edit(qc)); } MetaColumn mc = qc.MetaColumn; if (Instance == null) { Instance = new CriteriaDialog(); } if (Instance.Visible) { return(false); // catch 2nd of two quick single-clicks & ignore } new JupyterGuiConverter().ConvertFormOrUserControl(Instance, true); Instance.Setup(qc); Instance.Qc = qc; Form activeForm = SessionManager.ActiveForm; DialogResult dr = Instance.ShowDialog(SessionManager.ActiveForm); if (activeForm != null) { activeForm.BringToFront(); } if (dr == DialogResult.OK) { return(true); } else { return(false); } }
public static bool Edit( QueryColumn qc) { AssertMx.IsNotNull(qc, "qc"); MetaColumn mc = qc.MetaColumn; if (Instance == null) { Instance = new CriteriaYesNo(); } new JupyterGuiConverter().ConvertFormOrUserControl(Instance); Instance.Text = "Search criteria for " + qc.ActiveLabel; Instance.Prompt.Text = "Select a search option for " + qc.ActiveLabel + " from the list below."; ParsedSingleCriteria psc = MqlUtil.ParseSingleCriteria(qc.Criteria); if (psc == null) { psc = new ParsedSingleCriteria(); // no criteria } if (Lex.Eq(psc.Value, "Y")) { Instance.YesCheckEdit.Checked = true; } else if (Lex.Eq(psc.Value, "N")) { Instance.NoCheckEdit.Checked = true; } else { Instance.None.Checked = true; } DialogResult dr = Instance.ShowDialog(SessionManager.ActiveForm); if (dr == DialogResult.OK) { if (Instance.YesCheckEdit.Checked) { qc.CriteriaDisplay = "= Y"; qc.Criteria = mc.Name + " = 'Y'"; } else if (Instance.NoCheckEdit.Checked) { qc.CriteriaDisplay = "= N"; qc.Criteria = mc.Name + " = 'N'"; } else if (Instance.None.Checked) { qc.CriteriaDisplay = ""; qc.Criteria = ""; } return(true); } else { return(false); } }