From 09c9834c04417850696f70ed99d698ed151f9055 Mon Sep 17 00:00:00 2001 From: krut_ni Date: Tue, 15 Apr 2025 15:16:12 +0200 Subject: [PATCH] WIP: Included a pandoc dialog to check for the availability and to include an automatic download process for the user --- .../Dialogs/PandocDialog.razor | 41 +++++++++++++++++++ .../Dialogs/PandocDialog.razor.cs | 37 +++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 app/MindWork AI Studio/Dialogs/PandocDialog.razor create mode 100644 app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs diff --git a/app/MindWork AI Studio/Dialogs/PandocDialog.razor b/app/MindWork AI Studio/Dialogs/PandocDialog.razor new file mode 100644 index 00000000..5f2a6d24 --- /dev/null +++ b/app/MindWork AI Studio/Dialogs/PandocDialog.razor @@ -0,0 +1,41 @@ + + + Install Pandoc + + + @if (this.showInstallPage) + { + +

Installationpage

+
+ } + else + { + + @if (showSkeleton) + { + + + } + else if (isPandocAvailable) + { + + + Pandoc ist auf Ihrem System verfügbar + + } + else + { + + + Pandoc ist auf Ihrem System nicht verfügbar + + Proceed to installation + } + + } +
+ + + +
\ No newline at end of file diff --git a/app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs b/app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs new file mode 100644 index 00000000..43ad2400 --- /dev/null +++ b/app/MindWork AI Studio/Dialogs/PandocDialog.razor.cs @@ -0,0 +1,37 @@ +using Microsoft.AspNetCore.Components; + +namespace AIStudio.Dialogs; + +public partial class PandocDialog : ComponentBase +{ + [CascadingParameter] + private IMudDialogInstance MudDialog { get; set; } = null!; + + private bool isPandocAvailable; + private bool showSkeleton; + private bool showInstallPage; + + + #region Overrides of ComponentBase + + protected override async Task OnInitializedAsync() + { + await base.OnInitializedAsync(); + this.showSkeleton = true; + await this.CheckPandocAvailabilityAsync(); + } + + #endregion + + private void Cancel() => this.MudDialog.Cancel(); + + private async Task CheckPandocAvailabilityAsync() + { + await Task.Delay(2500); + this.isPandocAvailable = await Pandoc.CheckAvailabilityAsync(); + this.showSkeleton = false; + await this.InvokeAsync(this.StateHasChanged); + } + + private void ProceedToInstallation() => this.showInstallPage = true; +} \ No newline at end of file