From 74c24c84ae69acbc5cb91c4965ca55d22991b8b3 Mon Sep 17 00:00:00 2001 From: Robert Date: Sun, 14 Apr 2024 15:47:29 +0200 Subject: [PATCH] Workshop - Visual pass --- .../Updating/ReleaseDetailsView.axaml | 2 +- .../Details/EntrySpecificationsViewModel.cs | 13 +-- .../EntryReleases/EntryReleaseView.axaml | 4 +- .../Library/SubmissionDetailsView.axaml | 6 +- .../Library/SubmissionDetailsViewModel.cs | 4 +- .../Library/SubmissionManagementViewModel.cs | 13 ++- .../Library/SubmissionReleaseView.axaml | 89 +++++++++++++++++-- .../Steps/ChangelogStepViewModel.cs | 3 +- 8 files changed, 105 insertions(+), 29 deletions(-) diff --git a/src/Artemis.UI/Screens/Settings/Updating/ReleaseDetailsView.axaml b/src/Artemis.UI/Screens/Settings/Updating/ReleaseDetailsView.axaml index cdb9738aa..be8207516 100644 --- a/src/Artemis.UI/Screens/Settings/Updating/ReleaseDetailsView.axaml +++ b/src/Artemis.UI/Screens/Settings/Updating/ReleaseDetailsView.axaml @@ -43,7 +43,7 @@ - Release info + Release info diff --git a/src/Artemis.UI/Screens/Workshop/Entries/Details/EntrySpecificationsViewModel.cs b/src/Artemis.UI/Screens/Workshop/Entries/Details/EntrySpecificationsViewModel.cs index d277f9f62..041af76cc 100644 --- a/src/Artemis.UI/Screens/Workshop/Entries/Details/EntrySpecificationsViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Entries/Details/EntrySpecificationsViewModel.cs @@ -64,12 +64,7 @@ public partial class EntrySpecificationsViewModel : ValidatableViewModelBase _categoriesValid = categoriesRule.ValidationChanged.Select(c => c.IsValid).ToProperty(this, vm => vm.CategoriesValid); _descriptionValid = descriptionRule.ValidationChanged.Select(c => c.IsValid).ToProperty(this, vm => vm.DescriptionValid); - this.WhenActivatedAsync(async d => - { - // Load categories - await PopulateCategories(); - Disposable.Create(ClearIcon).DisposeWith(d); - }); + this.WhenActivatedAsync(async _ => await PopulateCategories()); } public ReactiveCommand SelectIcon { get; } @@ -98,12 +93,6 @@ public partial class EntrySpecificationsViewModel : ValidatableViewModelBase IconChanged = true; } - private void ClearIcon() - { - IconBitmap?.Dispose(); - IconBitmap = null; - } - private async Task PopulateCategories() { IOperationResult categories = await _workshopClient.GetCategories.ExecuteAsync(); diff --git a/src/Artemis.UI/Screens/Workshop/EntryReleases/EntryReleaseView.axaml b/src/Artemis.UI/Screens/Workshop/EntryReleases/EntryReleaseView.axaml index 3185f1a05..62a991f55 100644 --- a/src/Artemis.UI/Screens/Workshop/EntryReleases/EntryReleaseView.axaml +++ b/src/Artemis.UI/Screens/Workshop/EntryReleases/EntryReleaseView.axaml @@ -42,10 +42,10 @@ - - Release info + Release info - - + + + + diff --git a/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailsViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailsViewModel.cs index 1011f8045..7829b7261 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailsViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailsViewModel.cs @@ -79,6 +79,8 @@ public partial class SubmissionDetailsViewModel : RoutableScreen bool confirmed = await _windowService.ShowConfirmContentDialog("You have unsaved changes", "Do you want to discard your unsaved changes?"); if (!confirmed) args.Cancel(); + else + await ExecuteDiscardChanges(); } private async Task ApplyDetailsFromEntry(CancellationToken cancellationToken) @@ -94,6 +96,7 @@ public partial class SubmissionDetailsViewModel : RoutableScreen if (Entry == null) { EntrySpecificationsViewModel = null; + ApplyImagesFromEntry(); return; } @@ -176,7 +179,6 @@ public partial class SubmissionDetailsViewModel : RoutableScreen private async Task ExecuteDiscardChanges() { await ApplyDetailsFromEntry(CancellationToken.None); - ApplyImagesFromEntry(); } private async Task ExecuteSaveChanges(CancellationToken cancellationToken) diff --git a/src/Artemis.UI/Screens/Workshop/Library/SubmissionManagementViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/SubmissionManagementViewModel.cs index 7146f6307..2f7a67147 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/SubmissionManagementViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Library/SubmissionManagementViewModel.cs @@ -82,7 +82,18 @@ public partial class SubmissionManagementViewModel : RoutableHostScreen 1 ? Releases?.FirstOrDefault(r => r.Id == (long) args.RouteParameters[1]) : null; - + + // OnNavigating may just be getting called to update the selected release + if (Entry?.Id == parameters.EntryId) + { + // Reapply the entry when closing a release, this is mainly because the entry icon probably got disposed + if (SelectedRelease == null) + await _detailsViewModel.SetEntry(Entry, cancellationToken); + + // No need to reload the entry since it's the same + return; + } + IOperationResult result = await _client.GetSubmittedEntryById.ExecuteAsync(parameters.EntryId, cancellationToken); if (result.IsErrorResult()) return; diff --git a/src/Artemis.UI/Screens/Workshop/Library/SubmissionReleaseView.axaml b/src/Artemis.UI/Screens/Workshop/Library/SubmissionReleaseView.axaml index 691e767a1..2040309d0 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/SubmissionReleaseView.axaml +++ b/src/Artemis.UI/Screens/Workshop/Library/SubmissionReleaseView.axaml @@ -5,24 +5,95 @@ xmlns:library="clr-namespace:Artemis.UI.Screens.Workshop.Library" xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia" xmlns:controls1="clr-namespace:Artemis.UI.Controls" + xmlns:converters="clr-namespace:Artemis.UI.Converters" + xmlns:sharedConverters="clr-namespace:Artemis.UI.Shared.Converters;assembly=Artemis.UI.Shared" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Artemis.UI.Screens.Workshop.Library.SubmissionReleaseView" x:DataType="library:SubmissionReleaseViewModel"> + + + + + + + + + + + + + - - - - + + + + + Release management + + + + + + + Version + + - + + + Release date + + + + + + File size + + + + + + + + + + Release notes + + + + + - - \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/ChangelogStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/ChangelogStepViewModel.cs index 0333e5a56..e2e97795f 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/ChangelogStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/ChangelogStepViewModel.cs @@ -1,5 +1,6 @@ using System.Reactive.Disposables; using Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Layout; +using Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Plugin; using Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Profile; using Artemis.WebClient.Workshop; using PropertyChanged.SourceGenerator; @@ -32,7 +33,7 @@ public partial class ChangelogStepViewModel : SubmissionViewModel if (State.EntryType == EntryType.Layout) State.ChangeScreen(); else if (State.EntryType == EntryType.Plugin) - State.ChangeScreen(); + State.ChangeScreen(); else if (State.EntryType == EntryType.Profile) State.ChangeScreen(); }