/// <summary>
        /// Adds a section that contains only a string
        /// </summary>
        /// <param name="setting">true if it should add the segment</param>
        /// <param name="sectionName">name of the section to add</param>
        /// <param name="sectionTitle">title of the section</param>
        private void AddStringSection(bool setting, string sectionName, string sectionTitle)
        {
            string propertyValue;

            if (!setting || (propertyValue = HelpParagraphBuilder.GetPropertyString(this.psObj, sectionName)) == null)
            {
                return;
            }

            this.AddText(sectionTitle, true);
            this.AddText("\r\n", false);
            this.AddText(HelpParagraphBuilder.AddIndent(propertyValue), false);
            this.AddText("\r\n\r\n", false);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the HelpViewModel class
        /// </summary>
        /// <param name="psObj">object containing help</param>
        /// <param name="documentParagraph">paragraph in which help text is built/searched</param>
        internal HelpViewModel(PSObject psObj, Paragraph documentParagraph)
        {
            Debug.Assert(psObj != null, "ensured by caller");
            Debug.Assert(documentParagraph != null, "ensured by caller");

            this.helpBuilder = new HelpParagraphBuilder(documentParagraph, psObj);
            this.helpBuilder.BuildParagraph();
            this.searcher = new ParagraphSearcher();
            this.helpBuilder.PropertyChanged += new PropertyChangedEventHandler(this.HelpBuilder_PropertyChanged);
            this.helpTitle = string.Format(
                CultureInfo.CurrentCulture,
                HelpWindowResources.HelpTitleFormat,
                HelpParagraphBuilder.GetPropertyString(psObj, "name"));
        }