diff --git a/src/SharpIDE.Photino/Components/CodeViewer.razor b/src/SharpIDE.Photino/Components/CodeViewer.razor index f9f8403..f4f1efe 100644 --- a/src/SharpIDE.Photino/Components/CodeViewer.razor +++ b/src/SharpIDE.Photino/Components/CodeViewer.razor @@ -1,4 +1,5 @@ -@using SharpIDE.Photino.Services +@using SharpIDE.Application.Features.SolutionDiscovery +@using SharpIDE.Photino.Services @inject RefreshOpenFileService RefreshOpenFileService @@ -14,14 +15,15 @@ height: calc(100vh - 100px); } -@{ -} @code { [Parameter, EditorRequired] public string FilePath { get; set; } = null!; + [Parameter, EditorRequired] + public SharpIdeFile? SelectedFile { get; set; } + private string? _fileContent; private bool _unsavedEdits = false; diff --git a/src/SharpIDE.Photino/Components/SolutionExplorer.razor b/src/SharpIDE.Photino/Components/SolutionExplorer.razor index a6b04ea..e148bd7 100644 --- a/src/SharpIDE.Photino/Components/SolutionExplorer.razor +++ b/src/SharpIDE.Photino/Components/SolutionExplorer.razor @@ -28,6 +28,18 @@ [Parameter, EditorRequired] public SharpIdeSolutionModel SolutionModel { get; set; } = null!; + [Parameter, EditorRequired] + public SharpIdeFile SelectedFile { get; set; } = null!; + + [Parameter] + public EventCallback SelectedFileChanged { get; set; } + + private async Task InvokeSelectedFileChanged(SharpIdeFile file) + { + SelectedFile = file; + await SelectedFileChanged.InvokeAsync(file); + } + private RenderFragment GetSolutionFolderFragment(SharpIdeSolutionFolder slnFolder) => @ @@ -77,7 +89,8 @@ private RenderFragment GetFileFragment(SharpIdeFile file) => @ - + ; + } diff --git a/src/SharpIDE.Photino/Layout/MainLayout.razor b/src/SharpIDE.Photino/Layout/MainLayout.razor index 1a4c0c8..23fe7b7 100644 --- a/src/SharpIDE.Photino/Layout/MainLayout.razor +++ b/src/SharpIDE.Photino/Layout/MainLayout.razor @@ -13,7 +13,7 @@ @if (_solutionFilePath is not null) { - + } @* *@ @@ -22,7 +22,7 @@ @* @Body *@ @if (_solutionFilePath is not null) { - + } @@ -38,6 +38,7 @@ private string? _solutionFilePath; private SharpIdeSolutionModel? _solutionModel; + private SharpIdeFile? _selectedFile; protected override async Task OnInitializedAsync() {