wabbajack/Wabbajack.App.Blazor/Pages/Gallery.razor

48 lines
1.3 KiB
Plaintext
Raw Normal View History

2022-01-09 13:33:22 +00:00
@page "/gallery"
2022-01-15 06:29:44 +00:00
@namespace Wabbajack.App.Blazor.Pages
2022-01-09 13:33:22 +00:00
@using Wabbajack.Networking.WabbajackClientApi;
@using Wabbajack.DTOs
@using System.Diagnostics
@using Microsoft.Extensions.Logging
@using Wabbajack.App.Blazor.Models
2022-01-09 13:33:22 +00:00
@inject Client _client
<div id="content">
2022-01-11 15:05:48 +00:00
@foreach (ModlistMetadata item in _listItems)
2022-01-09 13:33:22 +00:00
{
2022-01-11 15:05:48 +00:00
<ModlistItem Metadata=@item></ModlistItem>
2022-01-09 13:33:22 +00:00
}
2022-01-11 16:26:47 +00:00
</div>
@code {
[Inject]
private ILogger<Gallery> _logger { get; set; }
// [Inject]
// private LoggerProvider _loggerProvider { get; set; }
[Inject]
private Services.OSIntegrated.Configuration _configuration { get; set; }
2022-01-11 16:26:47 +00:00
private List<ModlistMetadata> _listItems { get; set; } = new() { };
2022-01-11 16:26:47 +00:00
protected override async Task OnInitializedAsync()
{
2022-01-11 16:26:47 +00:00
try
{
_logger.LogInformation("Getting modlists...");
2022-01-11 16:26:47 +00:00
ModlistMetadata[] modLists = await _client.LoadLists();
_listItems.AddRange(modLists.ToList());
2022-01-11 16:26:47 +00:00
StateHasChanged();
}
catch (Exception ex)
{
//TODO: [Critical] Figure out why an exception is thrown on first navigation.
Debug.Print(ex.Message);
_logger.LogError(ex, "Error while loading lists");
2022-01-11 16:26:47 +00:00
}
await base.OnInitializedAsync();
2022-01-11 16:26:47 +00:00
}
}