create ide settings
This commit is contained in:
12
src/SharpIDE.Photino/Components/IdeSettingsDialog.razor
Normal file
12
src/SharpIDE.Photino/Components/IdeSettingsDialog.razor
Normal 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!;
|
||||
}
|
||||
@@ -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 });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
@@ -92,6 +92,7 @@ public class Program
|
||||
if (deserializedAppState is not null)
|
||||
{
|
||||
appState.SolutionFilePath = deserializedAppState.SolutionFilePath;
|
||||
appState.IdeSettings = deserializedAppState.IdeSettings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user