private TableLayoutPanel GetOptionsPanel(MessageService.Plugin plugin) { TableLayoutPanel panel = new TableLayoutPanel { GrowStyle = TableLayoutPanelGrowStyle.AddRows, ColumnCount = 2, Dock = DockStyle.Fill, //Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right, ColumnStyles = { new ColumnStyle(SizeType.Percent, 50), new ColumnStyle(SizeType.Percent, 50) }, CellBorderStyle = TableLayoutPanelCellBorderStyle.Single }; for (int configOptionIndex = 0; configOptionIndex < plugin.ConfigOptions.Count; configOptionIndex++) { var configOption = plugin.ConfigOptions[configOptionIndex]; panel.Controls.Add(new Label { Text = configOption.Name }, 0, configOptionIndex); panel.Controls.Add(getControl(configOption), 1, configOptionIndex); } return(panel); }
public void Run() { Console.Write("Channel:"); var chan = Console.ReadLine(); Console.Write("Username:"******"Password:"); var pass = Console.ReadLine(); Console.Clear(); var service = new HackChatMessageService(username, pass, chan); viewPlugin = new ConsoleChatViewPlugin(service, this); while (true) { viewPlugin.SendMessage(Console.ReadLine()); Console.CursorTop--; } }
private void InitialisePluginUI(MessageService.Plugin plugin) { var activePluginButton = new Button { Text = plugin.PluginName, Width = activePluginsList.Width - 8, //Anchor = AnchorStyles.Left | AnchorStyles.Right, }; activePluginButtons[activePluginButton] = plugin; //when the active plugin is clicked in the list, load up its config options in the options panel activePluginButton.Click += (sender, args) => { pluginOptionsPanel.Controls.Clear(); pluginOptionsPanel.Controls.Add(GetOptionsPanel(plugin)); currentSelectedPluginButton = activePluginButton; }; activePluginsList.Controls.Add(activePluginButton); }