public void Generate(IReportWriter writer)
        {
            if (doc == null)
            {
                return;
            }

            var document = view.DocumentViewer.Document;

            bool found = false;
            bool first = true;

            foreach (XElement change in doc.Root.Elements("change"))
            {
                string version = (string)change.Attribute("version");
                if (string.IsNullOrEmpty(version))
                {
                    continue;
                }

                bool match = IsSameOrOlder(previousVersion, version);

                if (!found && match)
                {
                    writer.WriteHeading("The following changes were already installed");
                    found = true;
                }

                if (first && !found)
                {
                    writer.WriteHeading("The following changes are now available");
                    first = false;
                }

                string date = (string)change.Attribute("date");

                writer.WriteSubHeading(version + "    " + date);

                foreach (string line in change.Value.Split('\r', '\n'))
                {
                    string trimmed = line.Trim();
                    if (!string.IsNullOrEmpty(trimmed))
                    {
                        string brush = found ? "ListItemForegroundBrush" : "ListItemSelectedForegroundBrush";
                        FlowDocumentReportWriter fwriter = (FlowDocumentReportWriter)writer;
                        Paragraph p = fwriter.WriteParagraph(trimmed, FontStyles.Normal, FontWeights.Normal,
                                                             AppTheme.Instance.GetThemedBrush(brush), null);
                        p.TextIndent = 20;
                        p.Margin     = new Thickness(0);
                        p.Padding    = new Thickness(0);
                    }
                }
            }

            if (installButton && !HasLatestVersion())
            {
                document.Blocks.InsertAfter(document.Blocks.FirstBlock, new BlockUIContainer(CreateInstallButton()));
            }
        }
        public void Generate(IReportWriter writer)
        {
            if (doc == null)
            {
                return;
            }

            var document = view.DocumentViewer.Document;

            bool found = false;
            bool first = true;

            var style = new Style(typeof(Paragraph));

            style.Setters.Add(new Setter(Paragraph.BackgroundProperty, Brushes.Teal));
            style.Setters.Add(new Setter(Paragraph.ForegroundProperty, Brushes.White));
            style.Setters.Add(new Setter(Paragraph.FontSizeProperty, 18.0));
            document.Resources.Remove("HeadingStyle");
            document.Resources.Add("HeadingStyle", style);

            foreach (XElement change in doc.Root.Elements("change"))
            {
                string version = (string)change.Attribute("version");
                if (string.IsNullOrEmpty(version))
                {
                    continue;
                }

                bool match = IsSameOrOlder(previousVersion, version);

                if (!found && match)
                {
                    writer.WriteHeading("The following changes were already installed");
                    found = true;
                }

                if (first && !found)
                {
                    writer.WriteHeading("The following changes are now available");
                    first = false;
                }

                string date = (string)change.Attribute("date");

                writer.WriteSubHeading(version + "    " + date);

                foreach (string line in change.Value.Split('\r', '\n'))
                {
                    string trimmed = line.Trim();
                    if (!string.IsNullOrEmpty(trimmed))
                    {
                        FlowDocumentReportWriter fwriter = (FlowDocumentReportWriter)writer;
                        Paragraph p = fwriter.WriteParagraph(trimmed, FontStyles.Normal, FontWeights.Normal, found ? Brushes.Gray : Brushes.Black, 11);
                        p.TextIndent = 20;
                        p.Margin     = new Thickness(0);
                        p.Padding    = new Thickness(0);
                    }
                }
            }

            if (installButton && !HasLatestVersion())
            {
                document.Blocks.InsertAfter(document.Blocks.FirstBlock, new BlockUIContainer(CreateInstallButton()));
            }
        }