private void InitializeCommitCount() { ThreadHelper.JoinableTaskFactory.RunAsync( async() => { await TaskScheduler.Default.SwitchTo(alwaysYield: true); var(totalCommits, commitsPerUser) = _module.GetCommitsByContributor(); await this.SwitchToMainThreadAsync(); TotalCommits.Text = string.Format(_commits.Text, totalCommits); var builder = new StringBuilder(); var commitCountValues = new decimal[commitsPerUser.Count]; var commitCountLabels = new string[commitsPerUser.Count]; var n = 0; foreach (var(user, commits) in commitsPerUser) { builder.AppendLine($"{commits:N0} {user}"); commitCountValues[n] = commits; commitCountLabels[n] = string.Format(_commitsBy.Text, commits, user); n++; } CommitCountPie.SetValues(commitCountValues); CommitCountPie.ToolTips = commitCountLabels; CommitStatistics.Text = builder.ToString(); }); }