Ejemplo n.º 1
0
        /// <summary>
        /// Loads a control's content XML into the page's content XML.
        /// </summary>
        /// <param name="record">The record of the file that was found.</param>
        protected void LoadControlXml(
            PageFinder.FileRecord record)
        {
            try {
                if (this.ContentXml == null) {
                    this.ContentXml = new XmlDocument();
                }

                if (this.ContentXml.DocumentElement == null) {
                    this.ContentXml.LoadXml("<Content></Content>");
                }

                if (record != null && !string.IsNullOrEmpty(record.fullPath)) {
                    XmlDocument controlXml = new XmlDocument();

                    controlXml.Load(WebInfo.BasePath + record.fullPath);

                    if (controlXml.DocumentElement != null) {
                        //  append the control's XML to the page's
                        XmlNode nodes = this.ContentXml.ImportNode(controlXml.DocumentElement, true);
                        this.ContentXml.DocumentElement.AppendChild(nodes);
                    }
                } else {
                    LogManager.GetCurrentClassLogger().Warn(warn => warn("Could not find the xml to load."));
                }
            } catch (Exception ex) {
                LogManager.GetCurrentClassLogger().Warn(warn => warn("Error occured when loading the xml document."), ex);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns a refernce to the <i>Singleton</i> instance of the <c>PageFinder</c>.
        /// </summary>
        /// <returns>The <i>Singleton</i> instance of the <c>PageFinder</c>.</returns>
        public static PageFinder GetInstance()
        {
            if (instance == null) {
                lock (syncRoot) {
                    if (instance == null) {
                        instance = new PageFinder();
                        LogManager.GetCurrentClassLogger().Info(
                            infoMessage => infoMessage("PageFinder - instantiated new PageFinder."));
                    }
                }
            }

            return instance;
        }