// Register the application with a mastodon instance, // retreive client-credentials and // save them to configuration. public async Task <bool> RegisterApplication(string instance, string appName, string appSite) { using (log.BeginScope($"{ nameof(MastodonInstanceService) }->{ nameof(RegisterApplication) }")) { log.LogDebug("Parameters: {instance}, appName: {appName}, appSite: {appSite}", instance, appName, appSite); try { log.LogDebug("Create mastodon-AppHandler"); using (var appHandler = new AppHandler(instance)) { var appData = await appHandler.CreateAppAsync(appName, scopes, appSite); log.LogDebug("appData returned"); // Save appData cfg.Application.Instance.Name = instance; cfg.Application.Instance.ClientId = appData.client_id; cfg.Application.Instance.ClientSecret = appData.client_secret; cfg.Save(); } } catch (Exception ex) { log.LogError(ex, "RegisterApplication - Exception"); return(false); } } return(true); }
private void SetWorkingPathToolStripMenuItem_Click(object sender, EventArgs e) { var allRepos = appConfiguration.Select(c => c.GitLookerPath).ToList(); var repoSources = new RepoSources(folderBrowserDialog1, allRepos); repoSources.ShowDialog(); var newRepoList = repoSources.RepoList ?? Enumerable.Empty <string>(); if (!newRepoList.Any()) { return; } loggingService.LogInformation($"[{nameof(SetWorkingPathToolStripMenuItem_Click)}] Add git repo directories: {string.Join(";", newRepoList.ToArray())}"); if (noReposLoaded) { SetMenuFunctionIfNoRepos(false); } RemoveRepoTab(GetRepoTabs().Where(r => !newRepoList.Contains(r.RepoConfiguration.GitLookerPath))); foreach (var newRepo in newRepoList.Where(r => !GetRepoTabs().Any(t => t.RepoConfiguration.GitLookerPath == r))) { tabsRepoBuilder.BuildTab(reposCatalogs, Repo_OnSelectRepo, newRepo); } appConfiguration.Save(); SetCurrentTab(); GenerateAndUpdateRepos(); }