// To access the button enabled property in a thread safe manner public void SetBtn(Control ctrl, bool a) { if (ctrl.InvokeRequired) { SetBtnCallback d = new SetBtnCallback(SetBtn); ctrl.Invoke(d, new object[] { ctrl, a }); } else { ctrl.Enabled = a; } }
private void ButtonsSet(bool a, bool b, bool c) { if (this.StartBtn.InvokeRequired || this.CancelBtn.InvokeRequired || this.BrowseBtn.InvokeRequired) { SetBtnCallback d = new SetBtnCallback(ButtonsSet); this.Invoke(d, new object[] { a, b, c }); } else { StartBtn.Enabled = a; BrowseBtn.Enabled = b; CancelBtn.Enabled = c; } }
private void BloquearDesbloquearBotoesDeDownload(bool acao) { var btnDelegade = new SetBtnCallback(DesabilitarOuHabilitarBotoes); this.Invoke(btnDelegade, new object[] { new List <Button> { btnDevDownload, btnHomologDownload, btnProdDownload }, acao }); }