public static Tvision2Setup AddTvControls(this Tvision2Setup setup, Action <ISkinManagerBuilder> skinOptions = null)
        {
            var tree = new ControlsTree();

            setup.Builder.ConfigureServices(sc =>
            {
                sc.AddSingleton <ControlsTree>(tree);
                sc.AddSingleton <IControlsTree>(tree);
                sc.AddSingleton <ISkinManager>(new SkinManager());
            });

            setup.AddHook <ChangeFocusEventHook>();

            setup.Options.AfterCreateInvoke((engine, sp) =>
            {
                var skinManager  = sp.GetRequiredService <ISkinManager>() as SkinManager;
                var colorManager = sp.GetRequiredService <IColorManager>();
                if (skinOptions != null)
                {
                    FillSkinManager(skinOptions, skinManager, colorManager);
                }
                else
                {
                    FillDefaultSkinManager(skinManager, colorManager);
                }


                var ctree = sp.GetRequiredService <IControlsTree>() as ControlsTree;
                tree.AttachTo(engine.UI);
            });

            return(setup);
        }
        private TreeListNode AppendNode(PropertiesNode propertiesNode, TreeListNode parent)
        {
            var node = ControlsTree.AppendNode(new object[] { propertiesNode.ControlName }, parent);

            _nodes.Add(propertiesNode, node);
            return(node);
        }
        public void DeleteNode(PropertiesNode childNode, bool ignoreInspector = false)
        {
            if (ControlsTree.FocusedNode.ParentNode.Tag != null)
            {
                var node = FindElement(childNode.GetControl(), ControlsTree.Nodes);

                var focusedPropertiesNodeParent = ((PropertiesNode)node.ParentNode.Tag);

                if (!focusedPropertiesNodeParent.RemoveChild(childNode, ignoreInspector))
                {
                    return;
                }


                ControlsTree.DeleteNode(node);
            }
        }
 public void EndUpdate()
 {
     ControlsTree.EndUpdate();
 }
 public void BeginUpdate()
 {
     ControlsTree.BeginUpdate();
 }