private async Task LoadGithubInfos(bool showMsg = false) { //Releases var releasesResult = await WebApiUtil.Catch(() => _githubApi.GetReleasesAsync(_globalConfig.Github.User, _globalConfig.Github.Repository)); if (!string.IsNullOrEmpty(releasesResult.Error)) { if (showMsg) { _dialogService.ShowMessage(releasesResult.Error, MessageButton.OK, MessageType.Error); } Logger.Instance.Module.Error($"[ Github ] LoadGithubInfos, Get releases error: {releasesResult.Error}"); return; } ReleaseViewModels.AddRange(releasesResult.Output.Select(m => new GithubReleaseViewModel(m))); //Repository var repositoryResult = await WebApiUtil.Catch(() => _githubApi.GetRepositoryAsync(_globalConfig.Github.User, _globalConfig.Github.Repository)); if (!string.IsNullOrEmpty(repositoryResult.Error)) { if (showMsg) { _dialogService.ShowMessage(repositoryResult.Error, MessageButton.OK, MessageType.Error); } Logger.Instance.Module.Error($"[ Github ] LoadGithubInfos, Get repository error: {repositoryResult.Error}"); return; } if (repositoryResult.Output == null) { return; } RepositoryModel = new GithubRepositoryViewModel(repositoryResult.Output); //Contributors var contributorsResult = await WebApiUtil.Catch(() => _githubApi.GetContributorsAsync(RepositoryModel.ContributorsUrl)); if (!string.IsNullOrEmpty(contributorsResult.Error)) { Logger.Instance.Module.Error($"[ Github ] LoadGithubInfos, Get contributors error: {contributorsResult.Error}"); return; } Contributors = contributorsResult.Output.Select(u => new GithubUserViewModel(u)).ToArray(); //Stargazers var stargazersResult = await WebApiUtil.Catch(() => _githubApi.GetStargazersAsync(RepositoryModel.StargazersUrl)); if (!string.IsNullOrEmpty(stargazersResult.Error)) { Logger.Instance.Module.Error($"[ Github ] LoadGithubInfos, Get stargazers error: {stargazersResult.Error}"); return; } Stargazers = stargazersResult.Output.Take(20).Select(u => new GithubUserViewModel(u)).ToArray(); //Subscribers var subscribersResult = await WebApiUtil.Catch(() => _githubApi.GetSubscribersAsync(RepositoryModel.SubscribersUrl)); if (!string.IsNullOrEmpty(subscribersResult.Error)) { Logger.Instance.Module.Error($"[ Github ] LoadGithubInfos, Get subscribers error: {subscribersResult.Error}"); return; } Subscribers = subscribersResult.Output.Take(20).Select(u => new GithubUserViewModel(u)).ToArray(); //Forkers var forkersResult = await WebApiUtil.Catch(() => _githubApi.GetForkersAsync(RepositoryModel.ForksUrl)); if (!string.IsNullOrEmpty(forkersResult.Error)) { Logger.Instance.Module.Error($"[ Github ] LoadGithubInfos, Get forkers error: {forkersResult.Error}"); return; } Forkers = forkersResult.Output.Take(20).Select(f => new GithubUserViewModel(f.owner)).ToArray(); }