protected async Task LoadCollectionDataAsync(CancellationToken cancellationToken, IEnumerable <string>?reloadEntityIds = null) { if (CurrentState == null) { throw new InvalidOperationException(); } var uiResolver = await UIResolverFactory.GetListUIResolverAsync(CurrentState.UsageType, CurrentState.CollectionAlias); if (reloadEntityIds?.Any() == true) { var sections = await ReloadSectionsAsync(reloadEntityIds, uiResolver); if (cancellationToken.IsCancellationRequested) { return; } Sections = sections; } else { var listUI = uiResolver.GetListDetails(); var(listContext, sections) = await LoadSectionsAsync(listUI, uiResolver); var buttons = await uiResolver.GetButtonsForEditContextAsync(listContext.ProtoEditContext); var tabs = await uiResolver.GetTabsAsync(listContext.ProtoEditContext); if (cancellationToken.IsCancellationRequested) { return; } try { ListUI = listUI; Buttons = buttons; Tabs = tabs; ListContext = listContext; Sections = sections; PageContents = null; } catch { } } StateHasChanged(); }
protected async Task LoadCollectionDataAsync(CancellationToken cancellationToken, IEnumerable <string>?reloadEntityIds = null) { var uiResolver = await UIResolverFactory.GetListUIResolverAsync(CurrentNavigationState); if (reloadEntityIds?.Any() == true) { var sections = await ReloadSectionsAsync(reloadEntityIds, uiResolver); if (cancellationToken.IsCancellationRequested || ListContext == null) { return; } ListContext.EditContexts.Clear(); ListContext.EditContexts.AddRange(sections.Select(x => x.editContext)); Sections = sections; } else { var listUI = uiResolver.GetListDetails(); var(listContext, sections) = await LoadSectionsAsync(listUI, uiResolver); var buttons = await uiResolver.GetButtonsForEditContextAsync(listContext.ProtoEditContext); var tabs = await uiResolver.GetTabsAsync(listContext.ProtoEditContext); if (cancellationToken.IsCancellationRequested) { return; } try { ListUI = listUI; Buttons = buttons; Tabs = tabs; ListContext = listContext; Sections = sections; PageContents = null; } catch { } } StateHasChanged(); }
protected async Task LoadCollectionDataAsync(IEnumerable <string>?reloadEntityIds = null) { try { if (CurrentState == null) { throw new InvalidOperationException(); } if (reloadEntityIds?.Any() == true) { await ReloadSectionsAsync(reloadEntityIds); } else { UIResolver = await UIResolverFactory.GetListUIResolverAsync(CurrentState.UsageType, CurrentState.CollectionAlias); ListUI = UIResolver.GetListDetails(); var listContext = await LoadSectionsAsync(); var buttons = await UIResolver.GetButtonsForEditContextAsync(listContext.ProtoEditContext); var tabs = await UIResolver.GetTabsAsync(listContext.ProtoEditContext); Buttons = buttons; Tabs = tabs; ListContext = listContext; Sections?.ForEach(x => x.editContext.OnFieldChanged += (s, a) => StateHasChanged()); PageContents = null; } StateHasChanged(); } catch { ListContext = null; Sections = null; ListUI = null; throw; } }
protected async Task LoadNodeDataAsync(CancellationToken cancellationToken) { if (CurrentState == null) { throw new InvalidOperationException(); } var editContext = await PresentationService.GetEntityAsync <GetEntityRequestModel, FormEditContext>(new GetEntityRequestModel { CollectionAlias = CurrentState.CollectionAlias, Id = CurrentState.Id, ParentPath = CurrentState.ParentPath, UsageType = CurrentState.UsageType, VariantAlias = CurrentState.VariantAlias }); var resolver = await UIResolverFactory.GetNodeUIResolverAsync(CurrentState.UsageType, CurrentState.CollectionAlias); var buttons = await resolver.GetButtonsForEditContextAsync(editContext); var sections = new[] { (editContext, await resolver.GetSectionsForEditContextAsync(editContext)) }.ToList();