private async Task PopulateUpdateLog() { try { using var httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Add("User-Agent", "Pinpoint"); var json = await httpClient.GetStringAsync("https://api.github.com/repos/dkgv/pinpoint/releases"); var releases = JsonConvert.DeserializeObject <List <Release> >(json); var sb = new StringBuilder(); sb.Append("# Changelog\n"); foreach (var release in releases) { sb.Append("## [Pinpoint ").Append(release.TagName).Append("](").Append(release.Assets[0].BrowserDownloadUrl).Append(")\n"); sb.Append("*Released on ").Append(DateTime.Parse(release.PublishedAt, new DateTimeFormatInfo())).Append(".*\n\n"); sb.Append(release.Body.Replace("\r\n", "<br>")).Append("\n\n"); } var md = new Markdown(); var html = md.Transform(sb.ToString()); Dispatcher.Invoke(() => UpdateLog.NavigateToString(html)); } catch (HttpRequestException) { } }
private async Task DownloadChangelog() { try { using var httpClient = new HttpClient(); var html = await httpClient.GetStringAsync("https://usepinpoint.com/api/github_changelog"); Dispatcher.Invoke(() => UpdateLog.NavigateToString(html)); } catch (HttpRequestException) { } }