Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="model"></param>
        /// <param name="formatForParentControl"></param>
        /// <param name="htmlString"></param>
        /// <returns></returns>
        public string GetFullSummary(object model, bool formatForParentControl, string htmlString)
        {
            using (StringWriter htmlWriter = new StringWriter())
            {
                if (model is ICLEMDescriptiveSummary)
                {
                    ICLEMDescriptiveSummary cm = model as ICLEMDescriptiveSummary;
                    htmlWriter.Write(cm.ModelSummaryOpeningTags(formatForParentControl));

                    htmlWriter.Write(cm.ModelSummaryInnerOpeningTagsBeforeSummary());

                    htmlWriter.Write(cm.ModelSummary(formatForParentControl));

                    htmlWriter.Write(cm.ModelSummaryInnerOpeningTags(formatForParentControl));

                    foreach (var item in (model as IModel).Children)
                    {
                        htmlWriter.Write(GetFullSummary(item, true, htmlString));
                    }
                    htmlWriter.Write(cm.ModelSummaryInnerClosingTags(formatForParentControl));

                    htmlWriter.Write(cm.ModelSummaryClosingTags(formatForParentControl));
                }
                return(htmlWriter.ToString());
            }
        }
Exemple #2
0
        ///<inheritdoc/>
        public string GetFullSummary(IModel model, List <string> parentControls, string htmlString, Func <string, string> markdown2Html = null)
        {
            using (StringWriter htmlWriter = new StringWriter())
            {
                if (model is ICLEMDescriptiveSummary)
                {
                    ICLEMDescriptiveSummary cm = model as ICLEMDescriptiveSummary;
                    cm.CurrentAncestorList = parentControls.ToList();
                    cm.CurrentAncestorList.Add(model.GetType().Name);

                    htmlWriter.Write(cm.ModelSummaryOpeningTags());

                    htmlWriter.Write(cm.ModelSummaryInnerOpeningTagsBeforeSummary());

                    htmlWriter.Write(cm.ModelSummary());

                    htmlWriter.Write(cm.ModelSummaryInnerOpeningTags());

                    foreach (var item in (model as IModel).Children)
                    {
                        htmlWriter.Write(GetFullSummary(item, cm.CurrentAncestorList, htmlString, markdown2Html));
                    }
                    htmlWriter.Write(cm.ModelSummaryInnerClosingTags());

                    htmlWriter.Write(cm.ModelSummaryClosingTags());
                }
                return(htmlWriter.ToString());
            }
        }