private FlowDocument LoadPluginDescription() { try { FlowDocument document = new FlowDocument().SetSystemFont(); // Render each plugin bool bNotFirst = false; foreach (PluginDescription plugindesc in Plugins ?? new PluginDescription[] {}) { // Plugin separator if (bNotFirst) { document.Blocks.Add(new BlockUIContainer(new Rectangle { Height = 2, Fill = SystemColors.ControlDarkBrush })); } else { bNotFirst = true; } var sectionPlugin = new Section(); document.Blocks.Add(sectionPlugin); // Plugin heading sectionPlugin.Blocks.Add(new Paragraph { Inlines = { new InlineUIContainer(new Image { Source = plugindesc.Icon, Width = 16, Height = 16, Stretch = Stretch.Uniform, Margin = new Thickness(0, 0, 3, 0) }) { BaselineAlignment = BaselineAlignment.Bottom }, new Bold(new Run(plugindesc.Title)), new Run(" " + Stringtable.PluginWrittenBy + " "), new Run(plugindesc.Author) } }); // Plugin description var sectionDesc = new Section(); sectionDesc.Margin = sectionDesc.Margin.Add(24, 0, 16, 0); sectionPlugin.Blocks.Add(sectionDesc); sectionDesc.Blocks.AddRange(new List <Block>(plugindesc.Description.Blocks)); } // “No plugins in this assembly” case, or “Looking for plugins…” case (not loaded) if ((Plugins ?? new PluginDescription[] {}).Length == 0) { document.Blocks.Add(new Paragraph(new Italic(new Run(IsLoaded ? Stringtable.NoPluginsInAssembly : Stringtable.LookingForPlugins))) { TextAlignment = TextAlignment.Center }); } if (OmeaPluginsPage._showDebugInfo) { // Separator document.Blocks.Add(new BlockUIContainer(new Rectangle { Height = 2, Fill = SystemColors.ControlDarkBrush })); // Debug info Paragraph para = document.AddPara(); para.Append(IsPrimary ? Stringtable.PluginDescDebug_IsPrimary : Stringtable.PluginDescDebug_IsNonPrimary); para.Append(string.Format(" {2} {0} ({1}).", _pluginfileinfo.Folder.Name, _pluginfileinfo.Folder.Location, Stringtable.PluginDescDebug_LoadedFrom)); document.AddPara().Append(string.Format("{1}: {0}", _pluginfileinfo.File.FullName, Stringtable.File)); if (!_pluginfileinfo.Reason.IsEmpty()) // File-lookup-time errors { document.AddPara().Append(_pluginfileinfo.Reason); } if (!_sRuntimeLoadError.IsEmpty()) // Runtime load errors { document.AddPara().Append(_sRuntimeLoadError); } } return(document); } catch (Exception ex) { Core.ReportBackgroundException(ex); return(RichContentConverter.DocumentFromException(ex)); } }