@using System.Collections @inject UpdateService UpdateService @inject NavigationManager NavigationManager
@foreach (var downloadLink in DownloadLinks) { }
@code { class DownloadLink { public string Name { get; set; } public string Url { get; set; } public string Icon { get; set; } } IEnumerable DownloadLinks = new List(); readonly Hashtable _iconMap = new() { [LauncherPlatform.Windows] = IconType.Fill.Windows, [LauncherPlatform.Linux] = IconType.Outline.Qq, // Not Linux, but QQ penguin [LauncherPlatform.macOS] = IconType.Fill.Apple, }; protected override async Task OnInitializedAsync() { var artifacts = await UpdateService.GetLauncherArtifactsAsync(); DownloadLinks = artifacts .OrderBy(a => a.Platform) .ThenBy(a => a.Architecture) .Select(a => new DownloadLink { Name = $"{a.Platform} ({a.Architecture})", Icon = _iconMap[a.Platform].ToString(), Url = a.Url }); } }