public void Create(OpenLab.Lib.Control Control) { var label = new Label(); var onButton = new Button(); var offButton = new Button(); var padding = new Padding(); padding.Top = 8; label.Padding = padding; label.AutoSize = true; Control.Controls.Add(label); onButton.Tag = Control; onButton.Text = "On"; onButton.Size = new Size(50, 23); onButton.Click += new EventHandler(OnButton_Click); Control.Controls.Add(onButton); offButton.Tag = Control; offButton.Text = "Off"; offButton.Size = new Size(50, 23); offButton.Click += new EventHandler(OffButton_Click); Control.Controls.Add(offButton); Control.Settings.Add("on_command", string.Empty); Control.Settings.Add("off_command", string.Empty); Control.Settings.Add("state", string.Empty); }
public ToolStripItem[] GetContextMenuItems(OpenLab.Lib.Control Control) { var onCommandMenuItem = new ToolStripMenuItem("On Command"); var onCommandTextBox = new ToolStripTextBox("On Command Text Box"); var offCommandMenuItem = new ToolStripMenuItem("Off Command"); var offCommandTextBox = new ToolStripTextBox("Off Command Text Box"); onCommandMenuItem.DropDownItems.Add(onCommandTextBox); onCommandTextBox.TextChanged += new EventHandler(OnCommandTextBox_TextChanged); onCommandTextBox.Tag = Control; offCommandMenuItem.DropDownItems.Add(offCommandTextBox); offCommandTextBox.TextChanged += new EventHandler(OffCommandTextBox_TextChanged); offCommandTextBox.Tag = Control; return(new ToolStripItem[] { onCommandMenuItem, offCommandMenuItem }); }
public void ContextMenuOpening(OpenLab.Lib.Control Control) { Control.GetContextMenuItem <ToolStripTextBox>("On Command Text Box").Text = Control.Settings["on_command"]; Control.GetContextMenuItem <ToolStripTextBox>("Off Command Text Box").Text = Control.Settings["off_command"]; }
public void SetValue(OpenLab.Lib.Control Control, string Value) { // Nothing to do! }
public string GetValue(OpenLab.Lib.Control Control) { return(Control.Settings["state"]); }
public void SetLabel(OpenLab.Lib.Control Control, string Label) { Control.Controls.OfType <Label>().First().Text = string.Format("{0}:", Label); }
public string GetLabel(OpenLab.Lib.Control Control) { var label = Control.Controls.OfType <Label>().First(); return(label.Text.Substring(0, label.Text.Length - 1)); }
public void LoadSettings(OpenLab.Lib.Control Control) { // Nothing to do! }