From d14a323f5bbe05232702bfb13620e06231437f8d Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Sun, 5 Feb 2023 16:13:35 -0600 Subject: [PATCH] Default path to root --- LANCommander/Components/ArchiveBrowser.razor | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/LANCommander/Components/ArchiveBrowser.razor b/LANCommander/Components/ArchiveBrowser.razor index 1c59f23..9f230bc 100644 --- a/LANCommander/Components/ArchiveBrowser.razor +++ b/LANCommander/Components/ArchiveBrowser.razor @@ -39,7 +39,7 @@ - @code { +@code { [Parameter] public Guid ArchiveId { get; set; } [Parameter] public Guid Archive { get; set; } [Parameter] public EventCallback OnFileSelected { get; set; } @@ -48,20 +48,24 @@ private IEnumerable Entries { get; set; } private IEnumerable CurrentPathEntries { get; set; } private string CurrentPath { get; set; } - private ArchiveDirectory Root { get; set; } + private HashSet Directories { get; set; } private ArchiveDirectory SelectedDirectory { get; set; } protected override async Task OnInitializedAsync() { Entries = await ArchiveService.GetContents(ArchiveId); + Directories = new HashSet(); - Root = new ArchiveDirectory() + var root = new ArchiveDirectory() { Name = "/", FullName = "" }; - Root.PopulateChildren(Entries); + root.PopulateChildren(Entries); + + Directories.Add(root); + SelectedDirectory = root; } private void ChangeDirectory(ArchiveDirectory selectedDirectory)