mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Show multiple releases and improve workshop routing
This commit is contained in:
1 parent
da3d47d7b8
commit
9c04932afa
39 files changed
+419
-498
No files matched your search
@@ -29,7 +29,7 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<Border Classes="card" VerticalAlignment="Top" IsVisible="{CompiledBinding Entry.LatestRelease, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||
<Border Classes="card" VerticalAlignment="Top" IsVisible="{CompiledBinding Entry.Releases.Count}">
|
||||
<ContentControl Content="{CompiledBinding EntryReleasesViewModel}" />
|
||||
</Border>
|
||||
</StackPanel>
|
||||
@@ -49,7 +49,13 @@
|
||||
<TextBlock Theme="{StaticResource SubtitleTextBlockStyle}">Used by these profiles</TextBlock>
|
||||
<Border Classes="card-separator" />
|
||||
<ScrollViewer>
|
||||
<ItemsControl ItemsSource="{CompiledBinding Dependants}"></ItemsControl>
|
||||
<ItemsControl ItemsSource="{CompiledBinding Dependants}">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<StackPanel Spacing="5"></StackPanel>
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
@@ -33,7 +33,7 @@ public partial class PluginDetailsViewModel : RoutableScreen<WorkshopDetailParam
|
||||
[Notify] private EntryReleasesViewModel? _entryReleasesViewModel;
|
||||
[Notify] private EntryImagesViewModel? _entryImagesViewModel;
|
||||
[Notify] private ReadOnlyObservableCollection<EntryListItemViewModel>? _dependants;
|
||||
|
||||
|
||||
public PluginDetailsViewModel(IWorkshopClient client,
|
||||
IWindowService windowService,
|
||||
IPluginManagementService pluginManagementService,
|
||||
@@ -72,18 +72,21 @@ public partial class PluginDetailsViewModel : RoutableScreen<WorkshopDetailParam
|
||||
EntryReleasesViewModel.OnInstallationStarted = OnInstallationStarted;
|
||||
EntryReleasesViewModel.OnInstallationFinished = OnInstallationFinished;
|
||||
}
|
||||
|
||||
|
||||
IReadOnlyList<IEntrySummary>? dependants = (await _client.GetDependantEntries.ExecuteAsync(entryId, 0, 25, cancellationToken)).Data?.Entries?.Items;
|
||||
Dependants = dependants != null && dependants.Any()
|
||||
? new ReadOnlyObservableCollection<EntryListItemViewModel>(new ObservableCollection<EntryListItemViewModel>(dependants.Select(_getEntryListViewModel)))
|
||||
? new ReadOnlyObservableCollection<EntryListItemViewModel>(new ObservableCollection<EntryListItemViewModel>(dependants
|
||||
.Select(_getEntryListViewModel)
|
||||
.OrderByDescending(d => d.Entry.Downloads)
|
||||
.Take(10)))
|
||||
: null;
|
||||
}
|
||||
|
||||
private async Task<bool> OnInstallationStarted(IEntryDetails entryDetails)
|
||||
private async Task<bool> OnInstallationStarted(IEntryDetails entryDetails, IRelease release)
|
||||
{
|
||||
bool confirm = await _windowService.ShowConfirmContentDialog(
|
||||
"Installing plugin",
|
||||
$"You are about to install version {entryDetails.LatestRelease?.Version} of {entryDetails.Name}. \r\n\r\n" +
|
||||
$"You are about to install version {release.Version} of {entryDetails.Name}. \r\n\r\n" +
|
||||
"Plugins are NOT verified by Artemis and could harm your PC, if you have doubts about a plugin please ask on Discord!",
|
||||
"I trust this plugin, install it"
|
||||
);
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
<UserControl xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
|
||||
xmlns:ui="clr-namespace:Artemis.UI"
|
||||
xmlns:plugins="clr-namespace:Artemis.UI.Screens.Workshop.Plugins"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Workshop.Plugins.PluginListView"
|
||||
x:DataType="plugins:PluginListViewModel">
|
||||
<controls:Frame Name="RouterFrame" IsNavigationStackEnabled="False" CacheSize="0">
|
||||
<controls:Frame.NavigationPageFactory>
|
||||
<ui:PageFactory />
|
||||
</controls:Frame.NavigationPageFactory>
|
||||
</controls:Frame>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Reactive.Disposables;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
using Avalonia.ReactiveUI;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Plugins;
|
||||
|
||||
public partial class PluginListView : ReactiveUserControl<PluginListViewModel>
|
||||
{
|
||||
public PluginListView()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.WhenActivated(d =>
|
||||
{
|
||||
ViewModel.WhenAnyValue(vm => vm.Screen).Subscribe(Navigate).DisposeWith(d);
|
||||
});
|
||||
}
|
||||
|
||||
private void Navigate(RoutableScreen? viewModel)
|
||||
{
|
||||
RouterFrame.NavigateFromObject(viewModel ?? ViewModel?.EntryListViewModel);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using Artemis.UI.Screens.Workshop.Entries.List;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
using Artemis.WebClient.Workshop;
|
||||
|
||||
namespace Artemis.UI.Screens.Workshop.Plugins;
|
||||
|
||||
public class PluginListViewModel : RoutableHostScreen<RoutableScreen>
|
||||
{
|
||||
public EntryListViewModel EntryListViewModel { get; }
|
||||
|
||||
public PluginListViewModel(EntryListViewModel entryListViewModel)
|
||||
{
|
||||
EntryListViewModel = entryListViewModel;
|
||||
EntryListViewModel.EntryType = EntryType.Plugin;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user