private void buttonAuth_Click(object sender, EventArgs e) { ConfigManager.GeneralConfig.Account = null; try { WebAPI.AccountAnswer account = WebAPI.Account(textUsername.Text, textPassword.Text); if (account != null) { if (account.success) { ConfigManager.GeneralConfig.Account = new Configs.Data.MinerAccount( account.username, account.first_name, account.last_name, account.uid ); ConfigManager.GeneralConfig.WorkerName = account.worker_name; ConfigManager.GeneralConfigFileCommit(); Close(); } else { linkRecoveryLink.Visible = true; labelServerError.Visible = false; } } else { linkRecoveryLink.Visible = false; labelServerError.Visible = true; } } finally { ConfigManager.GeneralConfigFileCommit(); ConfigManager.SecretConfig.Set(usernameKey, textUsername.Text); } }