public UIComponentNode GetNode(UIComponentLocation location) { var node = this; foreach (var name in location.PathSegments) { node = node.GetOrAddNode(name); } return(node); }
public IDisposable Add(UIComponentLocation location, IUIComponentDefinition definition) { var node = GetNode(location); node.AddDefinition(definition); return(Disposable.Create(() => { node.definition?.Dispose(); node.definition = default; })); }
public IDisposable AddConfiguration <TDefinition>(UIComponentLocation location, Action <TDefinition> options) where TDefinition : IUIComponentDefinition { if (location is null) { throw new ArgumentNullException(nameof(location)); } if (options is null) { throw new ArgumentNullException(nameof(options)); } return(root.GetNode(location).AddConfiguration(o => options((TDefinition)o))); }
public IUIComponentDefinition?Find(UIComponentLocation location) => root.GetNode(location).Definition;
public IDisposable Add <TDefinition>(UIComponentLocation location, TDefinition definition) where TDefinition : IUIComponentDefinition => root.Add(location, definition);