public void addButton(MyMessage.Button messageBtn) { Button formBtn = new Button() { Height = 20, Text = messageBtn.Caption }; EventHandler eh = new EventHandler(async(e, s) => await messageBtn.Click(e, s)); formBtn.Click += eh; flowLayoutPanelButtons.Controls.Add(formBtn); }
protected async override Task <bool> Perform() { MyMessage msg = await mngr.GetLastMessage(); MyMessage.Button button = msg.Buttons.Find((MyMessage.Button btn) => { return(btn.Position.Row == Row && btn.Position.Btn == BtnNum); }); if (button != null) { return(await button.Click(null, null)); } else { return(false); ///////////////////////////////BUTTON NOT FOUNT ERROR } }