public override bool ExecuteAction(ActionProgramRun ap) { List <string> ctrl = FromString(UserData); if (ctrl != null) { List <string> exp; if (ap.functions.ExpandStrings(ctrl, out exp) != ConditionFunctions.ExpandResult.Failed) { ConditionVariables cv = ap.variables.FilterVars(exp[3] + "*"); List <Forms.ConfigurableForm.Entry> entries = new List <Forms.ConfigurableForm.Entry>(); foreach (string k in cv.NameList) { Forms.ConfigurableForm.Entry entry; string errmsg = Forms.ConfigurableForm.MakeEntry(cv[k], out entry); if (errmsg != null) { return(ap.ReportError(errmsg + " in " + k + " variable for Dialog")); } entries.Add(entry); } StringParser sp2 = new StringParser(exp[2]); int? dw = sp2.NextWordComma().InvariantParseIntNull(); int? dh = sp2.NextWord().InvariantParseIntNull(); if (dw != null && dh != null) { Forms.ConfigurableForm cd = new Forms.ConfigurableForm(); ap.dialogs[exp[0]] = cd; cd.Trigger += Cd_Trigger; cd.Show(ap.actioncontroller.DiscoveryForm, exp[0], new System.Drawing.Size(dw.Value, dh.Value), exp[1], entries.ToArray(), ap); return(false); // STOP, wait input } else { ap.ReportError("Width/Height not specified in Dialog"); } } else { ap.ReportError(exp[0]); } } else { ap.ReportError("Dialog command line not in correct format"); } return(true); }
public override bool ExecuteAction(ActionProgramRun ap) { string exp; if (ap.functions.ExpandString(UserData, out exp) != ConditionFunctions.ExpandResult.Failed) { StringParser sp = new StringParser(exp); string handle = sp.NextWordComma(); if (handle != null && ap.dialogs.ContainsKey(handle)) { Forms.ConfigurableForm f = ap.dialogs[handle]; string cmd = sp.NextWord(lowercase: true); if (cmd == null) { ap.ReportError("Missing command in DialogControl"); } else if (cmd.Equals("continue")) { return(false); } else if (cmd.Equals("get")) { string control = sp.NextWord(); string r; if (control != null && (r = f.Get(control)) != null) { ap["DialogResult"] = r; } else { ap.ReportError("Missing or invalid dialog name in DialogControl get"); } } else if (cmd.Equals("set")) { string control = sp.NextWord(" ="); string value = sp.IsCharMoveOn('=') ? sp.NextQuotedWord() : null; if (control != null && value != null) { if (!f.Set(control, value)) { ap.ReportError("Cannot set control " + control + " in DialogControl set"); } } else { ap.ReportError("Missing or invalid dialog name and/or value in DialogControl set"); } } else if (cmd.Equals("close")) { f.Close(); ap.dialogs.Remove(handle); } else { ap.ReportError("Unknown command in DialogControl"); } } else { ap.ReportError("Missing handle in DialogControl"); } } else { ap.ReportError(exp); } return(true); }