void checkLogin(string site, PictureBox PB) { PB.Image = Properties.Resources.LoginStandby; if (worker.checkLogin(site)) { PB.Image = Properties.Resources.LoginOK; } else { PB.Image = Properties.Resources.LoginFailed; } }
async void checkLogin(string site, PictureBox PB) { try { PB.Image = Properties.Resources.LoginStandby; if (await worker.checkLogin(site)) { PB.Image = Properties.Resources.LoginOK; } else { PB.Image = Properties.Resources.LoginFailed; } } catch (Exception ex) { MessageBox.Show(this, "An error occured: " + ex.Message, ex.GetType().Name); } }