From c7f1dc7e6bf70c0ca353f03eebecc358f32e2e3f Mon Sep 17 00:00:00 2001 From: Pat Hartl Date: Mon, 13 Feb 2023 01:03:12 -0600 Subject: [PATCH] Added list for archives --- LANCommander/Pages/Games/Edit.razor | 70 +++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/LANCommander/Pages/Games/Edit.razor b/LANCommander/Pages/Games/Edit.razor index d196312..0587fdd 100644 --- a/LANCommander/Pages/Games/Edit.razor +++ b/LANCommander/Pages/Games/Edit.razor @@ -1,5 +1,6 @@ @page "/Games/{id:guid}/Edit" @inject GameService GameService +@inject ArchiveService ArchiveService @inject IDialogService DialogService @inject ISnackbar Snackbar @@ -117,6 +118,50 @@ + + + + Archives + + + + Upload + + + + + + + Version + Uploaded By + Uploaded On + Size + + + + + @context.Version + @context.CreatedBy?.UserName + @context.CreatedOn + + @{ + long size = 0; + var path = Path.Combine("Upload", context.ObjectKey); + + if (File.Exists(path)) + size = new FileInfo(path).Length; + } + @ByteSizeLib.ByteSize.FromBytes(size) + + + + + + + + + + @code { @@ -201,4 +246,29 @@ StateHasChanged(); } } + + private async void BrowseArchive(Archive archive) + { + var parameters = new DialogParameters + { + ["ArchiveId"] = archive.Id + }; + + var dialog = await DialogService.ShowAsync("Archive Browser", parameters); + } + + private async void DeleteArchive(Archive archive) + { + bool? result = await DialogService.ShowMessageBox( + "Delete Archive?", + "Do you really want to delete this archive? You will not be able to recover it later.", + "Delete", + "Cancel" + ); + + if (result == true) + await ArchiveService.Delete(archive); + + StateHasChanged(); + } }