Workshop - Manage entries after installing them

Workshop - Auto-enable plugins after installing them
Workshop - Show the latest release above the details page
This commit is contained in:
Robert committed 2024-06-25 21:29:52 +02:00
1 parent 966ca47335
commit 86f78940b1
23 files changed
+401 -190

No files matched your search

@@ -8,6 +8,10 @@
x:Class="Artemis.UI.Screens.Workshop.Plugins.PluginDescriptionView"
x:DataType="plugins:PluginDescriptionViewModel">
<StackPanel Spacing="10">
<Border Classes="card">
<ContentControl Content="{CompiledBinding ReleaseInfoViewModel}"/>
</Border>
<Border Classes="card">
<mdxaml:MarkdownScrollViewer Markdown="{CompiledBinding Entry.Description}" MarkdownStyleName="FluentAvalonia">
<mdxaml:MarkdownScrollViewer.Styles>
@@ -5,6 +5,7 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Artemis.UI.Screens.Workshop.Entries.List;
using Artemis.UI.Screens.Workshop.EntryReleases;
using Artemis.UI.Shared.Routing;
using Artemis.WebClient.Workshop;
using PropertyChanged.SourceGenerator;
@@ -18,12 +19,16 @@ public partial class PluginDescriptionViewModel : RoutableScreen
private readonly IWorkshopClient _client;
private readonly Func<IEntrySummary, EntryListItemViewModel> _getEntryListViewModel;
public PluginDescriptionViewModel(IWorkshopClient client, Func<IEntrySummary, EntryListItemViewModel> getEntryListViewModel)
public PluginDescriptionViewModel(IWorkshopClient client, EntryReleaseInfoViewModel releaseInfoViewModel, Func<IEntrySummary, EntryListItemViewModel> getEntryListViewModel)
{
_client = client;
_getEntryListViewModel = getEntryListViewModel;
ReleaseInfoViewModel = releaseInfoViewModel;
ReleaseInfoViewModel.InDetailsScreen = false;
}
public EntryReleaseInfoViewModel ReleaseInfoViewModel { get; }
public async Task SetEntry(IEntryDetails? entry, CancellationToken cancellationToken)
{
Entry = entry;
@@ -64,5 +64,6 @@ public partial class PluginDetailsViewModel : RoutableHostScreen<RoutableScreen,
EntryImagesViewModel = Entry != null ? _getEntryImagesViewModel(Entry) : null;
await _pluginDescriptionViewModel.SetEntry(Entry, cancellationToken);
_pluginDescriptionViewModel.ReleaseInfoViewModel.Release = result.Data?.Entry?.LatestRelease;
}
}
@@ -73,5 +73,11 @@ public partial class PluginManageViewModel : RoutableScreen<WorkshopDetailParame
PluginViewModel = _settingsVmFactory.PluginViewModel(plugin, ReactiveCommand.Create(() => { }));
PluginFeatures = new ObservableCollection<PluginFeatureViewModel>(plugin.Features.Select(f => _settingsVmFactory.PluginFeatureViewModel(f, false)));
// If additional arguments were provided and it is a boolean, auto-enable the plugin
if (args.Options.AdditionalArguments is true)
{
await PluginViewModel.AutoEnable();
}
}
}