Пример #1
0
        ValueTree(ValueTree parent, ValueRefresher refresher = null, ValueGetter getter = null, ValueSetter setter = null, ValueTree.ValueFormatter formatter = null)
        {
            Parent          = parent;
            _all            = parent._all;
            _allByName      = parent._allByName;
            _children       = new Dictionary <int, ValueTree>();
            _childrenByName = new Dictionary <string, ValueTree>();

            Getter    = getter;
            Setter    = setter;
            Formatter = formatter;
            Refresher = refresher;
        }
Пример #2
0
        public ValueTree Create(string name, ValueRefresher refresher = null, ValueGetter getter = null, ValueSetter setter = null, ValueTree.ValueFormatter formatter = null)
        {
            var value = new ValueTree(this, refresher, getter, setter, formatter)
            {
                ID   = _all.Count + 1,
                Name = name
            };

            _all[value.ID]         = value;
            _allByName[value.Name] = value;

            _children[value.ID]         = value;
            _childrenByName[value.Name] = value;

            Children.Add(value);

            return(value);
        }