mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2025-08-20 22:32:56 +00:00
Simplify Pandoc button text binding logic
This commit is contained in:
parent
bfcb012dec
commit
55e2911ad9
@ -28,19 +28,9 @@
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Info" StartIcon="@Icons.Material.Filled.Update" OnClick="() => this.CheckForUpdate()">
|
||||
@T("Check for updates")
|
||||
</MudButton>
|
||||
@if (this.pandocInstallation != default && !this.pandocInstallation.IsAvailable)
|
||||
{
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Default" StartIcon="@Icons.Material.Filled.Download" OnClick="async () => await this.ShowPandocDialog()">
|
||||
@if (string.IsNullOrWhiteSpace(this.pandocInstallation.Version))
|
||||
{
|
||||
@T("Install Pandoc")
|
||||
}
|
||||
else
|
||||
{
|
||||
@T("Update Pandoc")
|
||||
}
|
||||
</MudButton>
|
||||
}
|
||||
<MudButton Variant="Variant.Filled" Color="Color.Default" StartIcon="@Icons.Material.Filled.Download" OnClick="async () => await this.ShowPandocDialog()">
|
||||
@this.PandocButtonText
|
||||
</MudButton>
|
||||
</MudStack>
|
||||
</ExpansionPanel>
|
||||
|
||||
|
@ -95,15 +95,23 @@ public partial class About : MSGComponentBase
|
||||
this.StateHasChanged();
|
||||
}
|
||||
|
||||
private string PandocButtonText
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.pandocInstallation switch
|
||||
{
|
||||
{ IsAvailable: true, CheckWasSuccessful: true } => this.T("Check Pandoc Installation"),
|
||||
{ IsAvailable: false, CheckWasSuccessful: true } => this.T("Update Pandoc"),
|
||||
|
||||
_ => this.T("Install Pandoc")
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ShowPandocDialog()
|
||||
{
|
||||
var dialogParameters = new DialogParameters<PandocDialog>
|
||||
{
|
||||
{ x => x.ShowInstallationPage, true },
|
||||
{ x => x.ShowInitialResultInSnackbar, false },
|
||||
};
|
||||
|
||||
await this.DialogService.ShowAsync<PandocDialog>(T("Pandoc Installation"), dialogParameters, DialogOptions.FULLSCREEN);
|
||||
await this.DialogService.ShowAsync<PandocDialog>(T("Pandoc Installation"), DialogOptions.FULLSCREEN);
|
||||
}
|
||||
|
||||
private async Task CopyStartupLogPath()
|
||||
|
Loading…
Reference in New Issue
Block a user