private async void loginButton_Click(object sender, EventArgs e) { oper.Id = username.Text.ToUpper(); oper.password = password.Text.ToUpper(); try { loginButton.Enabled = false; var response = await pts.loginOperatorAsync(oper, testSet); var PTSresponse = response.ToList(); if (PTSresponse[(int)PTSField.RESPONSE_STATUS] == "0") { oper.loggedIn = true; testSet.oper = oper; this.Close(); } else { loginButton.Enabled = true; loginStatusLabel.Text = PTSresponse[(int)PTSField.RESPONSE_STATUS + 2]; password.SelectAll(); } oper.name = PTSresponse[(int)PTSField.RESPONSE_STATUS + 2]; } catch (Exception ex) { loginStatusLabel.Text = "No response from PTS. Check network connection"; logger.Error(ex); } }
private async Task <IEnumerable <string> > login() { PTStransaction pts = new PTStransaction(); if (this.name != null && this.password != null) { try { var response = await pts.loginOperatorAsync(this, tset); return(response.ToList()); } catch (Exception ex) { logger.Error(tset.sessionInfo, "Exception in Operator.login: " + ex.Message); } } return(null); //either name or password was null }