public ActionRun(ActionCoreController ed, ActionFileList afl) { restarttick.Interval = 100; restarttick.Tick += Tick_Tick; actioncontroller = ed; actionfilelist = afl; }
public override void Init(Condition cond, List <string> events, ActionCoreController cp, string appfolder, ActionFile actionfile, System.Func <string, List <BaseUtils.TypeHelpers.PropertyNameInfo> > func, Icon ic, ToolTip toolTip) { cd = cond; // on creation, the cond with be set to onVoice with one condition, checked in ActionController.cs:SetPackEditor.. textBoxInput = new ExtendedControls.ExtTextBox(); textBoxInput.Location = new Point(panelxmargin, panelymargin); textBoxInput.Size = new Size(356, 24); // manually matched to size of eventprogramcondition bits textBoxInput.Text = cd.fields[0].matchstring; textBoxInput.TextChanged += TextBoxInput_TextChanged; textBoxInput.SetTipDynamically(toolTip, "Enter the voice input to recognise. Multiple phrases seperate with semicolons"); Controls.Add(textBoxInput); ActionProgram p = cond.action.HasChars() ? actionfile.actionprogramlist.Get(cond.action) : null; ActionProgram.ProgramConditionClass classifier = p != null ? p.progclass : ActionProgram.ProgramConditionClass.KeySay; ucprog = new ActionPackEditProgram(); ucprog.Location = new Point(textBoxInput.Right + 16, 0); ucprog.Size = new Size(400, this.Height); // init all the panels to 0/this height, select widths ucprog.Init(actionfile, cond, cp, appfolder, ic, toolTip, classifier); ucprog.onEditKeys = onEditKeys; ucprog.onEditSay = onEditSay; ucprog.onAdditionalNames += () => { return(func(cd.eventname)); }; ucprog.SuggestedName += () => { string textparse = (textBoxInput.Text.Length > 0 && !textBoxInput.Text.Equals("?")) ? ("_" + textBoxInput.Text.Split(';')[0].SafeVariableString()) : ""; return("VoiceInput" + textparse); }; ucprog.RefreshEvent += () => { RefreshIt(); }; Controls.Add(ucprog); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <BaseUtils.TypeHelpers.PropertyNameInfo> eventvars) { string progname; Variables cond; Dictionary <string, string> altops; FromString(UserData, out progname, out cond, out altops); // test example List<string> p2romptValue = ExtendedControls.PromptMultiLine.ShowDialog(parent, "caption", cp.Icon, new string[] { "wkwkwkw wkw qwjkqwkqw qwkqwk", "wkwkw ejjd2" }, null, true); string promptValue = ExtendedControls.PromptSingleLine.ShowDialog(parent, "Program to call (use set::prog if req)", progname, "Configure Call Command", cp.Icon); if (promptValue != null) { ExtendedConditionsForms.VariablesForm avf = new ExtendedConditionsForms.VariablesForm(); avf.Init("Variables to pass into called program", cp.Icon, cond, showatleastoneentry: true, allownoexpand: true, altops: altops); if (avf.ShowDialog(parent) == DialogResult.OK) { userdata = ToString(promptValue, avf.result, avf.result_altops); return(true); } } return(false); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars) { string path; ConditionVariables vars; FromString(userdata, out path, out vars); WaveConfigureDialog cfg = new WaveConfigureDialog(); cfg.Init(cp.AudioQueueWave, false, "Select file, volume and effects", "Configure Play Command", path, vars.Exists(waitname), AudioQueue.GetPriority(vars.GetString(priorityname, "Normal")), vars.GetString(startname, ""), vars.GetString(finishname, ""), vars.GetString(volumename, "Default"), vars); if (cfg.ShowDialog(parent) == DialogResult.OK) { ConditionVariables cond = new ConditionVariables(cfg.Effects);// add on any effects variables (and may add in some previous variables, since we did not purge) cond.SetOrRemove(cfg.Wait, waitname, "1"); cond.SetOrRemove(cfg.Priority != AudioQueue.Priority.Normal, priorityname, cfg.Priority.ToString()); cond.SetOrRemove(cfg.StartEvent.Length > 0, startname, cfg.StartEvent); cond.SetOrRemove(cfg.StartEvent.Length > 0, finishname, cfg.FinishEvent); cond.SetOrRemove(!cfg.Volume.Equals("Default", StringComparison.InvariantCultureIgnoreCase), volumename, cfg.Volume); userdata = ToString(cfg.Path, cond); return(true); } return(false); }
public ActionProgramRun(ActionFile af, // associated file ActionProgram r, // the program ConditionVariables iparas, // input variables to the program only.. not globals ActionRun runner, // who is running it.. ActionCoreController ed) : base(r.Name) // allow a pause { actionfile = af; actionrun = runner; actioncontroller = ed; execlevel = 0; execstate[execlevel] = ExecState.On; nextstepnumber = 0; //System.Diagnostics.Debug.WriteLine("Run " + actionfile.name + "::" + r.Name); //ActionData.DumpVars(gvars, " Func Var:"); inputvars = iparas; // current vars is set up by ActionRun at the point of invokation to have the latests globals List <ActionBase> psteps = new List <ActionBase>(); ActionBase ac; for (int i = 0; (ac = r.GetStep(i)) != null; i++) { psteps.Add(ActionBase.CreateCopy(ac)); } programsteps = psteps; }
public void Init(Condition cond, List <string> events, ActionCoreController cp, string appfolder, ActionFile file, ActionPackEditorForm.AdditionalNames func) { onAdditionalNames = func; cd = new Condition(cond); // full clone, we can now modify it. actionfile = file; actioncorecontroller = cp; applicationfolder = appfolder; InitSub(events); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars) { string promptValue = ExtendedControls.PromptSingleLine.ShowDialog(parent, "Pragma", UserData, "Configure Pragma Command", cp.Icon); if (promptValue != null) { userdata = promptValue; } return(promptValue != null); }
public override bool ConfigurationMenu(Form parent, ActionCoreController discoveryform, List <string> eventvars) { string promptValue = ExtendedControls.PromptSingleLine.ShowDialog(parent, "Expression", UserData, "Configure Function Expression"); if (promptValue != null) { userdata = promptValue; } return(promptValue != null); }
public override bool ConfigurationMenu(Form parent, ActionCoreController discoveryform, List <string> eventvars) { string promptValue = ExtendedControls.PromptSingleLine.ShowDialog(parent, "Variable name", UserData, "Configure DeleteVariable Command"); if (promptValue != null) { userdata = promptValue; } return(promptValue != null); }
} // and allow editing? public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <BaseUtils.TypeHelpers.PropertyNameInfo> eventvars) { string promptValue = ExtendedControls.PromptSingleLine.ShowDialog(parent, "DialogControl command", UserData, "Configure DialogControl Command", cp.Icon); if (promptValue != null) { userdata = promptValue; } return(promptValue != null); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <BaseUtils.TypeHelpers.PropertyNameInfo> eventvars) { List <string> l = FromString(userdata); List <string> r = ExtendedControls.PromptMultiLine.ShowDialog(parent, "Configure MessageBox Dialog", cp.Icon, new string[] { "Message", "Caption", "Buttons", "Icon" }, l?.ToArray(), true); if (r != null) { userdata = r.ToStringCommaList(1, true); // and escape them back } return(r != null); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars) { List <string> l = FromString(userdata); List <string> r = ExtendedControls.PromptMultiLine.ShowDialog(parent, "Configure Loop", cp.Icon, new string[] { "Loop count", "Optional var name" }, l?.ToArray(), true); if (r != null) { userdata = r.ToStringCommaList(1, true); // and escape them back } return(r != null); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars) { string promptValue = ExtendedControls.PromptSingleLine.ShowDialog(parent, "Return", UserData.ReplaceEscapeControlChars(), "Configure Return Command", cp.Icon, true); if (promptValue != null) { userdata = promptValue.EscapeControlChars(); } return(promptValue != null); }
} // and allow editing? public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <BaseUtils.TypeHelpers.PropertyNameInfo> eventvars) { string promptValue = ExtendedControls.PromptSingleLine.ShowDialog(parent, "Line to display", UserData.ReplaceEscapeControlChars(), "Configure Print Command", cp.Icon, true); if (promptValue != null) { userdata = promptValue.EscapeControlChars(); } return(promptValue != null); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars) { string promptValue = ExtendedControls.PromptSingleLine.ShowDialog(parent, "Sleep time in ms:", UserData, "Set Sleep timeout", cp.Icon); if (promptValue != null) { userdata = promptValue; return(true); } return(promptValue != null); }
public void Init(string title, Icon ic, ActionCoreController cp, string appfolder, ActionFile file, List <ActionEvent> evlist, string collapsestate) // here, change to using events { this.Icon = ic; actioncorecontroller = cp; applicationfolder = appfolder; actionfile = file; events = evlist; var enumlist = new Enum[] { AFIDs.ActionPackEditPackForm_buttonInstallationVars, AFIDs.ActionPackEditPackForm_labelEditProg }; BaseUtils.Translator.Instance.TranslateControls(this, enumlist); grouptypenames = (from e in events select e.UIClass).ToList().Distinct().ToList(); // here we extract from events relevant data groupeventlist = new Dictionary <string, List <string> >(); foreach (string s in grouptypenames) { groupeventlist.Add(s, (from e in events where e.UIClass == s select e.TriggerName).ToList()); } bool winborder = ExtendedControls.Theme.Current.ApplyDialog(this); // scale to font statusStripCustom.Visible = panelTop.Visible = panelTop.Enabled = !winborder; initialtitle = this.Text = label_index.Text = title; ConditionLists clist = actionfile.FileEventList; // now load the initial conditions from the action file string eventname = null; for (int i = 0; i < clist.Count; i++) // for ever event, find the condition, create the group, theme { string gname = clist[i].GroupName; if (gname != eventname) { eventname = gname; Group gg = CreateGroup(false, null, gname); gg.collapsed = collapsestate.Contains("<" + gname + ";"); groups.Add(gg); } Condition cd = clist[i]; Group g = CreateGroup(true, cd, null); groups.Add(g); } foreach (Group g in groups) // add the groups to the vscroller { panelVScroll.Controls.Add(g.panel); } PositionGroups(true); //repositions all items Usercontrol_RefreshEvent(); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars) //standard one used for most { ConditionLists jf = new ConditionLists(); jf.Read(userdata); bool ok = ConfigurationMenu(parent, cp, eventvars, ref jf); if (ok) { userdata = jf.ToString(); } return(ok); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars) { string ud = Menu(parent, userdata, cp); if (ud != null) { userdata = ud; return(true); } else { return(false); } }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <BaseUtils.TypeHelpers.PropertyNameInfo> eventvars) // override again to expand any functionality { string ud = Menu(parent, cp.Icon, userdata, null, null); // base has no additional keys/parser if (ud != null) { userdata = ud; return(true); } else { return(false); } }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <BaseUtils.TypeHelpers.PropertyNameInfo> eventvars) { string ud = Menu(parent, userdata, cp); if (ud != null) { userdata = ud; return(true); } else { return(false); } }
public void Init(Icon ic, ActionCoreController cp, string appfolder, List <BaseUtils.TypeHelpers.PropertyNameInfo> vbs, // list any variables you want in condition statements - passed to config menu, passed back up to condition, not null string pfilesetname, // file set name ActionProgram prog = null, // give the program to display string[] defprogs = null, // list any default program names string suggestedname = null, bool edittext = false) // give a suggested name, if prog is null { this.Icon = ic; actioncorecontroller = cp; applicationfolder = appfolder; currentvarlist = new List <BaseUtils.TypeHelpers.PropertyNameInfo>(vbs); var enumlist = new Enum[] { AFIDs.ActionProgramEditForm, AFIDs.ActionProgramEditForm_labelName, AFIDs.ActionProgramEditForm_buttonExtDisk, AFIDs.ActionProgramEditForm_buttonExtLoad, AFIDs.ActionProgramEditForm_buttonExtSave, AFIDs.ActionProgramEditForm_buttonExtEdit, AFIDs.ActionProgramEditForm_extButtonHeader }; BaseUtils.Translator.Instance.TranslateControls(this, enumlist); bool winborder = ExtendedControls.Theme.Current.ApplyDialog(this); statusStripCustom.Visible = panelTop.Visible = panelTop.Enabled = !winborder; label_index.Text = this.Text; labelSet.Text = pfilesetname + "::"; textBoxBorderName.Location = new Point(labelSet.Location.X + labelSet.Width + 8, textBoxBorderName.Location.Y); if (defprogs != null) { definedprograms = defprogs; } if (suggestedname != null) { textBoxBorderName.Text = suggestedname; } if (prog != null) { LoadProgram(prog); } panelVScroll.ContextMenuStrip = contextMenuStrip1; panelVScroll.MouseDown += panelVScroll_MouseDown; editastextimmediately = edittext; #if !DEBUG buttonExtDisk.Visible = false; #endif }
public void Init(string t, Icon ic, ActionCoreController cp, string appfolder, ActionFile file, List <ActionEvent> evlist, string collapsestate) // here, change to using events { this.Icon = ic; actioncorecontroller = cp; applicationfolder = appfolder; actionfile = file; events = evlist; grouptypenames = (from e in events select e.UIClass).ToList().Distinct().ToList(); // here we extract from events relevant data groupeventlist = new Dictionary <string, List <string> >(); foreach (string s in grouptypenames) { groupeventlist.Add(s, (from e in events where e.UIClass == s select e.TriggerName).ToList()); } bool winborder = ExtendedControls.ThemeableFormsInstance.Instance.ApplyToForm(this, SystemFonts.DefaultFont); statusStripCustom.Visible = panelTop.Visible = panelTop.Enabled = !winborder; initialtitle = this.Text = label_index.Text = t; ConditionLists clist = actionfile.actioneventlist; // now load the initial conditions from the action file string eventname = null; for (int i = 0; i < clist.Count; i++) // for ever event, find the condition, create the group, theme { string gname = clist.GetGroupName(i); if (gname != eventname) { eventname = gname; Group gg = CreateGroup(false, null, gname); gg.collapsed = collapsestate.Contains("<" + gname + ";"); groups.Add(gg); } Condition cd = clist.Get(i); Group g = CreateGroup(true, cd, null); groups.Add(g); } foreach (Group g in groups) // add the groups to the vscroller { panelVScroll.Controls.Add(g.panel); } PositionGroups(true); //repositions all items Usercontrol_RefreshEvent(); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars) // override again to expand any functionality { string ud = Menu(parent, cp.Icon, userdata); // base has no additional keys if (ud != null) { userdata = ud; return(true); } else { return(false); } }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <BaseUtils.TypeHelpers.PropertyNameInfo> eventvars) { List <string> l = FromString(userdata); List <string> r = ExtendedControls.PromptMultiLine.ShowDialog(parent, "Configure InputBox Dialog", cp.Icon, new string[] { "Caption", "Prompt List", "Default List", "Features", "ToolTips" }, l?.ToArray(), false, new string[] { "Enter name of menu", "List of entries, semicolon separated", "Default list, semicolon separated", "Feature list: Multiline", "List of tool tips, semocolon separated" }); if (r != null) { userdata = r.ToStringCommaList(2); } return(r != null); }
public bool EditProgram(string s, string outername, ActionCoreController cp, string appfolder) { int colon = s.IndexOf(':'); if (colon >= 0) { s = s.Substring(0, colon); } int bracket = s.IndexOf('('); if (bracket >= 0) { s = s.Substring(0, bracket); } ActionProgram p = Get(s); if (p != null) { if (p.StoredInSubFile != null) { p.EditInEditor(p.StoredInSubFile); // Edit in the editor.. } else { ActionProgramEditForm apf = new ActionProgramEditForm(); apf.EditProgram += EditProgram; this.edoutername = outername; this.cp = cp; this.appfolder = appfolder; List <BaseUtils.TypeHelpers.PropertyNameInfo> additionalfieldnames = new List <BaseUtils.TypeHelpers.PropertyNameInfo>(); // We don't have any names to contribute going thru this path apf.Init("Action program ", cp.Icon, cp, appfolder, additionalfieldnames, outername, p, GetActionProgramList(), ""); System.Windows.Forms.DialogResult res = apf.ShowDialog(); if (res == System.Windows.Forms.DialogResult.OK) { ActionProgram np = apf.GetProgram(); AddOrChange(np); // replaces or adds (if its a new name) same as rename } return(true); } } return(false); }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <BaseUtils.TypeHelpers.PropertyNameInfo> eventvars) { List <string> l = FromString(userdata); List <string> r = ExtendedControls.PromptMultiLine.ShowDialog(parent, "Configure Dialog", cp.Icon, new string[] { "Logical Name", "Caption", "Size [Pos]", "Var Prefix" }, l?.ToArray(), false, new string[] { "Handle name of menu", "Enter title of menu", "Size and optional Position, as w,h [,x,y] 200,300 or 200,300,500,100", "Variable Prefix" }); if (r != null) { userdata = r.ToStringCommaList(2); } return(r != null); }
public bool ConfigurationMenu(Form parent, ActionCoreController cp, List <BaseUtils.TypeHelpers.PropertyNameInfo> eventvars, ref ConditionLists jf) { ExtendedConditionsForms.ConditionFilterForm frm = new ExtendedConditionsForms.ConditionFilterForm(); frm.VariableNames = eventvars; frm.InitCondition("Define condition", cp.Icon, jf); if (frm.ShowDialog(parent) == DialogResult.OK) { jf = frm.Result; return(true); } else { return(false); } }
public bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars, ref ConditionLists jf) { ConditionFilterForm frm = new ConditionFilterForm(); frm.InitCondition("Define condition", cp.Icon, eventvars, jf); if (frm.ShowDialog(parent) == DialogResult.OK) { jf = frm.result; return(true); } else { return(false); } }
public void Init(string t, Icon ic, ActionCoreController cp, string appfolder, List <string> vbs, // list any variables you want in condition statements - passed to config menu, passed back up to condition, not null string pfilesetname, // file set name ActionProgram prog = null, // give the program to display string[] defprogs = null, // list any default program names string suggestedname = null, bool edittext = false) // give a suggested name, if prog is null { this.Icon = ic; actioncorecontroller = cp; applicationfolder = appfolder; startvarlist = vbs; currentvarlist = new List <string>(startvarlist); bool winborder = ExtendedControls.ThemeableFormsInstance.Instance.ApplyToForm(this, SystemFonts.DefaultFont); statusStripCustom.Visible = panelTop.Visible = panelTop.Enabled = !winborder; this.Text = label_index.Text = t; filesetname = pfilesetname; labelSet.Text = filesetname + "::"; textBoxBorderName.Location = new Point(labelSet.Location.X + labelSet.Width + 8, textBoxBorderName.Location.Y); if (defprogs != null) { definedprograms = defprogs; } if (suggestedname != null) { textBoxBorderName.Text = suggestedname; } if (prog != null) { LoadProgram(prog); } panelVScroll.ContextMenuStrip = contextMenuStrip1; panelVScroll.MouseDown += panelVScroll_MouseDown; editastextimmediately = edittext; #if !DEBUG buttonExtDisk.Visible = false; #endif }
public override bool ConfigurationMenu(Form parent, ActionCoreController cp, List <string> eventvars) { ConditionLists cond; string errmsg; FromString(userdata, out cond, out errmsg); if (base.ConfigurationMenu(parent, cp, eventvars, ref cond)) { string promptValue = ExtendedControls.PromptSingleLine.ShowDialog(parent, "Error to display", errmsg, "Configure ErrorIf Command", cp.Icon); if (promptValue != null) { userdata = ToString(cond, promptValue); return(true); } } return(false); }