Load solution explorer from dialog
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
<MudThemeProvider Theme="@AppThemeProvider.GetTheme()" IsDarkMode="true" />
|
||||
<MudPopoverProvider/>
|
||||
<MudDialogProvider/>
|
||||
<MudSnackbarProvider/>
|
||||
|
||||
<Router AppAssembly="@typeof(Program).Assembly">
|
||||
<Found Context="routeData">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
@using Microsoft.Build.Construction
|
||||
@using Ardalis.GuardClauses
|
||||
@using Microsoft.Build.Construction
|
||||
@using SharpIDE.Application.Features.SolutionDiscovery
|
||||
|
||||
@if (_solutionFile is null)
|
||||
@@ -15,6 +16,8 @@
|
||||
|
||||
|
||||
@code {
|
||||
[Parameter, EditorRequired]
|
||||
public string SolutionFilePath { get; set; } = null!;
|
||||
|
||||
private SolutionFile _solutionFile = null!;
|
||||
private List<ProjectInSolution> _rootNodes = [];
|
||||
@@ -53,7 +56,8 @@
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await Task.Run(() => LoadSolution("C:/Users/matth/Documents/Git/SharpIDE.Photino/SharpIDE.Photino.sln"));
|
||||
Guard.Against.NullOrWhiteSpace(SolutionFilePath);
|
||||
await Task.Run(() => LoadSolution(SolutionFilePath));
|
||||
}
|
||||
|
||||
private void LoadSolution(string solutionPath)
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
@inherits LayoutComponentBase
|
||||
|
||||
<MudThemeProvider Theme="@AppThemeProvider.GetTheme()" IsDarkMode="true" />
|
||||
<MudPopoverProvider/>
|
||||
<MudDialogProvider/>
|
||||
<MudSnackbarProvider/>
|
||||
@inject IDialogService DialogService
|
||||
|
||||
<MudLayout>
|
||||
<MudAppBar Dense="true">
|
||||
<MudIconButton Icon="@Icons.Material.Filled.Menu" Color="Color.Inherit" Edge="Edge.Start" OnClick="@((e) => DrawerToggle())" />
|
||||
</MudAppBar>
|
||||
<MudDrawer @bind-Open="@_drawerOpen" Width="400px" ClipMode="DrawerClipMode.Always">
|
||||
<SolutionExplorer />
|
||||
@if (_solutionFilePath is not null)
|
||||
{
|
||||
<SolutionExplorer SolutionFilePath="@_solutionFilePath"/>
|
||||
}
|
||||
@* <NavMenu/> *@
|
||||
</MudDrawer>
|
||||
<MudMainContent>
|
||||
<MudContainer MaxWidth="MaxWidth.False" Class="mt-2">
|
||||
@Body
|
||||
@* @Body *@
|
||||
@if (_solutionFilePath is not null)
|
||||
{
|
||||
<CodeViewer FilePath="C:\Users\matth\Documents\Git\SharpIDE.Photino\src\SharpIDE.Photino\Program.cs" />
|
||||
}
|
||||
</MudContainer>
|
||||
</MudMainContent>
|
||||
</MudLayout>
|
||||
@@ -27,4 +31,16 @@
|
||||
{
|
||||
_drawerOpen = !_drawerOpen;
|
||||
}
|
||||
|
||||
private string? _solutionFilePath;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var dialogRef = await DialogService.ShowAsync<SolutionPickerDialog>("Open Solution", new DialogOptions { FullWidth = true, MaxWidth = MaxWidth.Medium });
|
||||
var result = await dialogRef.Result;
|
||||
if (result is null) throw new InvalidOperationException("Dialog result is null");
|
||||
if (result.Canceled) throw new OperationCanceledException("Dialog was canceled");
|
||||
var solutionFilePath = (string)result.Data!;
|
||||
_solutionFilePath = solutionFilePath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
@page "/"
|
||||
|
||||
@using SharpIDE.Application.Features.SolutionDiscovery
|
||||
|
||||
@inject IDialogService DialogService
|
||||
|
||||
@if (_solutionFilePath is not null)
|
||||
{
|
||||
<CodeViewer FilePath="C:\Users\matth\Documents\Git\SharpIDE.Photino\src\SharpIDE.Photino\Program.cs" />
|
||||
}
|
||||
|
||||
@code
|
||||
{
|
||||
|
||||
private string? _solutionFilePath;
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
var dialogRef = await DialogService.ShowAsync<SolutionPickerDialog>("Open Solution", new DialogOptions { FullWidth = true, MaxWidth = MaxWidth.Medium });
|
||||
var result = await dialogRef.Result;
|
||||
if (result is null) throw new InvalidOperationException("Dialog result is null");
|
||||
if (result.Canceled) throw new OperationCanceledException("Dialog was canceled");
|
||||
var solutionFilePath = (string)result.Data!;
|
||||
_solutionFilePath = solutionFilePath;
|
||||
await RoslynTest.Analyse(_solutionFilePath);
|
||||
}
|
||||
}
|
||||
@* @using SharpIDE.Application.Features.SolutionDiscovery *@
|
||||
@* *@
|
||||
@* @inject IDialogService DialogService *@
|
||||
@* *@
|
||||
@* @if (_solutionFilePath is not null) *@
|
||||
@* { *@
|
||||
@* <CodeViewer FilePath="C:\Users\matth\Documents\Git\SharpIDE.Photino\src\SharpIDE.Photino\Program.cs" /> *@
|
||||
@* } *@
|
||||
@* *@
|
||||
@* @code *@
|
||||
@* { *@
|
||||
@* *@
|
||||
@* private string? _solutionFilePath; *@
|
||||
@* *@
|
||||
@* protected override async Task OnInitializedAsync() *@
|
||||
@* { *@
|
||||
@* var dialogRef = await DialogService.ShowAsync<SolutionPickerDialog>("Open Solution", new DialogOptions { FullWidth = true, MaxWidth = MaxWidth.Medium }); *@
|
||||
@* var result = await dialogRef.Result; *@
|
||||
@* if (result is null) throw new InvalidOperationException("Dialog result is null"); *@
|
||||
@* if (result.Canceled) throw new OperationCanceledException("Dialog was canceled"); *@
|
||||
@* var solutionFilePath = (string)result.Data!; *@
|
||||
@* _solutionFilePath = solutionFilePath; *@
|
||||
@* await RoslynTest.Analyse(_solutionFilePath); *@
|
||||
@* } *@
|
||||
@* } *@
|
||||
|
||||
Reference in New Issue
Block a user