1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- @inherits ViewBase
- @code{
- private DiscDialog dlgDisc;
- }
- <DiscDialog @ref="dlgDisc"></DiscDialog>
- <div class="row mt-2">
- <div class="col">
- <LibSelector CurrentLibrary="@CurrentLibrary" OnValueChanged="SelectedLibraryChanged"></LibSelector>
- </div>
- </div>
- <div class="row mt-2">
- <div class="row">
- <div class="col">
- <LibTrackSet CurrentLibrary="@CurrentLibrary"></LibTrackSet>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-12">
- <div class="row">
- <DiscCardList Discs="CurrentLibrary?.Discs" OnClick="(d)=>dlgDisc.Show(d)"></DiscCardList>
- </div>
- </div>
- </div>
- @code {
- private string CurrentLibraryKey { get => LocalStorage.Get<string>(); set => LocalStorage.Set(value); }
- private FeLibrary CurrentLibrary { get; set; }
- protected override async Task OnInitializedAsync()
- {
- await base.OnInitializedAsync();
- if (DataSet.AllLibrary?.Any() == true)
- {
- var clk = CurrentLibraryKey;
- if (DataSet.AllLibrary.Any(p => p.Key == clk)) SelectedLibraryChanged(DataSet.AllLibrary.First(p => p.Key == clk));
- if (CurrentLibrary == null) SelectedLibraryChanged(DataSet.AllLibrary.First());
- }
- }
- public void SelectedLibraryChanged(FeLibrary lib)
- {
- CurrentLibrary = lib;
- CurrentLibraryKey = lib.Key;
- StateHasChanged();
- }
- }
|