nested view
This commit is contained in:
@@ -1,6 +1,12 @@
|
|||||||
namespace SharpIDE.Application.Features.SolutionDiscovery;
|
using Microsoft.Build.Construction;
|
||||||
|
|
||||||
public class GetNodesInSolution
|
namespace SharpIDE.Application.Features.SolutionDiscovery;
|
||||||
|
|
||||||
|
public static class GetNodesInSolution
|
||||||
{
|
{
|
||||||
|
public static SolutionFile? ParseSolutionFileFromPath(string solutionFilePath)
|
||||||
|
{
|
||||||
|
var solutionFile = SolutionFile.Parse(solutionFilePath);
|
||||||
|
return solutionFile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,45 @@
|
|||||||
@page "/"
|
@page "/"
|
||||||
|
@using Microsoft.Build.Construction
|
||||||
|
@using SharpIDE.Application.Features.SolutionDiscovery
|
||||||
|
|
||||||
<MudText>Welcome to a new Photino Blazor app!</MudText>
|
<MudText>Welcome to a new Photino Blazor app!</MudText>
|
||||||
|
|
||||||
|
@if (_solutionFile is null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
<MudTreeView T="ProjectInSolution">
|
||||||
|
@foreach(var project in _rootNodes)
|
||||||
|
{
|
||||||
|
@GetProjectFragment(project)
|
||||||
|
}
|
||||||
|
</MudTreeView>
|
||||||
|
|
||||||
|
|
||||||
@code {
|
@code {
|
||||||
|
|
||||||
|
private SolutionFile _solutionFile = null!;
|
||||||
|
private List<ProjectInSolution> _rootNodes = [];
|
||||||
|
|
||||||
|
private RenderFragment GetProjectFragment(ProjectInSolution project) =>
|
||||||
|
@<text>
|
||||||
|
<MudTreeViewItem Value="project" Text="@project.ProjectName">
|
||||||
|
@foreach(var child in _solutionFile.ProjectsByGuid.Values.Where(s => s.ParentProjectGuid == project.ProjectGuid).OrderBy(s => s.ProjectName))
|
||||||
|
{
|
||||||
|
@GetProjectFragment(child)
|
||||||
|
}
|
||||||
|
</MudTreeViewItem>
|
||||||
|
</text>;
|
||||||
|
|
||||||
|
protected override async Task OnInitializedAsync()
|
||||||
|
{
|
||||||
|
var solutionFile = GetNodesInSolution.ParseSolutionFileFromPath("D:/matth/Documents/Git/amazon/ClientPortal.sln");
|
||||||
|
ArgumentNullException.ThrowIfNull(solutionFile);
|
||||||
|
_solutionFile = solutionFile;
|
||||||
|
var rootNodes = solutionFile.ProjectsByGuid.Values.Where(p => p.ParentProjectGuid == null).OrderBy(s => s.ProjectName).ToList();
|
||||||
|
_rootNodes = rootNodes;
|
||||||
|
Console.WriteLine();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user