fix mysql playout builds (#2352)
* more cancellation tokens and fixes * so much cancellation token * fix mysql playout builds
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
|
||||
|
||||
@code {
|
||||
private readonly CancellationTokenSource _cts = new();
|
||||
private CancellationTokenSource _cts;
|
||||
|
||||
[CascadingParameter]
|
||||
IMudDialogInstance MudDialog { get; set; }
|
||||
@@ -61,8 +61,8 @@
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_cts.Cancel();
|
||||
_cts.Dispose();
|
||||
_cts?.Cancel();
|
||||
_cts?.Dispose();
|
||||
}
|
||||
|
||||
private bool CanSubmit() =>
|
||||
@@ -70,19 +70,31 @@
|
||||
|
||||
protected override async Task OnParametersSetAsync()
|
||||
{
|
||||
_newLibrary = new LocalLibraryViewModel(-1, "(New Library)", MediaKind, -1);
|
||||
_cts?.Cancel();
|
||||
_cts?.Dispose();
|
||||
_cts = new CancellationTokenSource();
|
||||
var token = _cts.Token;
|
||||
|
||||
_libraries = await Mediator.Send(new GetAllLocalLibraries(), _cts.Token)
|
||||
.Map(list => list.Filter(ll => ll.MediaKind == MediaKind && ll.Id != SourceLibraryId))
|
||||
.Map(list => new[] { _newLibrary }.Append(list.OrderBy(vm => vm.Name, StringComparer.CurrentCultureIgnoreCase)).ToList());
|
||||
|
||||
if (MemoryCache.TryGetValue("MoveLocalLibraryPathDialog.SelectedLibraryId", out int id))
|
||||
try
|
||||
{
|
||||
_selectedLibrary = _libraries.SingleOrDefault(c => c.Id == id) ?? _newLibrary;
|
||||
_newLibrary = new LocalLibraryViewModel(-1, "(New Library)", MediaKind, -1);
|
||||
|
||||
_libraries = await Mediator.Send(new GetAllLocalLibraries(), token)
|
||||
.Map(list => list.Filter(ll => ll.MediaKind == MediaKind && ll.Id != SourceLibraryId))
|
||||
.Map(list => new[] { _newLibrary }.Append(list.OrderBy(vm => vm.Name, StringComparer.CurrentCultureIgnoreCase)).ToList());
|
||||
|
||||
if (MemoryCache.TryGetValue("MoveLocalLibraryPathDialog.SelectedLibraryId", out int id))
|
||||
{
|
||||
_selectedLibrary = _libraries.SingleOrDefault(c => c.Id == id) ?? _newLibrary;
|
||||
}
|
||||
else
|
||||
{
|
||||
_selectedLibrary = _newLibrary;
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
_selectedLibrary = _newLibrary;
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user