private async void btnLogin_Click(object sender, EventArgs e) { String Username, Password; bool LoginRes; Username = txtUserName.Text.ToString(); Password = txtPassWord.Text.ToString(); try { LoginRes = await ControlerMethods.LoginAsync(Username, Password); if (LoginRes) { EMP emp = await ControlerMethods.GetEmpAsync(Username); FrmEmpMain frmEmpMain = new FrmEmpMain(emp); frmEmpMain.Show(); exitApp = false; this.Close(); } else { MessageBox .Show("خواهشمند است اطلاعات را با دقت وارد نمایید ", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); txtPassWord.Text = ""; txtPassWord.Text = ""; } } catch { MessageBox .Show("لطفا دوباره امتحان کنید ", "خطا", MessageBoxButtons.OK, MessageBoxIcon.Error); } }