public IpConfigurationConsole(Mqtt mqtt, int width, int height) : base(width, height) { _mqtt = mqtt; Position = new Point(0, 4); UseKeyboard = true; IsFocused = true; var label = new Label(20) { Position = Point.Zero, DisplayText = "MQTT broker IP:" }; _textBox = new TextBox(20) { Position = new Point(0, 1), }; var button = new Button(20) { Text = "Connect", Position = new Point(0, 2) }; button.Click += async(sender, args) => await ButtonOnClick(); Add(label); Add(_textBox); Add(button); FocusedControl = _textBox; }
private static void Init() { var mqtt = new Mqtt(); var tableConsole = new TableConsole(20, 10); var ipConfigConsole = new IpConfigurationConsole(mqtt, 20, 3); mqtt.OnFrameBufferReceived += (sender, bytes) => { tableConsole.Draw(bytes); }; ipConfigConsole.Connected += (sender, args) => { Global.CurrentScreen = tableConsole; }; Settings.ResizeWindow(800, 800); Global.CurrentScreen = ipConfigConsole; }