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