mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Workshop - Added installed entries and update profiles when reinstalling them
This commit is contained in:
1 parent
fcde1d4ecc
commit
c69be2836e
17 files changed
+327
-58
No files matched your search
@@ -20,16 +20,16 @@ namespace Artemis.UI.Screens.Workshop.Profile;
|
||||
public class ProfileDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
|
||||
{
|
||||
private readonly IWorkshopClient _client;
|
||||
private readonly ProfileEntryDownloadHandler _downloadHandler;
|
||||
private readonly ProfileEntryInstallationHandler _installationHandler;
|
||||
private readonly INotificationService _notificationService;
|
||||
private readonly IWindowService _windowService;
|
||||
private readonly ObservableAsPropertyHelper<DateTimeOffset?> _updatedAt;
|
||||
private IGetEntryById_Entry? _entry;
|
||||
|
||||
public ProfileDetailsViewModel(IWorkshopClient client, ProfileEntryDownloadHandler downloadHandler, INotificationService notificationService, IWindowService windowService)
|
||||
public ProfileDetailsViewModel(IWorkshopClient client, ProfileEntryInstallationHandler installationHandler, INotificationService notificationService, IWindowService windowService)
|
||||
{
|
||||
_client = client;
|
||||
_downloadHandler = downloadHandler;
|
||||
_installationHandler = installationHandler;
|
||||
_notificationService = notificationService;
|
||||
_windowService = windowService;
|
||||
_updatedAt = this.WhenAnyValue(vm => vm.Entry).Select(e => e?.LatestRelease?.CreatedAt ?? e?.CreatedAt).ToProperty(this, vm => vm.UpdatedAt);
|
||||
@@ -70,7 +70,7 @@ public class ProfileDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
|
||||
if (!confirm)
|
||||
return;
|
||||
|
||||
EntryInstallResult<ProfileConfiguration> result = await _downloadHandler.InstallProfileAsync(Entry.LatestRelease.Id, new Progress<StreamProgress>(), cancellationToken);
|
||||
EntryInstallResult<ProfileConfiguration> result = await _installationHandler.InstallProfileAsync(Entry, Entry.LatestRelease.Id, new Progress<StreamProgress>(), cancellationToken);
|
||||
if (result.IsSuccess)
|
||||
_notificationService.CreateNotification().WithTitle("Profile installed").WithSeverity(NotificationSeverity.Success).Show();
|
||||
else
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
xmlns:search="clr-namespace:Artemis.UI.Screens.Workshop.Search"
|
||||
xmlns:workshop="clr-namespace:Artemis.WebClient.Workshop;assembly=Artemis.WebClient.Workshop"
|
||||
xmlns:windowing="clr-namespace:FluentAvalonia.UI.Windowing;assembly=FluentAvalonia"
|
||||
xmlns:avalonia="clr-namespace:Material.Icons.Avalonia;assembly=Material.Icons.Avalonia"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Artemis.UI.Screens.Workshop.Search.SearchView"
|
||||
x:DataType="search:SearchViewModel">
|
||||
@@ -30,12 +31,16 @@
|
||||
<ContentControl HorizontalAlignment="Right"
|
||||
Width="28"
|
||||
Height="28"
|
||||
Margin="0 0 50 0"
|
||||
Margin="0 0 75 0"
|
||||
Content="{CompiledBinding CurrentUserViewModel}"
|
||||
windowing:AppWindow.AllowInteractionInTitleBar="True" />
|
||||
|
||||
<Border VerticalAlignment="Top" CornerRadius="4 4 0 0" ClipToBounds="True" MaxWidth="500">
|
||||
<ProgressBar IsIndeterminate="True" VerticalAlignment="Top" IsVisible="{CompiledBinding IsLoading}"></ProgressBar>
|
||||
</Border>
|
||||
|
||||
<Button Classes="title-bar-button" Command="{CompiledBinding ShowDebugger}" Margin="0 -5 0 0" VerticalAlignment="Top" HorizontalAlignment="Right" windowing:AppWindow.AllowInteractionInTitleBar="True" >
|
||||
<avalonia:MaterialIcon Kind="Bug"></avalonia:MaterialIcon>
|
||||
</Button>
|
||||
</Panel>
|
||||
</UserControl>
|
||||
@@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.UI.Screens.Workshop.CurrentUser;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
using Artemis.WebClient.Workshop;
|
||||
@@ -18,15 +19,17 @@ public class SearchViewModel : ViewModelBase
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IRouter _router;
|
||||
private readonly IDebugService _debugService;
|
||||
private readonly IWorkshopClient _workshopClient;
|
||||
private bool _isLoading;
|
||||
private SearchResultViewModel? _selectedEntry;
|
||||
|
||||
public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IRouter router, CurrentUserViewModel currentUserViewModel)
|
||||
public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IRouter router, CurrentUserViewModel currentUserViewModel, IDebugService debugService)
|
||||
{
|
||||
_logger = logger;
|
||||
_workshopClient = workshopClient;
|
||||
_router = router;
|
||||
_debugService = debugService;
|
||||
CurrentUserViewModel = currentUserViewModel;
|
||||
SearchAsync = ExecuteSearchAsync;
|
||||
|
||||
@@ -49,6 +52,11 @@ public class SearchViewModel : ViewModelBase
|
||||
set => RaiseAndSetIfChanged(ref _isLoading, value);
|
||||
}
|
||||
|
||||
public void ShowDebugger()
|
||||
{
|
||||
_debugService.ShowDebugger();
|
||||
}
|
||||
|
||||
private void NavigateToEntry(SearchResultViewModel searchResult)
|
||||
{
|
||||
string? url = null;
|
||||
|
||||
Reference in new issue
Block a user