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(); + } }