Пример #1
0
        private void DisplayRecursive(CommandReportBase displayedReport, OrderedList.OrderedList output)
        {
            ListItem li = new ListItem();

            output.P().Children.Add(li);

            StackPanel liSP = new StackPanel();

            li.Content = liSP;


            StringBuilder sb = new StringBuilder();

            if (!string.IsNullOrEmpty(displayedReport.Contents))
            {
                sb.Append(displayedReport.Contents);
            }

            if (KnownOperations != null && displayedReport.CommandType != null && displayedReport.CommandType.FullName != null &&
                KnownOperations.ContainsKey(displayedReport.CommandType.FullName))
            {
                sb.Append(string.Format(" {0}", KnownOperations[displayedReport.CommandType.FullName]));
            }
            else
            {
                sb.Append(string.Format(" "));
            }

            liSP.Children.Add(new Label()
            {
                Content = sb.ToString(), FontSize = 12, Padding = ViewToolkitResources.Thickness5
            });

            if (displayedReport is NestedCommandReport)
            {
                OrderedList.OrderedList sublist = new OrderedList.OrderedList()
                {
                    NumberType = NumberTypes.Disc
                };
                liSP.Children.Add(sublist);
                sublist.Content = new StackPanel();
                foreach (CommandReportBase c in ((NestedCommandReport)displayedReport).NestedReports)
                {
                    DisplayRecursive(c, sublist);
                }
            }
        }
Пример #2
0
        protected OrderedList.OrderedList RenderContents()
        {
            OrderedList.OrderedList topLevel = new OrderedList.OrderedList()
            {
                NumberType = NumberTypes.Disc
            };
            topLevel.Content = new StackPanel();

            if (DisplayedReport != null)
            {
                CommandReportBase report = DisplayedReport;

                if (report is NestedCommandReport && string.IsNullOrEmpty(report.Contents))
                {
                    OrderedList.OrderedList subOL = new OrderedList.OrderedList()
                    {
                        NumberType = NumberTypes.Disc
                    };
                    subOL.Content = new StackPanel();
                    topLevel.P().Children.Add(subOL);
                    foreach (CommandReportBase c in ((NestedCommandReport)report).NestedReports)
                    {
                        DisplayRecursive(c, subOL);
                    }
                }
                else
                {
                    OrderedList.OrderedList subOL = new OrderedList.OrderedList()
                    {
                        NumberType = NumberTypes.Disc
                    };
                    subOL.Content = new StackPanel();
                    topLevel.P().Children.Add(subOL);
                    DisplayRecursive(report, subOL);
                }
            }

            if (DisplayedLog != null)
            {
                foreach (LogMessage logMessage in DisplayedLog.Errors)
                {
                    ListItem   liOuter  = new ListItem();
                    StackPanel liOuterP = new StackPanel();
                    liOuter.Content = liOuterP;
                    topLevel.P().Children.Add(liOuter);
                    liOuterP.Children.Add(new Label()
                    {
                        Content = logMessage.MessageText, FontSize = 12, Padding = ViewToolkitResources.Thickness5
                    });
                    IEnumerable <ILogMessage> relatedMessages = DisplayedLog.Where(m => m.RelatedMessage == logMessage);
                    if (relatedMessages.Count() > 0)
                    {
                        OrderedList.OrderedList innerOL = new OrderedList.OrderedList()
                        {
                            NumberType = NumberTypes.Disc
                        };
                        innerOL.Content = new StackPanel();
                        liOuterP.Children.Add(innerOL);
                        foreach (LogMessage relatedMessage in relatedMessages)
                        {
                            ListItem innerLI = new ListItem();
                            innerOL.P().Children.Add(innerLI);
                            innerLI.Content = new Label()
                            {
                                Content = relatedMessage.MessageText, FontSize = 12, Padding = new Thickness(5)
                            };
                        }
                    }
                }
            }

            return(topLevel);
        }