Example #1
0
        public IAdaptable CreateAdaptable(XNode node)
        {
            IAdaptable a = null;

            if (node is XElement)
            {
                XElement e        = (XElement)node;
                XName    nodeName = e.Name;
                switch (nodeName.ToString())
                {
                case TAG_SHEET:
                    a = new XMindSheet(e, this);
                    break;

                case TAG_TOPIC:
                    a = new XMindTopic(e, this);
                    break;
                }
            }
            if (a != null)
            {
                // Logger.Info($"XMindWorkbook.CreateAdaptable: adaptable is created - {a}");
            }
            else
            {
                // Logger.Warn($"XMindWorkbook.CreateAdaptable: adaptable was is not created - {a}");
            }
            return(a);
        }
Example #2
0
        public override ITopic CreateTopic()
        {
            var topicElement = new XElement(TAG_TOPIC);
            // GetWorkbookElement().Add(topicElement);
            XMindTopic topic = new XMindTopic(topicElement, this);

            _adaptableRegistry.RegisterByNode(topic, topic.Implementation);
            return(topic);
        }
        /// <summary>
        /// Register topic. Note <see cref="ITopic"/> is not included in DOM of <see cref="XMindWorkBook"/>
        /// </summary>
        /// <returns>Registered XMindTopic</returns>
        public override ITopic CreateTopic()
        {
            var        topicElement = new XElement(TAG_TOPIC);
            XMindTopic topic        = new XMindTopic(topicElement, this)
            {
                OwnedSheet = GetPrimarySheet()
            };

            Logger.Log.DebugTrace($"Register topic {topic.GetId()} for {Name}");
            _adaptableRegistry.RegisterByNode(topic, topic.Implementation);
            return(topic);
        }
        public IAdaptable?CreateAdaptable(XNode node)
        {
            IAdaptable?adaptable = null;

            if (node is XElement e)
            {
                XName nodeName = e.Name;
                switch (nodeName.ToString())
                {
                case TAG_SHEET:
                    adaptable = new XMindSheet(e, this);
                    break;

                case TAG_TOPIC:
                    adaptable = new XMindTopic(e, this);
                    break;
                }
            }
            if (adaptable is null)
            {
                Logger.Log.Warning($"XMindWorkbook.CreateAdaptable: adaptable was is not created - {adaptable}");
            }
            return(adaptable);
        }