@using LANCommander.SDK.Enums
@inject StorageLocationService StorageLocationService
@code {
[Parameter] public StorageLocation Value { get; set; } = new();
[Parameter] public EventCallback ValueChanged { get; set; }
[Parameter] public StorageLocationType Type { get; set; } = StorageLocationType.Archive;
IEnumerable StorageLocations = new List();
protected override async Task OnInitializedAsync()
{
StorageLocations = await StorageLocationService
.AsNoTracking()
.SortBy(l => l.Path)
.GetAsync(l => l.Type == Type);
Value = StorageLocations.First();
if (ValueChanged.HasDelegate)
await ValueChanged.InvokeAsync(Value);
}
}