async Task ConfirmAddExtension() { if (_addingExtensionId is null || _addingExtensionId <= 0) { CancelAddExtension(); return; } _savingExtension = true; // Yield thread to let UI to update await Task.Yield(); await InstructionSetExtensionsByProcessorService.CreateAsync(Id, _addingExtensionId.Value, (await UserManager. GetUserAsync(_authState.User)).Id); _processorExtensions = await InstructionSetExtensionsByProcessorService.GetByProcessor(Id); _addingExtension = false; _savingExtension = false; _addingExtensionId = null; // Yield thread to let UI to update await Task.Yield(); // Tell we finished loading StateHasChanged(); }
async void ConfirmDelete() { if (_currentInstructionByMachine is null) { return; } _deleteInProgress = true; // Yield thread to let UI to update await Task.Yield(); await InstructionSetExtensionsByProcessorService.DeleteAsync(_currentInstructionByMachine.Id, (await UserManager. GetUserAsync(_authState.User)).Id); _processorExtensions = await InstructionSetExtensionsByProcessorService.GetByProcessor(Id); _deleteInProgress = false; _frmDelete.Hide(); // Yield thread to let UI to update await Task.Yield(); // Tell we finished loading StateHasChanged(); }
protected override async Task OnAfterRenderAsync(bool firstRender) { if (_loaded) { return; } _loaded = true; _creating = NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant(). StartsWith("admin/processors/create", StringComparison.InvariantCulture); if (Id <= 0 && !_creating) { return; } _companies = await CompaniesService.GetAsync(); _instructionSets = await InstructionSetsService.GetAsync(); _model = _creating ? new ProcessorViewModel() : await Service.GetAsync(Id); _instructionSetExtensions = await InstructionSetExtensionsService.GetAsync(); _processorExtensions = await InstructionSetExtensionsByProcessorService.GetByProcessor(Id); _authState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); _editing = _creating || NavigationManager.ToBaseRelativePath(NavigationManager.Uri).ToLowerInvariant(). StartsWith("admin/processors/edit/", StringComparison.InvariantCulture); if (_editing) { SetCheckboxes(); } StateHasChanged(); }