Browse Source

Documentation: Previewer

Marcin Ziąbek 2 years ago
parent
commit
109942c643

+ 1 - 1
Source/QuestPDF/Previewer/HotReloadManager.cs

@@ -7,7 +7,7 @@ using System;
 namespace QuestPDF.Previewer
 {
     /// <summary>
-    /// Helper for subscribing to hot reload notifications.
+    /// Helper to subscribe to hot reload notifications.
     /// </summary>
     internal static class HotReloadManager
     {

+ 21 - 3
Source/QuestPDF/Previewer/PreviewerExtensions.cs

@@ -1,4 +1,4 @@
-#if NET6_0_OR_GREATER
+
 
 using System;
 using System.Collections.Generic;
@@ -11,11 +11,15 @@ namespace QuestPDF.Previewer
 {
     public static class Extensions
     {
+        #if NET6_0_OR_GREATER
+        
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="previewer.supported"]/*' />
         public static void ShowInPreviewer(this IDocument document, int port = 12500)
         {
             document.ShowInPreviewerAsync(port).ConfigureAwait(true).GetAwaiter().GetResult();
         }
         
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="previewer.supported"]/*' />
         public static async Task ShowInPreviewerAsync(this IDocument document, int port = 12500)
         {
             var previewerService = new PreviewerService(port);
@@ -60,7 +64,21 @@ namespace QuestPDF.Previewer
                 }
             }
         }
+        
+        #else
+
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="previewer.notSupported"]/*' />
+        public static void ShowInPreviewer(this IDocument document, int port = 12500)
+        {
+            throw new Exception("The hot-reload feature requires .NET 6 or later.");
+        }
+
+        /// <include file='../Resources/Documentation.xml' path='documentation/doc[@for="previewer.notSupported"]/*' />
+        public static async Task ShowInPreviewerAsync(this IDocument document, int port = 12500)
+        {
+            throw new Exception("The hot-reload feature requires .NET 6 or later.");
+        }
+
+        #endif
     }
 }
-
-#endif

+ 26 - 0
Source/QuestPDF/Resources/Documentation.xml

@@ -378,4 +378,30 @@
             Individual properties can be adjusted for each level of fallback.
         </remarks>
     </doc>
+
+    <!-- PREVIEWER -->
+
+    <doc for="previewer.support">
+        <summary>
+            Connects to the QuestPDF Previewer application to automatically preview the document being currently implemented after every code modification,
+            without the need to recompile the code or restart the application.
+            <a href="https://www.questpdf.com/document-previewer.html">Learn more</a>
+        </summary>
+        
+        <remarks>
+            For details on the hot-reload functionality, please refer to the documentation of your preferred IDE.
+        </remarks>
+        
+        <param name="port">Specifies port for communication with the QuestPDF Previewer application. Default value is 12500.</param>
+    </doc>
+
+    <doc for="previewer.notSupported">
+        <summary>
+            The hot-reload feature and QuestPDF Previewer integration are available only in the .NET 6 environment or later.
+            Please consider updating your project.
+            <a href="https://www.questpdf.com/document-previewer.html">Learn more</a>
+        </summary>
+        
+        <param name="port">This parameter is ignored.</param>
+    </doc>
 </documentation>