store last selected sln file

This commit is contained in:
Matt Parker
2025-07-31 19:47:33 +10:00
parent dea219ea90
commit 620d65b166
3 changed files with 65 additions and 3 deletions

View File

@@ -1,12 +1,16 @@
@using Ardalis.GuardClauses
@using global::Photino.Blazor
@using SharpIDE.Photino.Models
@inject PhotinoBlazorApp PhotinoBlazorApp
@inject AppState AppState
<MudStack Class="mx-4">
<MudTextField T="string" Label="Solution File" Value="@_solutionFilePath" ReadOnly="true" />
<MudButton OnClick="@PickSolution">Pick Solution</MudButton>
<MudButton OnClick="@Proceed" Disabled="@(string.IsNullOrWhiteSpace(_solutionFilePath))">Open</MudButton>
<MudStack Row="true">
<MudTextField T="string" Label="Solution File" Value="@_solutionFilePath" ReadOnly="true" />
<MudButton OnClick="@PickSolution">Pick Solution</MudButton>
</MudStack>
<MudButton Variant="Variant.Filled" Color="Color.Primary" OnClick="@Proceed" Disabled="@(string.IsNullOrWhiteSpace(_solutionFilePath))">Open</MudButton>
</MudStack>
@code {
@@ -15,6 +19,11 @@
private string? _solutionFilePath;
protected override void OnInitialized()
{
_solutionFilePath = AppState.SolutionFilePath;
}
private async Task PickSolution()
{
var files = await PhotinoBlazorApp.MainWindow.ShowOpenFileAsync("Choose Solution File", filters: [("Solution File", [".sln"])]);
@@ -25,6 +34,7 @@
private void Proceed()
{
Guard.Against.NullOrWhiteSpace(_solutionFilePath);
AppState.SolutionFilePath = _solutionFilePath;
MudDialog.Close(_solutionFilePath);
}
}