private void connectAccountButton_Click(object sender, EventArgs e) { LOGGER.Info($"User attempts to connect a new account to the service"); AddYoutubeAccountForm form = new AddYoutubeAccountForm(false); form.ExternalCodeUrl = new YoutubeAccountCommunicator().CreateAuthUri(Client, YoutubeRedirectUri.Code, GoogleScope.Manage).AbsoluteUri; if (form.ShowDialog(this) == DialogResult.OK) { LOGGER.Info($"Adding new account"); Account account = AccountClient.AddAccount(new AuthCode() { clientId = Client.Id, clientSecret = Client.Secret, redirectUri = YoutubeRedirectUri.Code.GetAttribute <EnumMemberAttribute>().Value, code = form.AuthToken }); Accounts.Add(account); accountsListView.Items.Add(new ListViewItem(account.title)); accountsListView.SelectedIndices.Clear(); accountsListView.SelectedIndices.Add(Accounts.Count - 1); LOGGER.Info($"Added account '{account.title}'"); clearAccountsButton.Enabled = true; } else { LOGGER.Info($"User did not finish add youtube account form"); } }