UI - Use PropertyChanged.SourceGenerator everywhere else

This commit is contained in:
Robert committed 2023-10-20 20:33:44 +02:00
1 parent d656c6960d
commit 190d797f1a
40 files changed
+223 -934

No files matched your search

@@ -15,16 +15,17 @@ using Artemis.UI.Shared.Services.Builders;
using Avalonia.ReactiveUI;
using DynamicData;
using DynamicData.Binding;
using PropertyChanged.SourceGenerator;
using ReactiveUI;
namespace Artemis.UI.Screens.Settings;
public class PluginsTabViewModel : RoutableScreen
public partial class PluginsTabViewModel : RoutableScreen
{
private readonly INotificationService _notificationService;
private readonly IPluginManagementService _pluginManagementService;
private readonly IWindowService _windowService;
private string? _searchPluginInput;
[Notify] private string? _searchPluginInput;
public PluginsTabViewModel(IPluginManagementService pluginManagementService, INotificationService notificationService, IWindowService windowService, ISettingsVmFactory settingsVmFactory)
{
@@ -62,13 +63,7 @@ public class PluginsTabViewModel : RoutableScreen
public ReadOnlyObservableCollection<PluginSettingsViewModel> Plugins { get; }
public ReactiveCommand<Unit, Unit> ImportPlugin { get; }
public string? SearchPluginInput
{
get => _searchPluginInput;
set => RaiseAndSetIfChanged(ref _searchPluginInput, value);
}
public void OpenUrl(string url)
{
Utilities.OpenUrl(url);
@@ -16,13 +16,14 @@ using Artemis.WebClient.Updating;
using Avalonia.ReactiveUI;
using DynamicData;
using DynamicData.Binding;
using PropertyChanged.SourceGenerator;
using ReactiveUI;
using Serilog;
using StrawberryShake;
namespace Artemis.UI.Screens.Settings;
public class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsViewModel>
public partial class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsViewModel>
{
private readonly ILogger _logger;
private readonly IUpdateService _updateService;
@@ -30,8 +31,8 @@ public class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsViewModel>
private readonly INotificationService _notificationService;
private readonly IRouter _router;
private readonly SourceList<IGetReleases_PublishedReleases_Nodes> _releases;
private bool _loading;
private ReleaseViewModel? _selectedReleaseViewModel;
[Notify(Setter.Private)] private bool _loading;
[Notify] private ReleaseViewModel? _selectedReleaseViewModel;
public ReleasesTabViewModel(ILogger logger, IUpdateService updateService, IUpdatingClient updatingClient, IReleaseVmFactory releaseVmFactory, INotificationService notificationService,
IRouter router)
@@ -61,19 +62,7 @@ public class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsViewModel>
public ReadOnlyObservableCollection<ReleaseViewModel> ReleaseViewModels { get; }
public string Channel { get; }
public ReleaseViewModel? SelectedReleaseViewModel
{
get => _selectedReleaseViewModel;
set => RaiseAndSetIfChanged(ref _selectedReleaseViewModel, value);
}
public bool Loading
{
get => _loading;
private set => RaiseAndSetIfChanged(ref _loading, value);
}
public async Task GetReleases(CancellationToken cancellationToken)
{
try
@@ -12,27 +12,27 @@ using Artemis.UI.Shared.Routing;
using Artemis.UI.Shared.Services;
using Artemis.UI.Shared.Services.Builders;
using Artemis.WebClient.Updating;
using PropertyChanged.SourceGenerator;
using ReactiveUI;
using Serilog;
using StrawberryShake;
namespace Artemis.UI.Screens.Settings.Updating;
public class ReleaseDetailsViewModel : RoutableScreen<ReleaseDetailsViewModelParameters>
public partial class ReleaseDetailsViewModel : RoutableScreen<ReleaseDetailsViewModelParameters>
{
private readonly ObservableAsPropertyHelper<long> _fileSize;
private readonly ILogger _logger;
private readonly INotificationService _notificationService;
private readonly IUpdateService _updateService;
private readonly IUpdatingClient _updatingClient;
private bool _installationAvailable;
private bool _installationFinished;
private bool _installationInProgress;
private CancellationTokenSource? _installerCts;
private bool _loading = true;
private IGetReleaseById_PublishedRelease? _release;
private ReleaseInstaller? _releaseInstaller;
[Notify(Setter.Private)] private bool _loading = true;
[Notify] private IGetReleaseById_PublishedRelease? _release;
[Notify] private ReleaseInstaller? _releaseInstaller;
[Notify] private bool _installationAvailable;
[Notify] private bool _installationFinished;
[Notify] private bool _installationInProgress;
public ReleaseDetailsViewModel(ILogger logger, IUpdatingClient updatingClient, INotificationService notificationService, IUpdateService updateService)
{
@@ -67,43 +67,7 @@ public class ReleaseDetailsViewModel : RoutableScreen<ReleaseDetailsViewModelPar
public ReactiveCommand<Unit, Unit> CancelInstall { get; }
public long FileSize => _fileSize.Value;
public IGetReleaseById_PublishedRelease? Release
{
get => _release;
set => RaiseAndSetIfChanged(ref _release, value);
}
public ReleaseInstaller? ReleaseInstaller
{
get => _releaseInstaller;
set => RaiseAndSetIfChanged(ref _releaseInstaller, value);
}
public bool Loading
{
get => _loading;
private set => RaiseAndSetIfChanged(ref _loading, value);
}
public bool InstallationAvailable
{
get => _installationAvailable;
set => RaiseAndSetIfChanged(ref _installationAvailable, value);
}
public bool InstallationInProgress
{
get => _installationInProgress;
set => RaiseAndSetIfChanged(ref _installationInProgress, value);
}
public bool InstallationFinished
{
get => _installationFinished;
set => RaiseAndSetIfChanged(ref _installationFinished, value);
}
public void NavigateToSource()
{
if (Release != null)