示例#1
0
    public UIComponentNode GetNode(UIComponentLocation location)
    {
        var node = this;

        foreach (var name in location.PathSegments)
        {
            node = node.GetOrAddNode(name);
        }

        return(node);
    }
示例#2
0
    public IDisposable Add(UIComponentLocation location, IUIComponentDefinition definition)
    {
        var node = GetNode(location);

        node.AddDefinition(definition);

        return(Disposable.Create(() =>
        {
            node.definition?.Dispose();
            node.definition = default;
        }));
    }
示例#3
0
    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)));
    }
示例#4
0
 public IUIComponentDefinition?Find(UIComponentLocation location)
 => root.GetNode(location).Definition;
示例#5
0
 public IDisposable Add <TDefinition>(UIComponentLocation location, TDefinition definition)
     where TDefinition : IUIComponentDefinition
 => root.Add(location, definition);