예제 #1
0
        /// <summary>
        /// Deserialize layout
        /// </summary>
        /// <param name="manager">Dock manager for initing objects</param>
        /// <param name="node">Node to parse</param>
        /// <param name="handlerObject">Delegate used to get user defined dockable contents</param>
        public void Deserialize(DockManager manager, XmlNode node, GetContentFromTypeString handlerObject)
        {
            _type        = (CompositionType)Enum.Parse(typeof(CompositionType), node.Attributes[ATTRIBUTE_NAME_TYPE].Value);
            _spaceFactor = double.Parse(node.Attributes[ATTRIBUTE_NAME_SFACTOR].Value, CultureInfo.GetCultureInfo(STORAGE_CULTURE));

            if (_type == CompositionType.Terminal)
            {
                Debug.Assert(node.ChildNodes[0].Name == ELEMENT_NAME_DOCKPANE);

                DockablePane pane = new DockablePane();
                pane.Deserialize(manager, node.ChildNodes[0], handlerObject);
                _attachedPane = pane;

                if (pane.IsDragSupported)
                {
                    manager.DragPaneServices.Register(pane);
                }
            }
            else
            {
                Debug.Assert(node.ChildNodes[0].Name == ELEMENT_NAME_CHILDGROUPS);

                foreach (XmlNode nodeChild in node.ChildNodes[0].ChildNodes)
                {
                    Composition composition = new Composition();
                    composition.Deserialize(manager, nodeChild, handlerObject);
                    _children.Add(composition);
                }
            }

            _isInited = true;
        }
예제 #2
0
        /// <summary>
        /// Deserialize layout.
        /// </summary>
        /// <param name="manager">Dock manager for initing objects.</param>
        /// <param name="rootNode">Node to parse.</param>
        /// <param name="handlerObject">Delegate used to get user defined dockable contents.</param>
        public void Deserialize(DockManager manager,
                                XmlNode rootNode,
                                GetContentFromTypeString handlerObject)
        {
            if (null != _root)
            {
                Debug.Assert(_root.Type == CompositionType.Terminal);
                _root.AttachedPane.Close();
                _root = null;
            }

            if (0 == rootNode.ChildNodes.Count)
            {
                _root = null;
            }
            else
            {
                _root = new Composition();
                _root.Deserialize(manager, rootNode.ChildNodes[0], handlerObject);
                _ArrangeLayout();
            }
        }
        /// <summary>
        /// Deserialize layout.
        /// </summary>
        /// <param name="manager">Dock manager for initing objects.</param>
        /// <param name="rootNode">Node to parse.</param>
        /// <param name="handlerObject">Delegate used to get user defined dockable contents.</param>
        public void Deserialize(DockManager manager,
                                XmlNode rootNode,
                                GetContentFromTypeString handlerObject)
        {
            if (null != _root)
            {
                Debug.Assert(_root.Type == CompositionType.Terminal);
                _root.AttachedPane.Close();
                _root = null;
            }

            if (0 == rootNode.ChildNodes.Count)
                _root = null;
            else
            {
                _root = new Composition();
                _root.Deserialize(manager, rootNode.ChildNodes[0], handlerObject);
                _ArrangeLayout();
            }
        }
        /// <summary>
        /// Deserialize layout
        /// </summary>
        /// <param name="manager">Dock manager for initing objects</param>
        /// <param name="node">Node to parse</param>
        /// <param name="handlerObject">Delegate used to get user defined dockable contents</param>
        public void Deserialize(DockManager manager, XmlNode node, GetContentFromTypeString handlerObject)
        {
            _type = (CompositionType)Enum.Parse(typeof(CompositionType), node.Attributes[ATTRIBUTE_NAME_TYPE].Value);
            _spaceFactor = double.Parse(node.Attributes[ATTRIBUTE_NAME_SFACTOR].Value, CultureInfo.GetCultureInfo(STORAGE_CULTURE));

            if (_type == CompositionType.Terminal)
            {
                Debug.Assert(node.ChildNodes[0].Name == ELEMENT_NAME_DOCKPANE);

                DockablePane pane = new DockablePane();
                pane.Deserialize(manager, node.ChildNodes[0], handlerObject);
                _attachedPane = pane;

                if (pane.IsDragSupported)
                    manager.DragPaneServices.Register(pane);
            }
            else
            {
                Debug.Assert(node.ChildNodes[0].Name == ELEMENT_NAME_CHILDGROUPS);

                foreach (XmlNode nodeChild in node.ChildNodes[0].ChildNodes)
                {
                    Composition composition = new Composition();
                    composition.Deserialize(manager, nodeChild, handlerObject);
                    _children.Add(composition);
                }
            }

            _isInited = true;
        }