diff --git a/QuestPDF.Previewer.Examples/Program.cs b/QuestPDF.Previewer.Examples/Program.cs index 7d57716..3e72075 100644 --- a/QuestPDF.Previewer.Examples/Program.cs +++ b/QuestPDF.Previewer.Examples/Program.cs @@ -1,14 +1,10 @@ -using System.Net.Http.Headers; -using Avalonia.Media; -using QuestPDF.Fluent; +using QuestPDF.Fluent; using QuestPDF.Helpers; using QuestPDF.Infrastructure; using QuestPDF.Previewer; -using QuestPDF.ReportSample; using QuestPDF.ReportSample.Layouts; -using Colors = QuestPDF.Helpers.Colors; -ImagePlaceholder.Solid = true; +//ImagePlaceholder.Solid = true; // var model = DataSource.GetReport(); // var report = new StandardReport(model); @@ -51,16 +47,6 @@ Document }); x.Item().Text("Modify this line and the preview should show your changes instantly."); - - // for testing exception handling - // try - // { - // throw new ArgumentException("This file does not exists... peace.png"); - // } - // catch (Exception e) - // { - // throw new FileNotFoundException("This is the top exception!", e); - // } }); page.Footer() @@ -71,22 +57,5 @@ Document x.CurrentPageNumber(); }); }); - - container.Page(page => - { - page.Size(PageSizes.A4); - page.Margin(2, Unit.Centimetre); - page.DefaultTextStyle(x => x.FontSize(20)); - - page.Content() - .PaddingVertical(1, Unit.Centimetre) - .Column(x => - { - x.Spacing(20); - - foreach (var i in Enumerable.Range(0, 10)) - x.Item().Background(Colors.Grey.Lighten2).Height(80); - }); - }); }) - .ShowInPreviewer().Wait(); \ No newline at end of file + .ShowInPreviewer(); \ No newline at end of file diff --git a/QuestPDF.Previewer.Examples/QuestPDF.Previewer.Examples.csproj b/QuestPDF.Previewer.Examples/QuestPDF.Previewer.Examples.csproj index bda9681..8f09c84 100644 --- a/QuestPDF.Previewer.Examples/QuestPDF.Previewer.Examples.csproj +++ b/QuestPDF.Previewer.Examples/QuestPDF.Previewer.Examples.csproj @@ -8,7 +8,6 @@ - diff --git a/QuestPDF.Previewer/CommunicationService.cs b/QuestPDF.Previewer/CommunicationService.cs index 2a25863..84050a6 100644 --- a/QuestPDF.Previewer/CommunicationService.cs +++ b/QuestPDF.Previewer/CommunicationService.cs @@ -32,7 +32,7 @@ class CommunicationService Application = builder.Build(); Application.MapGet("ping", () => Results.Ok()); - Application.MapGet("version", () => Results.Ok(GetType().Assembly.GetName().Version)); + Application.MapGet("version", () => Results.Json(GetType().Assembly.GetName().Version)); Application.MapPost("update/preview", HandleUpdatePreview); return Application.RunAsync($"http://localhost:{port}/"); @@ -58,8 +58,8 @@ class CommunicationService return new PreviewPage(picture, page.Width, page.Height); }) .ToList(); - - OnDocumentRefreshed(pages); + + Task.Run(() => OnDocumentRefreshed(pages)); return Results.Ok(); } } \ No newline at end of file diff --git a/QuestPDF.Previewer/PreviewerWindow.axaml b/QuestPDF.Previewer/PreviewerWindow.axaml index 3038e5e..a66c9a8 100644 --- a/QuestPDF.Previewer/PreviewerWindow.axaml +++ b/QuestPDF.Previewer/PreviewerWindow.axaml @@ -1,17 +1,32 @@  + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:previewer="clr-namespace:QuestPDF.Previewer" + mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + x:Class="QuestPDF.Previewer.PreviewerWindow" + WindowStartupLocation="CenterScreen" + ExtendClientAreaToDecorationsHint="true" + ExtendClientAreaTitleBarHeightHint="-1" + Background="#666" + Icon="/Resources/Logo.png" + UseLayoutRounding="True" + Title="QuestPDF Document Preview"> + + + + + + + @@ -35,9 +50,8 @@ ScrollViewportSize="{Binding ScrollViewportSize, Mode=OneWayToSource}" Pages="{Binding Pages, Mode=OneWay}" /> - - - -