private void ShowPreferencesDialog() { using IDisposable scope = s_logger.CreateScope("Show preferences dialog"); Preferences p = new Preferences(s_settings.Clone(), s_issueManager, SettingsFile, CacheFolder, s_logger); if (p.ShowDialog() == DialogResult.OK) { s_settings = p.NewSettings; // the issue manager was not successfully created, that is why we showed the preferences. if (s_issueManager == null) { // this will ensure the GH token is valid s_issueManager = IssueManager.Create(s_settings, CacheFolder, s_logger); } else { // refresh the ZenHub token s_issueManager.RefreshZenHubToken(s_settings.ZenHubToken); // refresh the GitHub token s_issueManager.RefreshGitHubToken(s_settings.GitHubToken); } // save the settings to disk s_settings.Serialize(SettingsFile, s_logger); // refresh the page LoadFormFromSettings(); } }
public static IssueManager Create(Settings settings, string cacheFolder) { IssueManager manager = new IssueManager(cacheFolder); if (!manager.RefreshGitHubToken(settings.GitHubToken)) { return(null); } manager.RefreshZenHubToken(settings.ZenHubToken); return(manager); }
public static IssueManager Create(Settings settings, string cacheFolder, FileLogger fileLogger) { using IDisposable scope = fileLogger.CreateScope($"Creating issue manager with cache folder: {cacheFolder}"); IssueManager manager = new IssueManager(cacheFolder, fileLogger); if (!manager.RefreshGitHubToken(settings.GitHubToken)) { return(null); } manager.RefreshZenHubToken(settings.ZenHubToken); return(manager); }