private UIComponentNode AddDefinition(IUIComponentDefinition definition) { var node = GetOrAddNode(definition.Name); node.SetDefinition(definition); return(node); }
public IDisposable Add(IUIComponentDefinition definition) { var node = AddDefinition(definition); return(Disposable.Create(() => { node.definition?.Dispose(); node.definition = default; })); }
public IDisposable Add(UIComponentLocation location, IUIComponentDefinition definition) { var node = GetNode(location); node.AddDefinition(definition); return(Disposable.Create(() => { node.definition?.Dispose(); node.definition = default; })); }
private void SetDefinition(IUIComponentDefinition definition) { if (this.definition is null) { this.definition = definition; if (children is not null) { foreach (var item in children.Values.Where(n => n.definition is not null)) { item.definition !.OnParentDefined(definition); } } options?.ForEach(o => o(definition)); definition.UpdateBindings(graph.ComponentContext); } foreach (var item in definition.Items) { GetOrAddNode(item.Name).SetDefinition(item); } }
void IUIComponentDefinition.OnParentDefined(IUIComponentDefinition parent) { }
void IUIComponentDefinition.OnParentDefined(IUIComponentDefinition parent) => ((ToolBarDefinition)parent).Add(this);
void IUIComponentDefinition.OnParentDefined(IUIComponentDefinition parent) => ((IUIComponentDefinition <MenuItemDefinition>)parent).Add(this);