private void PanelType_SelectedIndexChanged(object sender, EventArgs e) { ActionProgram.ProgramConditionClass newcls = indextoclassifier[progmajortype.SelectedIndex]; if (newcls != classifier) { ActionProgram p = cd.action.HasChars() ? actionfile.actionprogramlist.Get(cd.action) : null; if (p != null) // if we have an existing program, may need to alter it { // to not full with prog class being full, need to clear, not in correct form if (newcls != ActionProgram.ProgramConditionClass.Full && p.progclass == ActionProgram.ProgramConditionClass.Full) { cd.action = cd.actiondata = ""; // only change these } else if (newcls == ActionProgram.ProgramConditionClass.Key) // key, make sure no say { p.SetKeySayProgram(p.keyuserdata, null); } else if (newcls == ActionProgram.ProgramConditionClass.Say) //say, make sure no key { p.SetKeySayProgram(null, p.sayuserdata); } } classifier = newcls; UpdateControls(); } }
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 void ChangedCondition(ActionProgram.ProgramConditionClass cls) // upper swapped out condition.. brand new clean one { classifier = cls; cd.action = ""; cd.actionvars = new Variables(); UpdateControls(); }
private void Eventtype_SelectedIndexChanged(object sender, System.EventArgs e) { cd.EventName = eventtype.Text; if (autosetcondition != null) { ActionProgram.ProgramConditionClass cls = autosetcondition(cd); // ask how to set up the event.. uccond.ChangedCondition(); // cd is updated ucprog.ChangedCondition(cls); // program class is updated } }
// called when a event name is selected, what is the initial condition set up? private ActionProgram.ProgramConditionClass SetEventCondition(Condition cd) { // and what is the class selection for the program? ActionProgram.ProgramConditionClass cls = ActionProgram.ProgramConditionClass.Full; if (cd.IsAlwaysTrue()) { if (cd.eventname == "onKeyPress") { cd.Set(new ConditionEntry("KeyPress", ConditionEntry.MatchType.Equals, "?")); } else if (cd.eventname == "onTimer") { cd.Set(new ConditionEntry("TimerName", ConditionEntry.MatchType.Equals, "?")); } else if (cd.eventname == "onPopUp" || cd.eventname == "onPopDown") { cd.Set(new ConditionEntry("PopOutName", ConditionEntry.MatchType.Equals, "?")); } else if (cd.eventname == "onTabChange") { cd.Set(new ConditionEntry("TabName", ConditionEntry.MatchType.Equals, "?")); } else if (cd.eventname == "onPanelChange") { cd.Set(new ConditionEntry("PopOutName", ConditionEntry.MatchType.Equals, "?")); } else if (cd.eventname == "onEliteInput" || cd.eventname == "onEliteInputOff") { cd.Set(new ConditionEntry("Binding", ConditionEntry.MatchType.Equals, "?")); } else if (cd.eventname == "onMenuItem") { cd.Set(new ConditionEntry("MenuName", ConditionEntry.MatchType.Equals, "?")); } else if (cd.eventname == "onSayStarted" || cd.eventname == "onSayFinished" || cd.eventname == "onPlayStarted" || cd.eventname == "onPlayFinished") { cd.Set(new ConditionEntry("EventName", ConditionEntry.MatchType.Equals, "?")); } else if (cd.eventname == "onVoiceInput") { cls = ActionProgram.ProgramConditionClass.KeySay; } } return(cls); }
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; //this.BackColor = Color.Red; // for debug // layed out for 12 point. UC below require 28 point area eventtype = new ExtendedControls.ExtComboBox(); eventtype.Items.AddRange(events); eventtype.Location = new Point(panelxmargin, panelymargin); eventtype.Size = new Size(140, 24); if (cd.EventName != null) { eventtype.SelectedItem = cd.EventName; } eventtype.SelectedIndexChanged += Eventtype_SelectedIndexChanged; Controls.Add(eventtype); uccond = new ActionPackEditCondition(); uccond.Location = new Point(eventtype.Right + 16, 0); uccond.Size = new Size(200, 28); // init all the panels to 0/this height, select widths uccond.Init(cond, ic, toolTip); uccond.onAdditionalNames += () => { return(func(eventtype.Text)); }; Controls.Add(uccond); ActionProgram p = cond.Action.HasChars() ? actionfile.ProgramList.Get(cond.Action) : null; ActionProgram.ProgramConditionClass classifier = p != null ? p.ProgramClass : ActionProgram.ProgramConditionClass.Full; ucprog = new ActionPackEditProgram(); ucprog.Location = new Point(uccond.Right + 16, 0); ucprog.Size = new Size(400, 28); // 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(eventtype.Text)); }; ucprog.SuggestedName += () => { return(eventtype.Text); }; ucprog.RefreshEvent += () => { RefreshIt(); }; Controls.Add(ucprog); }
public override void Init(Condition cond, List <string> events, ActionCoreController cp, string appfolder, ActionFile actionfile, System.Func <string, List <string> > func, Icon ic, ToolTip toolTip) { cd = cond; anfunc = func; eventtype = new ExtendedControls.ComboBoxCustom(); eventtype.Items.AddRange(events); eventtype.Location = new Point(panelxmargin, panelymargin); eventtype.Size = new Size(140, 24); eventtype.DropDownHeight = 400; eventtype.DropDownWidth = eventtype.Width * 3 / 2; if (cd.eventname != null) { eventtype.SelectedItem = cd.eventname; } eventtype.SelectedIndexChanged += Eventtype_SelectedIndexChanged; Controls.Add(eventtype); uccond = new ActionPackEditCondition(); uccond.Location = new Point(eventtype.Right + 16, 0); uccond.Size = new Size(200, this.Height); // init all the panels to 0/this height, select widths uccond.Init(cond, ic, toolTip); uccond.onAdditionalNames += () => { return(anfunc(eventtype.Text)); }; Controls.Add(uccond); ActionProgram p = cond.action.HasChars() ? actionfile.actionprogramlist.Get(cond.action) : null; ActionProgram.ProgramConditionClass classifier = p != null ? p.progclass : ActionProgram.ProgramConditionClass.Full; ucprog = new ActionPackEditProgram(); ucprog.Location = new Point(uccond.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(anfunc(eventtype.Text)); }; ucprog.SuggestedName += () => { return(eventtype.Text); }; ucprog.RefreshEvent += () => { RefreshIt(); }; Controls.Add(ucprog); }
public void Init(ActionFile af, Condition c, ActionCoreController ac, string apf, Icon i, ToolTip toolTip, ActionProgram.ProgramConditionClass cls) { cd = c; // point at common condition, we never new it, just update action data/action actionfile = af; actioncorecontroller = ac; applicationfolder = apf; Icon = i; classifier = cls; progmajortype = new ExtendedControls.PanelSelectionList(); progmajortype.Items.AddRange(new string[] { "Key", "Say", "Key+Say", "Full Program" }); indextoclassifier = new ActionProgram.ProgramConditionClass[] { ActionProgram.ProgramConditionClass.Key, ActionProgram.ProgramConditionClass.Say, ActionProgram.ProgramConditionClass.KeySay, ActionProgram.ProgramConditionClass.Full }; progmajortype.Location = new Point(0, 0); progmajortype.Size = new Size(this.Width, this.Height); // outer panel aligns with this UC progmajortype.SelectedIndexChanged += PanelType_SelectedIndexChanged; toolTip.SetToolTip(progmajortype, "Use the selector (click on bottom right arrow) to select program class type"); proglist = new ExtendedControls.ComboBoxCustom(); proglist.Items.Add("New"); proglist.Items.AddRange(actionfile.actionprogramlist.GetActionProgramList()); proglist.Location = new Point(panelxmargin, panelymargin); proglist.Size = new Size((this.Width - 24 - 8 - 8 - 8 - panelxmargin * 2) / 2, 24); // 24 button, 8+8 gaps, 8 for selector proglist.DropDownHeight = 400; proglist.DropDownWidth = proglist.Width * 3 / 2; proglist.SelectedIndexChanged += Proglist_SelectedIndexChanged; proglist.SetTipDynamically(toolTip, "Select program to associate with this event"); progedit = new ExtendedControls.ButtonExt(); progedit.Text = "P"; progedit.Location = new Point(proglist.Right + 8, panelymargin); progedit.Size = new Size(24, 24); progedit.Click += Progedit_Click; toolTip.SetToolTip(progedit, "Edit associated program"); paras = new ExtendedControls.TextBoxBorder(); paras.Text = (cd.actiondata != null) ? cd.actiondata : ""; paras.Location = new Point(progedit.Right + 8, panelymargin + 2); paras.Size = proglist.Size; paras.ReadOnly = true; paras.Click += Paras_Click; paras.SetTipDynamically(toolTip, "Click to enter parameters to pass to program"); buttonKeys = new ExtendedControls.ButtonExt(); buttonKeys.Location = proglist.Location; buttonKeys.Size = new Size((this.Width - 8 - 8 - panelxmargin * 2) / 2, 24); buttonKeys.Click += Keypress_Click; toolTip.SetToolTip(buttonKeys, "Click to define keystrokes to send"); buttonSay = new ExtendedControls.ButtonExt(); buttonSay.Location = new Point(buttonKeys.Right + 8, buttonKeys.Top); buttonSay.Size = buttonKeys.Size; buttonSay.Click += Saypress_Click; toolTip.SetToolTip(buttonSay, "Click to set speech to say"); SuspendLayout(); progmajortype.Controls.Add(proglist); progmajortype.Controls.Add(progedit); progmajortype.Controls.Add(paras); progmajortype.Controls.Add(buttonKeys); progmajortype.Controls.Add(buttonSay); Controls.Add(progmajortype); UpdateControls(); ResumeLayout(); }