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 Init(Condition c, Icon ic, ToolTip toolTip) { cd = c; // point to common condition. We only change the fields, not the cd.action/actiondata, and we don't replace it. Icon = ic; // layed out for 12 point. Requires a 28 pixel area to sit in panelConditionType = new ExtendedControls.ExtPanelDropDown(); panelConditionType.Location = new Point(0, 0); panelConditionType.Size = new Size(this.Width, 28); // outer panel aligns with this UC panelConditionType.SelectedIndexChanged += PanelConditionType_SelectedIndexChanged; toolTip.SetToolTip(panelConditionType, "Use the selector (click on bottom right arrow) to select condition class type"); textBoxCondition = new ExtendedControls.ExtTextBox(); textBoxCondition.Location = new Point(panelxmargin, panelymargin); textBoxCondition.Size = new Size(this.Width - 8 - panelxmargin * 2, 24); // 8 for selector textBoxCondition.ReadOnly = true; textBoxCondition.Click += Condition_Click; textBoxCondition.SetTipDynamically(toolTip, "Click to edit the condition that controls when the event is generated"); buttonKeys = new ExtendedControls.ExtButton(); buttonKeys.Location = textBoxCondition.Location; buttonKeys.Size = textBoxCondition.Size; buttonKeys.Click += Keypress_Click; toolTip.SetToolTip(buttonKeys, "Click to set the key list that associated this event with key presses"); labelAlwaysTrue = new Label(); labelAlwaysTrue.Location = new Point(panelxmargin, panelymargin + 1); labelAlwaysTrue.Size = textBoxCondition.Size; labelAlwaysTrue.Text = "Always Action/True"; labelAlwaysFalse = new Label(); labelAlwaysFalse.Location = new Point(panelxmargin, panelymargin + 1); labelAlwaysFalse.Size = textBoxCondition.Size; labelAlwaysFalse.Text = "Never Action/False"; SuspendLayout(); panelConditionType.Controls.Add(textBoxCondition); panelConditionType.Controls.Add(labelAlwaysTrue); panelConditionType.Controls.Add(labelAlwaysFalse); panelConditionType.Controls.Add(buttonKeys); Controls.Add(panelConditionType); SelectRepresentation(); ResumeLayout(); }
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.ExtPanelDropDown(); 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.ExtComboBox(); 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.ExtButton(); 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.ExtTextBox(); 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.ExtButton(); 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.ExtButton(); 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(); }