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
|
2022-01-16 13:46:16 +00:00
|
|
|
@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 {
|
|
|
|
|
2022-01-16 13:46:16 +00:00
|
|
|
[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
|
|
|
|
2022-01-16 13:46:16 +00:00
|
|
|
private List<ModlistMetadata> _listItems { get; set; } = new() { };
|
2022-01-11 16:26:47 +00:00
|
|
|
|
2022-01-16 13:46:16 +00:00
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
{
|
2022-01-11 16:26:47 +00:00
|
|
|
try
|
|
|
|
{
|
2022-01-16 13:46:16 +00:00
|
|
|
_logger.LogInformation("Getting modlists...");
|
2022-01-11 16:26:47 +00:00
|
|
|
ModlistMetadata[] modLists = await _client.LoadLists();
|
2022-01-16 13:46:16 +00:00
|
|
|
_listItems.AddRange(modLists.ToList());
|
2022-01-11 16:26:47 +00:00
|
|
|
StateHasChanged();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
2022-01-17 16:45:52 +00:00
|
|
|
//TODO: [Critical] Figure out why an exception is thrown on first navigation.
|
2022-01-16 13:46:16 +00:00
|
|
|
Debug.Print(ex.Message);
|
|
|
|
_logger.LogError(ex, "Error while loading lists");
|
2022-01-11 16:26:47 +00:00
|
|
|
}
|
|
|
|
|
2022-01-16 13:46:16 +00:00
|
|
|
await base.OnInitializedAsync();
|
2022-01-11 16:26:47 +00:00
|
|
|
}
|
2022-01-17 16:45:52 +00:00
|
|
|
}
|