private void PopulateSubmoduleDataGrid() { List<string> submodules; try { submodules = ParseGitmoduleFile(FileTextBox.Text + @"\.gitmodules"); } catch { System.Windows.MessageBox.Show("Error opening .gitmodules!", "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } GithubAPI.CheckResetTime(); if (submodules.Count > GithubAPI.RequestsLeft) { string message = String.Format("Submodule count ({0}) exceeds github requests ({1})! Please wait until {2}.", submodules.Count, GithubAPI.RequestsLeft, GithubAPI.ResetTime.ToString("h:mm:tt")); System.Windows.MessageBox.Show(message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); return; } submodules.ForEach(url => SubmoduleInfos.Add(GithubAPI.ParseURL(url))); var task = new Task(() => GetReadmes(this, SubmoduleInfos)); task.Start(); SubmoduleDataGrid.ItemsSource = SubmoduleInfos; }
public static async void PopulateReadmes(ProgressDialogController window, List<SubmoduleInfo> infos, Octokit.GitHubClient github, Dictionary<string, string> readmes) { string preferred; int currentCount = 0; foreach (SubmoduleInfo s in infos) { if (currentCount > infos.Count) break; preferred = GithubAPI.GetReadme(github, s.Owner, s.Name).Result.Content; window.SetProgress(currentCount); readmes[s.Name] = preferred; currentCount++; } await window.CloseAsync(); }