UI - Use PropertyChanged.SourceGenerator in workshop

This commit is contained in:
Robert committed 2023-10-20 20:00:07 +02:00
1 parent 8f1509fc28
commit d656c6960d
28 files changed
+119 -411

No files matched your search

@@ -12,19 +12,20 @@ using Artemis.UI.Shared.Utilities;
using Artemis.WebClient.Workshop;
using Artemis.WebClient.Workshop.Handlers.InstallationHandlers;
using Artemis.WebClient.Workshop.Handlers.InstallationHandlers.Implementations;
using PropertyChanged.SourceGenerator;
using ReactiveUI;
using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.Profile;
public class ProfileDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
public partial class ProfileDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
{
private readonly IWorkshopClient _client;
private readonly ProfileEntryInstallationHandler _installationHandler;
private readonly INotificationService _notificationService;
private readonly ObservableAsPropertyHelper<DateTimeOffset?> _updatedAt;
private readonly IWindowService _windowService;
private IGetEntryById_Entry? _entry;
[Notify(Setter.Private)] private IGetEntryById_Entry? _entry;
public ProfileDetailsViewModel(IWorkshopClient client, ProfileEntryInstallationHandler installationHandler, INotificationService notificationService, IWindowService windowService)
{
@@ -43,13 +44,7 @@ public class ProfileDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
public ReactiveCommand<Unit, Unit> DownloadLatestRelease { get; }
public DateTimeOffset? UpdatedAt => _updatedAt.Value;
public IGetEntryById_Entry? Entry
{
get => _entry;
private set => RaiseAndSetIfChanged(ref _entry, value);
}
public override async Task OnNavigating(WorkshopDetailParameters parameters, NavigationArguments args, CancellationToken cancellationToken)
{
await GetEntry(parameters.EntryId, cancellationToken);
@@ -6,15 +6,16 @@ using Artemis.Core;
using Artemis.Core.Services;
using Artemis.UI.Shared;
using Artemis.UI.Shared.Services;
using PropertyChanged.SourceGenerator;
using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.Profile;
public class ProfilePreviewViewModel : ActivatableViewModelBase
public partial class ProfilePreviewViewModel : ActivatableViewModelBase
{
private readonly IProfileService _profileService;
private readonly IWindowService _windowService;
private ProfileConfiguration? _profileConfiguration;
[Notify] private ProfileConfiguration? _profileConfiguration;
public ProfilePreviewViewModel(IProfileService profileService, IDeviceService deviceService, IWindowService windowService)
{
@@ -29,12 +30,6 @@ public class ProfilePreviewViewModel : ActivatableViewModelBase
public ObservableCollection<ArtemisDevice> Devices { get; }
public ProfileConfiguration? ProfileConfiguration
{
get => _profileConfiguration;
set => RaiseAndSetIfChanged(ref _profileConfiguration, value);
}
private void Update()
{
try