create ide settings

This commit is contained in:
Matt Parker
2025-08-02 14:48:57 +10:00
parent e18ce7af71
commit bc836a3c00
4 changed files with 28 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
@using SharpIDE.Photino.Models
@inject AppState AppState
<MudStack Class="ml-2 mr-4 mb-2">
<MudSwitch @bind-Value="@AppState.IdeSettings.AutoOpenLastSolution" Label="Automatically open last solution" Color="Color.Primary" />
</MudStack>
@code {
[CascadingParameter]
public IMudDialogInstance MudDialog { get; set; } = null!;
}

View File

@@ -23,6 +23,9 @@
<MudButton>
<MudIcon Icon="@Icons.Material.Filled.PlayArrow" Size="Size.Medium" Color="Color.Success" />
</MudButton>
<MudButton OnClick="@OpenSettingsDialog">
<MudIcon Icon="@Icons.Material.Filled.Settings" Size="Size.Medium" Color="Color.Default" />
</MudButton>
</MudStack>
</MudAppBar>
<MudDrawer @bind-Open="@_drawerOpen" Width="400px" ClipMode="DrawerClipMode.Always">
@@ -89,4 +92,10 @@
{
await BuildService.MsBuildSolutionAsync(_solutionFilePath!, buildType);
}
private async Task OpenSettingsDialog()
{
var dialogRef = await DialogService.ShowAsync<IdeSettingsDialog>("SharpIDE Settings", new DialogOptions { MaxWidth = MaxWidth.Medium, CloseButton = true });
}
}

View File

@@ -3,4 +3,10 @@ namespace SharpIDE.Photino.Models;
public class AppState
{
public required string SolutionFilePath { get; set; }
public required IdeSettings IdeSettings { get; set; } = new IdeSettings();
}
public class IdeSettings
{
public bool AutoOpenLastSolution { get; set; }
}

View File

@@ -92,6 +92,7 @@ public class Program
if (deserializedAppState is not null)
{
appState.SolutionFilePath = deserializedAppState.SolutionFilePath;
appState.IdeSettings = deserializedAppState.IdeSettings;
}
}
}