protected async Task ButtonOnClickAsync(ButtonClickEventArgs args) { try { if (args.ViewModel == null) { throw new ArgumentException($"ViewModel required"); } var command = await EditContextService.ProcessEntityActionAsync( GetUsageType(), CollectionAlias, GetParentPath(), Id, args.EditContext, args.ViewModel.ButtonId, args.Data); await HandleViewCommandAsync(command); } catch (Exception ex) { HandleException(ex); } }
protected override async Task LoadDataAsync(IEnumerable <string>?reloadEntityIds = null) { try { var editContext = await EditContextService.GetEntityAsync(GetUsageType(), CollectionAlias, VariantAlias, GetParentPath(), Id); var resolver = await EditorService.GetNodeUIResolverAsync(GetUsageType(), CollectionAlias); Buttons = await resolver.GetButtonsForEditContextAsync(editContext); Sections = await resolver.GetSectionsForEditContextAsync(editContext); EditContext = editContext; EditContext.OnFieldChanged += (s, a) => StateHasChanged(); StateHasChanged(); } catch { EditContext = null; throw; } }