private void AccountForm_Load(object sender, EventArgs e) { btnGetAccountSubs.Enabled = false; AmsAuthentication.AmsAuthentication client = new LocalLauncher.WinApp.AmsAuthentication.AmsAuthentication(); try { AmsAuthentication.Credential cred = new LocalLauncher.WinApp.AmsAuthentication.Credential(); cred.UserName = Settings.AmsAdminUsername; cred.Secret = Settings.AmsAdminPassword; amsAdminTicket = client.Authenticate(cred); } catch (Exception ex) { MessageBox.Show("Admin Authentication Failure! Please check your admin username and password settings.\n" + ex.Message); this.Close(); } }
private void btnAuthenticate_Click(object sender, EventArgs e) { AmsAuthentication.AmsAuthentication client = new LocalLauncher.WinApp.AmsAuthentication.AmsAuthentication(); try { AmsAuthentication.Credential cred = new LocalLauncher.WinApp.AmsAuthentication.Credential(); cred.UserName = txtAccountName.Text; cred.Secret = txtPassword.Text; amsTicket = client.Authenticate(cred); if (string.IsNullOrEmpty(amsTicket)) { MessageBox.Show("Authentication Fail!"); } else { btnGetAccountSubs.Enabled = true; MessageBox.Show("Authentication Success!"); } } catch (Exception ex) { MessageBox.Show("Authentication Fail!\n" + ex.Message); } }