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); } }
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; }