/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Authenticator_DoWork(object sender, DoWorkEventArgs e) { MattimonAgentLibrary.Tools.GUITools.SetControlPropertyThreadSafe(btnNext, "Enabled", false); try { LoadingScreenThreadSafe(true); AuthenticationRequest authenticationRequest = new AuthenticationRequest(); UserAuthentication item = authenticationRequest.GetUserAuthentication(new UserAuthentication { User_email = textBox1.Text.Trim(), User_Agent_ID = textBox2.Text.Trim() }); Boolean proceed = true; if (item.MySqlExceptionErrno > 0) { MessageBox.Show("Internal Server Error\n\n" + item.MySqlExceptionError, "Internet Server Error (MySql)", MessageBoxButtons.OK, MessageBoxIcon.Error); proceed = false; } if (item.Exception != null) { MessageBox.Show("Internal Server Error\n\n" + item.Exception.Message + "\n\n" + item.Exception.StackTrace, "Internet Server Error (500)", MessageBoxButtons.OK, MessageBoxIcon.Error); proceed = false; } if (item.HttpRequestException != null) { MessageBox.Show("Http Request Exception\n\n" + item.HttpRequestException.Message + "\n\n" + item.HttpRequestException.StackTrace, "Http Request Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); proceed = false; } if (proceed) { if (!item.Auth_Ok) { LoadingScreenThreadSafe(false); MessageBox.Show("The credentials you provided are invalid. Please try again.\n\nIf you beleive this is an error, please contact us.", "Authentication Failure", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { LoadingScreenThreadSafe(false); MessageBox.Show("Your credentials are ok. You may now proceed with the installation!\n\n" + "Company: " + item.Company_Name, "Authentication Success", MessageBoxButtons.OK, MessageBoxIcon.Information); SelectIntervalsScreenThreadSafe(true); // Enable next button GUITools.SetControlPropertyThreadSafe(btnNext, "Enabled", true); //this.NextWindow(item); this.UserAuthentication = item; SelectIntervalsScreenThreadSafe(true); } } else { MessageBox.Show("The Installer will now exit.", "Message", MessageBoxButtons.OK, MessageBoxIcon.None); Application.Exit(); } } catch (HttpRequestException httprex) { LoadingScreenThreadSafe(false); MessageBox.Show(httprex.ToString(), "Http Request Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); MattimonAgentLibrary.Tools.GUITools.SetControlPropertyThreadSafe(btnNext, "Enabled", true); } catch (Exception ex) { LoadingScreenThreadSafe(false); MessageBox.Show(ex.ToString(), "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); MattimonAgentLibrary.Tools.GUITools.SetControlPropertyThreadSafe(btnNext, "Enabled", true); } }