public static DialogResult Show(Exception ex, string errMsg = null, string title = null, string btnYesText = "Yes", string btnNoText = "No") { ChoMessageBox frm = new ChoMessageBox(ex, errMsg, title); if (!btnNoText.IsNullOrWhiteSpace()) { frm.btnNo.Text = btnNoText; frm.btnNo.Visible = true; } else { frm.btnNo.Visible = false; } if (!btnYesText.IsNullOrWhiteSpace()) { frm.btnYes.Text = btnYesText; frm.btnYes.Visible = true; } else { frm.btnYes.Visible = false; } return(frm.ShowDialog()); }
private void btnEval_Click(object sender, EventArgs e) { txtOutput.Text = null; try { string t = txtExpr.Text; if (t.IsNullOrWhiteSpace()) { return; } string ctx = txtContextInfo.Text; ChoExprEvaluateEventArgs args = new ChoExprEvaluateEventArgs(); args.ExprText = t; args.ContextText = ctx; args.SingleExpr = chkSingleExpr.Checked; Evaluate.Raise(this, args); if (chkSingleExpr.Checked) { if (!args.Handled) { txtOutput.Text = args.ExprText.ExpandProperties(args.ContextText); } else { txtOutput.Text = args.ContextText; } } else { if (!args.Handled) { txtOutput.Text = args.ExprText.SplitNExpandProperties(args.ContextText); } else { txtOutput.Text = args.ContextText; } } } catch (Exception ex) { ChoMessageBox.Show(ex, "Error evaluating expression.", this.Text, "OK", null); } }
public static DialogResult Show(string detailErrMsg, string errMsg = null, string title = null) { ChoMessageBox frm = new ChoMessageBox(detailErrMsg, errMsg, title); return(frm.ShowDialog()); }
private void ComboBox_SelectedValueChanged(object sender, EventArgs e) { lstPlugIns.DataSource = null; if (tsbCmbPlugInsGroup.ComboBox.Text.IsNullOrWhiteSpace()) { return; } if (_prevPlugInsGroupName != null) { if (tsbCmbPlugInsGroup.ComboBox.FindStringExact(_prevPlugInsGroupName) >= 0) { ApplyPlugInGroupChanges(_prevPlugInsGroupName, _plugInBuilderList.ToArray()); } } int counter = 0; _plugInBuilderList.Clear(); bool cancel = false; foreach (ChoPlugInBuilder pb in _plugInsDefManager.GetPlugInBuilders(tsbCmbPlugInsGroup.ComboBox.Text).TryForEach((ex) => { DialogResult r = ChoMessageBox.Show(ex, "Error occurred loading definition. Do you want to ignore and continue loading definition?", Caption); if (r == System.Windows.Forms.DialogResult.Yes) { return(true); } else { cancel = true; return(false); } })) { if (!pb.Name.IsNullOrWhiteSpace()) { if (Int32.TryParse(Regex.Match(pb.Name, "_([0-9]+)").Groups[1].Value, out counter)) { if (counter > _index) { _index = counter; } } } pb.PropertyChanged += (o, e1) => IsDirty = true; _plugInBuilderList.Add(pb); } if (cancel) { _forceClosing = true; this.Close(); } lstPlugIns.DataSource = _plugInBuilderList; lstPlugIns.DisplayMember = "Name"; //lstPlugIns.ValueMember = "Key"; _prevPlugInsGroupName = tsbCmbPlugInsGroup.ComboBox.Text; }