From d656c6960d88e4adaef00bdf76c44a01d9210855 Mon Sep 17 00:00:00 2001 From: Robert Date: Fri, 20 Oct 2023 20:00:07 +0200 Subject: [PATCH] UI - Use PropertyChanged.SourceGenerator in workshop --- .../Workshop/Categories/CategoryViewModel.cs | 11 ++-- .../CurrentUser/CurrentUserViewModel.cs | 53 ++++--------------- .../Workshop/Entries/EntriesViewModel.cs | 11 ++-- .../Entries/EntryListInputViewModel.cs | 22 ++------ .../Workshop/Entries/EntryListViewModel.cs | 31 +++-------- .../Entries/EntrySpecificationsViewModel.cs | 52 +++--------------- .../Workshop/Home/WorkshopHomeViewModel.cs | 11 ++-- .../Workshop/Home/WorkshopOfflineViewModel.cs | 11 ++-- .../Workshop/Layout/LayoutDetailsViewModel.cs | 11 ++-- .../Library/SubmissionDetailViewModel.cs | 27 ++-------- .../Library/Tabs/InstalledTabItemViewModel.cs | 11 ++-- .../Library/Tabs/InstalledTabViewModel.cs | 14 ++--- .../Library/Tabs/SubmissionsTabViewModel.cs | 22 ++------ .../Library/WorkshopLibraryViewModel.cs | 11 ++-- .../Profile/ProfileDetailsViewModel.cs | 13 ++--- .../Profile/ProfilePreviewViewModel.cs | 11 ++-- .../Workshop/Search/SearchViewModel.cs | 21 ++------ .../ReleaseWizardViewModel.cs | 11 ++-- .../Steps/EntryTypeStepViewModel.cs | 11 ++-- .../ProfileAdaptionHintsLayerViewModel.cs | 13 ++--- .../Profile/ProfileSelectionStepViewModel.cs | 11 ++-- .../Steps/SpecificationsStepViewModel.cs | 11 ++-- .../Steps/SubmitStepViewModel.cs | 23 +++----- .../Steps/UploadStepViewModel.cs | 28 ++-------- .../SubmissionWizard/SubmissionViewModel.cs | 51 +++--------------- .../SubmissionWizardViewModel.cs | 11 ++-- .../Screens/Workshop/WorkshopViewModel.cs | 11 ++-- .../WorkshopConstants.cs | 6 ++- 28 files changed, 119 insertions(+), 411 deletions(-) diff --git a/src/Artemis.UI/Screens/Workshop/Categories/CategoryViewModel.cs b/src/Artemis.UI/Screens/Workshop/Categories/CategoryViewModel.cs index 328b43c2a..c37a62dc0 100644 --- a/src/Artemis.UI/Screens/Workshop/Categories/CategoryViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Categories/CategoryViewModel.cs @@ -2,12 +2,13 @@ using System; using Artemis.UI.Shared; using Artemis.WebClient.Workshop; using Material.Icons; +using PropertyChanged.SourceGenerator; namespace Artemis.UI.Screens.Workshop.Categories; -public class CategoryViewModel : ViewModelBase +public partial class CategoryViewModel : ViewModelBase { - private bool _isSelected; + [Notify] private bool _isSelected; public CategoryViewModel(IGetCategories_Categories category) { @@ -20,10 +21,4 @@ public class CategoryViewModel : ViewModelBase public long Id { get; } public string Name { get; } public MaterialIconKind Icon { get; } - - public bool IsSelected - { - get => _isSelected; - set => RaiseAndSetIfChanged(ref _isSelected, value); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/CurrentUser/CurrentUserViewModel.cs b/src/Artemis.UI/Screens/Workshop/CurrentUser/CurrentUserViewModel.cs index 5d4fc9b80..a5dec1d4a 100644 --- a/src/Artemis.UI/Screens/Workshop/CurrentUser/CurrentUserViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/CurrentUser/CurrentUserViewModel.cs @@ -11,23 +11,24 @@ using Artemis.WebClient.Workshop.Services; using Avalonia.Media.Imaging; using FluentAvalonia.UI.Controls; using Flurl.Http; +using PropertyChanged.SourceGenerator; using ReactiveUI; using Serilog; namespace Artemis.UI.Screens.Workshop.CurrentUser; -public class CurrentUserViewModel : ActivatableViewModelBase +public partial class CurrentUserViewModel : ActivatableViewModelBase { private readonly IAuthenticationService _authenticationService; private readonly ObservableAsPropertyHelper _isAnonymous; private readonly ILogger _logger; private readonly IWindowService _windowService; - private bool _allowLogout = true; - private Bitmap? _avatar; - private string? _email; - private bool _loading = true; - private string? _name; - private string? _userId; + [Notify] private bool _allowLogout = true; + [Notify(Setter.Private)] private Bitmap? _avatar; + [Notify(Setter.Private)] private string? _email; + [Notify(Setter.Private)] private bool _loading = true; + [Notify(Setter.Private)] private string? _name; + [Notify(Setter.Private)] private string? _userId; public CurrentUserViewModel(ILogger logger, IAuthenticationService authenticationService, IWindowService windowService) { @@ -46,43 +47,7 @@ public class CurrentUserViewModel : ActivatableViewModelBase } public bool IsAnonymous => _isAnonymous.Value; - - public bool AllowLogout - { - get => _allowLogout; - set => RaiseAndSetIfChanged(ref _allowLogout, value); - } - - public bool Loading - { - get => _loading; - private set => RaiseAndSetIfChanged(ref _loading, value); - } - - public string? UserId - { - get => _userId; - private set => RaiseAndSetIfChanged(ref _userId, value); - } - - public string? Name - { - get => _name; - private set => RaiseAndSetIfChanged(ref _name, value); - } - - public string? Email - { - get => _email; - private set => RaiseAndSetIfChanged(ref _email, value); - } - - public Bitmap? Avatar - { - get => _avatar; - private set => RaiseAndSetIfChanged(ref _avatar, value); - } - + public ReactiveCommand Login { get; } public void Logout() diff --git a/src/Artemis.UI/Screens/Workshop/Entries/EntriesViewModel.cs b/src/Artemis.UI/Screens/Workshop/Entries/EntriesViewModel.cs index 4ebd77ecc..bf27ec55c 100644 --- a/src/Artemis.UI/Screens/Workshop/Entries/EntriesViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Entries/EntriesViewModel.cs @@ -8,14 +8,15 @@ using Artemis.UI.Shared.Routing; using ReactiveUI; using System; using System.Reactive.Linq; +using PropertyChanged.SourceGenerator; namespace Artemis.UI.Screens.Workshop.Entries; -public class EntriesViewModel : RoutableHostScreen +public partial class EntriesViewModel : RoutableHostScreen { private readonly IRouter _router; - private RouteViewModel? _selectedTab; private ObservableAsPropertyHelper? _viewingDetails; + [Notify] private RouteViewModel? _selectedTab; public EntriesViewModel(IRouter router) { @@ -44,12 +45,6 @@ public class EntriesViewModel : RoutableHostScreen public bool ViewingDetails => _viewingDetails?.Value ?? false; public ObservableCollection Tabs { get; } - public RouteViewModel? SelectedTab - { - get => _selectedTab; - set => RaiseAndSetIfChanged(ref _selectedTab, value); - } - public override async Task OnNavigating(NavigationArguments args, CancellationToken cancellationToken) { SelectedTab = Tabs.FirstOrDefault(t => t.Matches(args.Path)); diff --git a/src/Artemis.UI/Screens/Workshop/Entries/EntryListInputViewModel.cs b/src/Artemis.UI/Screens/Workshop/Entries/EntryListInputViewModel.cs index 0d2b8b091..f9f72c092 100644 --- a/src/Artemis.UI/Screens/Workshop/Entries/EntryListInputViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Entries/EntryListInputViewModel.cs @@ -1,18 +1,19 @@ using Artemis.Core; using Artemis.Core.Services; using Artemis.UI.Shared; +using PropertyChanged.SourceGenerator; using ReactiveUI; namespace Artemis.UI.Screens.Workshop.Entries; -public class EntryListInputViewModel : ViewModelBase +public partial class EntryListInputViewModel : ViewModelBase { private static string? _lastSearch; private readonly PluginSetting _entriesPerPage; private readonly PluginSetting _sortBy; private string? _search; - private string _searchWatermark = "Search"; - private int _totalCount; + [Notify] private string _searchWatermark = "Search"; + [Notify] private int _totalCount; public EntryListInputViewModel(ISettingsService settingsService) { @@ -22,13 +23,7 @@ public class EntryListInputViewModel : ViewModelBase _entriesPerPage.AutoSave = true; _sortBy.AutoSave = true; } - - public string SearchWatermark - { - get => _searchWatermark; - set => RaiseAndSetIfChanged(ref _searchWatermark, value); - } - + public string? Search { get => _search; @@ -59,15 +54,8 @@ public class EntryListInputViewModel : ViewModelBase } } - public int TotalCount - { - get => _totalCount; - set => RaiseAndSetIfChanged(ref _totalCount, value); - } - public void ClearLastSearch() { _lastSearch = null; } - } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/Entries/EntryListViewModel.cs b/src/Artemis.UI/Screens/Workshop/Entries/EntryListViewModel.cs index d1e672088..4e11a5568 100644 --- a/src/Artemis.UI/Screens/Workshop/Entries/EntryListViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Entries/EntryListViewModel.cs @@ -13,12 +13,13 @@ using Artemis.UI.Shared.Services.Builders; using Artemis.WebClient.Workshop; using Avalonia.Threading; using DynamicData; +using PropertyChanged.SourceGenerator; using ReactiveUI; using StrawberryShake; namespace Artemis.UI.Screens.Workshop.Entries; -public abstract class EntryListViewModel : RoutableScreen +public abstract partial class EntryListViewModel : RoutableScreen { private readonly SourceList _entries = new(); private readonly ObservableAsPropertyHelper _isLoading; @@ -26,10 +27,9 @@ public abstract class EntryListViewModel : RoutableScreen _showPagination; private readonly IWorkshopClient _workshopClient; - private int _loadedPage = -1; - - private int _page; - private int _totalPages = 1; + [Notify] private int _page; + [Notify] private int _loadedPage = -1; + [Notify] private int _totalPages = 1; protected EntryListViewModel(string route, IWorkshopClient workshopClient, @@ -74,26 +74,7 @@ public abstract class EntryListViewModel : RoutableScreen Entries { get; } - - public int Page - { - get => _page; - set => RaiseAndSetIfChanged(ref _page, value); - } - - public int LoadedPage - { - get => _loadedPage; - set => RaiseAndSetIfChanged(ref _loadedPage, value); - } - - - public int TotalPages - { - get => _totalPages; - set => RaiseAndSetIfChanged(ref _totalPages, value); - } - + public override async Task OnNavigating(WorkshopListParameters parameters, NavigationArguments args, CancellationToken cancellationToken) { Page = Math.Max(1, parameters.Page); diff --git a/src/Artemis.UI/Screens/Workshop/Entries/EntrySpecificationsViewModel.cs b/src/Artemis.UI/Screens/Workshop/Entries/EntrySpecificationsViewModel.cs index cc9d289eb..af6a2894e 100644 --- a/src/Artemis.UI/Screens/Workshop/Entries/EntrySpecificationsViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Entries/EntrySpecificationsViewModel.cs @@ -16,6 +16,7 @@ using AvaloniaEdit.Document; using DynamicData; using DynamicData.Aggregation; using DynamicData.Binding; +using PropertyChanged.SourceGenerator; using ReactiveUI; using ReactiveUI.Validation.Extensions; using ReactiveUI.Validation.Helpers; @@ -23,20 +24,19 @@ using StrawberryShake; namespace Artemis.UI.Screens.Workshop.Entries; -public class EntrySpecificationsViewModel : ValidatableViewModelBase +public partial class EntrySpecificationsViewModel : ValidatableViewModelBase { private readonly ObservableAsPropertyHelper _categoriesValid; private readonly ObservableAsPropertyHelper _iconValid; private readonly ObservableAsPropertyHelper _descriptionValid; private readonly IWorkshopClient _workshopClient; private readonly IWindowService _windowService; - - private string _description = string.Empty; - private Bitmap? _iconBitmap; - private TextDocument? _markdownDocument; - private string _name = string.Empty; - private string _summary = string.Empty; - private bool _iconChanged; + [Notify] private string _name = string.Empty; + [Notify] private string _summary = string.Empty; + [Notify] private string _description = string.Empty; + [Notify] private Bitmap? _iconBitmap; + [Notify] private TextDocument? _markdownDocument; + [Notify(Setter.Private)] private bool _iconChanged; public EntrySpecificationsViewModel(IWorkshopClient workshopClient, IWindowService windowService) { @@ -91,42 +91,6 @@ public class EntrySpecificationsViewModel : ValidatableViewModelBase public bool IconValid => _iconValid.Value; public bool DescriptionValid => _descriptionValid.Value; - public string Name - { - get => _name; - set => RaiseAndSetIfChanged(ref _name, value); - } - - public string Summary - { - get => _summary; - set => RaiseAndSetIfChanged(ref _summary, value); - } - - public string Description - { - get => _description; - set => RaiseAndSetIfChanged(ref _description, value); - } - - public Bitmap? IconBitmap - { - get => _iconBitmap; - set => RaiseAndSetIfChanged(ref _iconBitmap, value); - } - - public TextDocument? MarkdownDocument - { - get => _markdownDocument; - set => RaiseAndSetIfChanged(ref _markdownDocument, value); - } - - public bool IconChanged - { - get => _iconChanged; - private set => RaiseAndSetIfChanged(ref _iconChanged, value); - } - public List PreselectedCategories { get; set; } = new(); private void MarkdownDocumentOnTextChanged(object? sender, EventArgs e) diff --git a/src/Artemis.UI/Screens/Workshop/Home/WorkshopHomeViewModel.cs b/src/Artemis.UI/Screens/Workshop/Home/WorkshopHomeViewModel.cs index e32a16f74..df72da255 100644 --- a/src/Artemis.UI/Screens/Workshop/Home/WorkshopHomeViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Home/WorkshopHomeViewModel.cs @@ -6,14 +6,15 @@ using Artemis.UI.Screens.Workshop.SubmissionWizard; using Artemis.UI.Shared.Routing; using Artemis.UI.Shared.Services; using Artemis.WebClient.Workshop.Services; +using PropertyChanged.SourceGenerator; using ReactiveUI; namespace Artemis.UI.Screens.Workshop.Home; -public class WorkshopHomeViewModel : RoutableScreen +public partial class WorkshopHomeViewModel : RoutableScreen { private readonly IWindowService _windowService; - private bool _workshopReachable; + [Notify(Setter.Private)] private bool _workshopReachable; public WorkshopHomeViewModel(IRouter router, IWindowService windowService, IWorkshopService workshopService) { @@ -34,12 +35,6 @@ public class WorkshopHomeViewModel : RoutableScreen public ReactiveCommand AddSubmission { get; } public ReactiveCommand Navigate { get; } - public bool WorkshopReachable - { - get => _workshopReachable; - private set => RaiseAndSetIfChanged(ref _workshopReachable, value); - } - private async Task ExecuteAddSubmission(CancellationToken arg) { await _windowService.ShowDialogAsync(); diff --git a/src/Artemis.UI/Screens/Workshop/Home/WorkshopOfflineViewModel.cs b/src/Artemis.UI/Screens/Workshop/Home/WorkshopOfflineViewModel.cs index c6482434d..71ca2508f 100644 --- a/src/Artemis.UI/Screens/Workshop/Home/WorkshopOfflineViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Home/WorkshopOfflineViewModel.cs @@ -4,15 +4,16 @@ using System.Threading; using System.Threading.Tasks; using Artemis.UI.Shared.Routing; using Artemis.WebClient.Workshop.Services; +using PropertyChanged.SourceGenerator; using ReactiveUI; namespace Artemis.UI.Screens.Workshop.Home; -public class WorkshopOfflineViewModel : RoutableScreen +public partial class WorkshopOfflineViewModel : RoutableScreen { private readonly IRouter _router; private readonly IWorkshopService _workshopService; - private string _message = string.Empty; + [Notify] private string _message = string.Empty; /// public WorkshopOfflineViewModel(IWorkshopService workshopService, IRouter router) @@ -25,12 +26,6 @@ public class WorkshopOfflineViewModel : RoutableScreen Retry { get; } - public string Message - { - get => _message; - set => RaiseAndSetIfChanged(ref _message, value); - } - public override Task OnNavigating(WorkshopOfflineParameters parameters, NavigationArguments args, CancellationToken cancellationToken) { Message = parameters.Message; diff --git a/src/Artemis.UI/Screens/Workshop/Layout/LayoutDetailsViewModel.cs b/src/Artemis.UI/Screens/Workshop/Layout/LayoutDetailsViewModel.cs index 179fd95df..f1b3c9da3 100644 --- a/src/Artemis.UI/Screens/Workshop/Layout/LayoutDetailsViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Layout/LayoutDetailsViewModel.cs @@ -10,18 +10,19 @@ using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services.Builders; using Artemis.UI.Shared.Utilities; using Artemis.WebClient.Workshop; +using PropertyChanged.SourceGenerator; using ReactiveUI; using StrawberryShake; namespace Artemis.UI.Screens.Workshop.Layout; -public class LayoutDetailsViewModel : RoutableScreen +public partial class LayoutDetailsViewModel : RoutableScreen { private readonly IWorkshopClient _client; private readonly INotificationService _notificationService; private readonly IWindowService _windowService; private readonly ObservableAsPropertyHelper _updatedAt; - private IGetEntryById_Entry? _entry; + [Notify(Setter.Private)] private IGetEntryById_Entry? _entry; public LayoutDetailsViewModel(IWorkshopClient client, INotificationService notificationService, IWindowService windowService) { @@ -37,12 +38,6 @@ public class LayoutDetailsViewModel : RoutableScreen 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); diff --git a/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailViewModel.cs index 7d94935c0..379d3274f 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Library/SubmissionDetailViewModel.cs @@ -18,21 +18,22 @@ using Artemis.WebClient.Workshop.Exceptions; using Artemis.WebClient.Workshop.Handlers.UploadHandlers; using Artemis.WebClient.Workshop.Services; using Avalonia.Media.Imaging; +using PropertyChanged.SourceGenerator; using ReactiveUI; using StrawberryShake; namespace Artemis.UI.Screens.Workshop.Library; -public class SubmissionDetailViewModel : RoutableScreen +public partial class SubmissionDetailViewModel : RoutableScreen { private readonly IWorkshopClient _client; private readonly Func _getGetSpecificationsVm; private readonly IRouter _router; private readonly IWindowService _windowService; private readonly IWorkshopService _workshopService; - private IGetSubmittedEntryById_Entry? _entry; - private EntrySpecificationsViewModel? _entrySpecificationsViewModel; - private bool _hasChanges; + [Notify] private IGetSubmittedEntryById_Entry? _entry; + [Notify] private EntrySpecificationsViewModel? _entrySpecificationsViewModel; + [Notify(Setter.Private)] private bool _hasChanges; public SubmissionDetailViewModel(IWorkshopClient client, IWindowService windowService, IWorkshopService workshopService, IRouter router, Func getSpecificationsVm) { _client = client; @@ -53,24 +54,6 @@ public class SubmissionDetailViewModel : RoutableScreen ViewWorkshopPage { get; } public ReactiveCommand SaveChanges { get; } public ReactiveCommand DiscardChanges { get; } - - public EntrySpecificationsViewModel? EntrySpecificationsViewModel - { - get => _entrySpecificationsViewModel; - set => RaiseAndSetIfChanged(ref _entrySpecificationsViewModel, value); - } - - public IGetSubmittedEntryById_Entry? Entry - { - get => _entry; - set => RaiseAndSetIfChanged(ref _entry, value); - } - - public bool HasChanges - { - get => _hasChanges; - private set => RaiseAndSetIfChanged(ref _hasChanges, value); - } public override async Task OnNavigating(WorkshopDetailParameters parameters, NavigationArguments args, CancellationToken cancellationToken) { diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabItemViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabItemViewModel.cs index 1b22e37aa..4c2009334 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabItemViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabItemViewModel.cs @@ -8,17 +8,18 @@ using Artemis.UI.Shared.Services; using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop.Handlers.InstallationHandlers; using Artemis.WebClient.Workshop.Services; +using PropertyChanged.SourceGenerator; using ReactiveUI; namespace Artemis.UI.Screens.Workshop.Library.Tabs; -public class InstalledTabItemViewModel : ViewModelBase +public partial class InstalledTabItemViewModel : ViewModelBase { private readonly IWorkshopService _workshopService; private readonly IRouter _router; private readonly EntryInstallationHandlerFactory _factory; private readonly IWindowService _windowService; - private bool _isRemoved; + [Notify(Setter.Private)] private bool _isRemoved; public InstalledTabItemViewModel(InstalledEntry installedEntry, IWorkshopService workshopService, IRouter router, EntryInstallationHandlerFactory factory, IWindowService windowService) { @@ -33,12 +34,6 @@ public class InstalledTabItemViewModel : ViewModelBase Uninstall = ReactiveCommand.CreateFromTask(ExecuteUninstall); } - public bool IsRemoved - { - get => _isRemoved; - private set => RaiseAndSetIfChanged(ref _isRemoved, value); - } - public InstalledEntry InstalledEntry { get; } public ReactiveCommand ViewWorkshopPage { get; } public ReactiveCommand ViewLocal { get; } diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabViewModel.cs index 7267c6e25..bc5ba00f3 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/InstalledTabViewModel.cs @@ -7,13 +7,14 @@ using Artemis.UI.Shared.Routing; using Artemis.WebClient.Workshop.Services; using DynamicData; using DynamicData.Binding; +using PropertyChanged.SourceGenerator; using ReactiveUI; namespace Artemis.UI.Screens.Workshop.Library.Tabs; -public class InstalledTabViewModel : RoutableScreen +public partial class InstalledTabViewModel : RoutableScreen { - private string? _searchEntryInput; + [Notify] private string? _searchEntryInput; public InstalledTabViewModel(IWorkshopService workshopService, IRouter router, Func getInstalledTabItemViewModel) { @@ -40,15 +41,8 @@ public class InstalledTabViewModel : RoutableScreen public bool Empty { get; } public ReactiveCommand OpenWorkshop { get; } - public ReadOnlyObservableCollection InstalledEntries { get; } - - public string? SearchEntryInput - { - get => _searchEntryInput; - set => RaiseAndSetIfChanged(ref _searchEntryInput, value); - } - + private Func CreatePredicate(string? text) { if (string.IsNullOrWhiteSpace(text)) diff --git a/src/Artemis.UI/Screens/Workshop/Library/Tabs/SubmissionsTabViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/Tabs/SubmissionsTabViewModel.cs index 76947ec5d..bc812f324 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/Tabs/SubmissionsTabViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Library/Tabs/SubmissionsTabViewModel.cs @@ -11,18 +11,19 @@ using Artemis.UI.Shared.Services; using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop.Services; using DynamicData; +using PropertyChanged.SourceGenerator; using ReactiveUI; using StrawberryShake; namespace Artemis.UI.Screens.Workshop.Library.Tabs; -public class SubmissionsTabViewModel : RoutableScreen +public partial class SubmissionsTabViewModel : RoutableScreen { private readonly IWorkshopClient _client; private readonly SourceCache _entries; private readonly IWindowService _windowService; - private bool _isLoading = true; - private bool _workshopReachable; + [Notify] private bool _isLoading = true; + [Notify] private bool _workshopReachable; public SubmissionsTabViewModel(IWorkshopClient client, IAuthenticationService authenticationService, @@ -54,22 +55,9 @@ public class SubmissionsTabViewModel : RoutableScreen public ReactiveCommand Login { get; } public ReactiveCommand AddSubmission { get; } - public IObservable IsLoggedIn { get; } public ReadOnlyObservableCollection Entries { get; } - - public bool WorkshopReachable - { - get => _workshopReachable; - set => RaiseAndSetIfChanged(ref _workshopReachable, value); - } - - public bool IsLoading - { - get => _isLoading; - set => RaiseAndSetIfChanged(ref _isLoading, value); - } - + private async Task ExecuteLogin(CancellationToken ct) { await _windowService.CreateContentDialog().WithViewModel(out WorkshopLoginViewModel _).WithTitle("Workshop login").ShowAsync(); diff --git a/src/Artemis.UI/Screens/Workshop/Library/WorkshopLibraryViewModel.cs b/src/Artemis.UI/Screens/Workshop/Library/WorkshopLibraryViewModel.cs index 56abc8ffd..413914803 100644 --- a/src/Artemis.UI/Screens/Workshop/Library/WorkshopLibraryViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Library/WorkshopLibraryViewModel.cs @@ -8,14 +8,15 @@ using Artemis.UI.Shared.Routing; using ReactiveUI; using System; using System.Reactive.Linq; +using PropertyChanged.SourceGenerator; namespace Artemis.UI.Screens.Workshop.Library; -public class WorkshopLibraryViewModel : RoutableHostScreen +public partial class WorkshopLibraryViewModel : RoutableHostScreen { private readonly IRouter _router; - private RouteViewModel? _selectedTab; private ObservableAsPropertyHelper? _viewingDetails; + [Notify] private RouteViewModel? _selectedTab; /// public WorkshopLibraryViewModel(IRouter router) @@ -42,12 +43,6 @@ public class WorkshopLibraryViewModel : RoutableHostScreen public bool ViewingDetails => _viewingDetails?.Value ?? false; public ObservableCollection Tabs { get; } - public RouteViewModel? SelectedTab - { - get => _selectedTab; - set => RaiseAndSetIfChanged(ref _selectedTab, value); - } - public override async Task OnNavigating(NavigationArguments args, CancellationToken cancellationToken) { SelectedTab = Tabs.FirstOrDefault(t => t.Matches(args.Path)); diff --git a/src/Artemis.UI/Screens/Workshop/Profile/ProfileDetailsViewModel.cs b/src/Artemis.UI/Screens/Workshop/Profile/ProfileDetailsViewModel.cs index de9fbc651..4dd85cd7f 100644 --- a/src/Artemis.UI/Screens/Workshop/Profile/ProfileDetailsViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Profile/ProfileDetailsViewModel.cs @@ -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 +public partial class ProfileDetailsViewModel : RoutableScreen { private readonly IWorkshopClient _client; private readonly ProfileEntryInstallationHandler _installationHandler; private readonly INotificationService _notificationService; private readonly ObservableAsPropertyHelper _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 public ReactiveCommand 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); diff --git a/src/Artemis.UI/Screens/Workshop/Profile/ProfilePreviewViewModel.cs b/src/Artemis.UI/Screens/Workshop/Profile/ProfilePreviewViewModel.cs index aaebbcc40..9ee71a0dc 100644 --- a/src/Artemis.UI/Screens/Workshop/Profile/ProfilePreviewViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Profile/ProfilePreviewViewModel.cs @@ -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 Devices { get; } - public ProfileConfiguration? ProfileConfiguration - { - get => _profileConfiguration; - set => RaiseAndSetIfChanged(ref _profileConfiguration, value); - } - private void Update() { try diff --git a/src/Artemis.UI/Screens/Workshop/Search/SearchViewModel.cs b/src/Artemis.UI/Screens/Workshop/Search/SearchViewModel.cs index 000f0a330..88b0383fe 100644 --- a/src/Artemis.UI/Screens/Workshop/Search/SearchViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/Search/SearchViewModel.cs @@ -8,20 +8,21 @@ using Artemis.UI.Services.Interfaces; using Artemis.UI.Shared; using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop.Services; +using PropertyChanged.SourceGenerator; using ReactiveUI; using Serilog; using StrawberryShake; namespace Artemis.UI.Screens.Workshop.Search; -public class SearchViewModel : ViewModelBase +public partial class SearchViewModel : ViewModelBase { private readonly ILogger _logger; private readonly IWorkshopService _workshopService; private readonly IDebugService _debugService; private readonly IWorkshopClient _workshopClient; - private bool _isLoading; - private SearchResultViewModel? _selectedEntry; + [Notify] private SearchResultViewModel? _selectedEntry; + [Notify] private bool _isLoading; public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IWorkshopService workshopService, CurrentUserViewModel currentUserViewModel, IDebugService debugService) { @@ -38,19 +39,7 @@ public class SearchViewModel : ViewModelBase public CurrentUserViewModel CurrentUserViewModel { get; } public Func>> SearchAsync { get; } - - public SearchResultViewModel? SelectedEntry - { - get => _selectedEntry; - set => RaiseAndSetIfChanged(ref _selectedEntry, value); - } - - public bool IsLoading - { - get => _isLoading; - set => RaiseAndSetIfChanged(ref _isLoading, value); - } - + public void ShowDebugger() { _debugService.ShowDebugger(); diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/ReleaseWizardViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/ReleaseWizardViewModel.cs index 8ad0db0f6..cfe1412f7 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/ReleaseWizardViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/ReleaseWizardViewModel.cs @@ -3,14 +3,15 @@ using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.WebClient.Workshop; using DryIoc; +using PropertyChanged.SourceGenerator; namespace Artemis.UI.Screens.Workshop.SubmissionWizard; -public class ReleaseWizardViewModel : ActivatableViewModelBase, IWorkshopWizardViewModel +public partial class ReleaseWizardViewModel : ActivatableViewModelBase, IWorkshopWizardViewModel { private readonly SubmissionWizardState _state; private SubmissionViewModel? _screen; - private bool _shouldClose; + [Notify] private bool _shouldClose; public ReleaseWizardViewModel(IContainer container, IWindowService windowService, CurrentUserViewModel currentUserViewModel, IGetSubmittedEntryById_Entry entry) { @@ -42,10 +43,4 @@ public class ReleaseWizardViewModel : ActivatableViewModelBase, IWorkshopWizardV RaiseAndSetIfChanged(ref _screen, value); } } - - public bool ShouldClose - { - get => _shouldClose; - set => RaiseAndSetIfChanged(ref _shouldClose, value); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/EntryTypeStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/EntryTypeStepViewModel.cs index e378e27a3..137394007 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/EntryTypeStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/EntryTypeStepViewModel.cs @@ -1,12 +1,13 @@ using System.Reactive.Linq; using Artemis.WebClient.Workshop; +using PropertyChanged.SourceGenerator; using ReactiveUI; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; -public class EntryTypeStepViewModel : SubmissionViewModel +public partial class EntryTypeStepViewModel : SubmissionViewModel { - private EntryType? _selectedEntryType; + [Notify] private EntryType? _selectedEntryType; /// public EntryTypeStepViewModel() @@ -21,12 +22,6 @@ public class EntryTypeStepViewModel : SubmissionViewModel public bool ShowLayouts => false; #endif - public EntryType? SelectedEntryType - { - get => _selectedEntryType; - set => RaiseAndSetIfChanged(ref _selectedEntryType, value); - } - private void ExecuteContinue() { if (SelectedEntryType == null) diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileAdaptionHintsLayerViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileAdaptionHintsLayerViewModel.cs index 48b741698..4d6f7fc36 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileAdaptionHintsLayerViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileAdaptionHintsLayerViewModel.cs @@ -6,16 +6,17 @@ using Artemis.Core.Services; using Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; +using PropertyChanged.SourceGenerator; using ReactiveUI; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Profile; -public class ProfileAdaptionHintsLayerViewModel : ViewModelBase +public partial class ProfileAdaptionHintsLayerViewModel : ViewModelBase { private readonly ObservableAsPropertyHelper _adaptionHintText; private readonly IProfileService _profileService; private readonly IWindowService _windowService; - private int _adaptionHintCount; + [Notify(Setter.Private)] private int _adaptionHintCount; public ProfileAdaptionHintsLayerViewModel(Layer layer, IWindowService windowService, IProfileService profileService) { @@ -29,15 +30,7 @@ public class ProfileAdaptionHintsLayerViewModel : ViewModelBase } public Layer Layer { get; } - public ReactiveCommand EditAdaptionHints { get; } - - public int AdaptionHintCount - { - get => _adaptionHintCount; - private set => RaiseAndSetIfChanged(ref _adaptionHintCount, value); - } - public string AdaptionHintText => _adaptionHintText.Value; private async Task ExecuteEditAdaptionHints() diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileSelectionStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileSelectionStepViewModel.cs index adad736d7..8970a869f 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileSelectionStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/Profile/ProfileSelectionStepViewModel.cs @@ -8,15 +8,16 @@ using Artemis.Core.Services; using Artemis.UI.Extensions; using Artemis.UI.Screens.Workshop.Profile; using Material.Icons; +using PropertyChanged.SourceGenerator; using ReactiveUI; using SkiaSharp; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Profile; -public class ProfileSelectionStepViewModel : SubmissionViewModel +public partial class ProfileSelectionStepViewModel : SubmissionViewModel { private readonly IProfileService _profileService; - private ProfileConfiguration? _selectedProfile; + [Notify] private ProfileConfiguration? _selectedProfile; /// public ProfileSelectionStepViewModel(IProfileService profileService, ProfilePreviewViewModel profilePreviewViewModel) @@ -45,12 +46,6 @@ public class ProfileSelectionStepViewModel : SubmissionViewModel public ObservableCollection Profiles { get; } public ProfilePreviewViewModel ProfilePreview { get; } - public ProfileConfiguration? SelectedProfile - { - get => _selectedProfile; - set => RaiseAndSetIfChanged(ref _selectedProfile, value); - } - private void Update(ProfileConfiguration? profileConfiguration) { ProfilePreview.ProfileConfiguration = null; diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SpecificationsStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SpecificationsStepViewModel.cs index 4e8a17c20..55e3678a8 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SpecificationsStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SpecificationsStepViewModel.cs @@ -8,14 +8,15 @@ using Artemis.UI.Screens.Workshop.Entries; using Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Profile; using Artemis.WebClient.Workshop; using DynamicData; +using PropertyChanged.SourceGenerator; using ReactiveUI; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; -public class SpecificationsStepViewModel : SubmissionViewModel +public partial class SpecificationsStepViewModel : SubmissionViewModel { private readonly Func _getEntrySpecificationsViewModel; - private EntrySpecificationsViewModel? _entrySpecificationsViewModel; + [Notify] private EntrySpecificationsViewModel? _entrySpecificationsViewModel; public SpecificationsStepViewModel(Func getEntrySpecificationsViewModel) { @@ -29,12 +30,6 @@ public class SpecificationsStepViewModel : SubmissionViewModel }); } - public EntrySpecificationsViewModel? EntrySpecificationsViewModel - { - get => _entrySpecificationsViewModel; - set => RaiseAndSetIfChanged(ref _entrySpecificationsViewModel, value); - } - private void ExecuteGoBack() { // Apply what's there so far diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SubmitStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SubmitStepViewModel.cs index 8544c30ef..5cbc4c1ef 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SubmitStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/SubmitStepViewModel.cs @@ -9,15 +9,16 @@ using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop.Services; using Avalonia.Media.Imaging; using IdentityModel; +using PropertyChanged.SourceGenerator; using ReactiveUI; using StrawberryShake; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; -public class SubmitStepViewModel : SubmissionViewModel +public partial class SubmitStepViewModel : SubmissionViewModel { - private ReadOnlyObservableCollection? _categories; - private Bitmap? _iconBitmap; + [Notify] private ReadOnlyObservableCollection? _categories; + [Notify] private Bitmap? _iconBitmap; /// public SubmitStepViewModel(IAuthenticationService authenticationService, IWorkshopClient workshopClient) @@ -40,21 +41,9 @@ public class SubmitStepViewModel : SubmissionViewModel Observable.FromAsync(workshopClient.GetCategories.ExecuteAsync).Subscribe(PopulateCategories).DisposeWith(d); }); } - - public Bitmap? IconBitmap - { - get => _iconBitmap; - set => RaiseAndSetIfChanged(ref _iconBitmap, value); - } - + public string? CurrentUser { get; } - - public ReadOnlyObservableCollection? Categories - { - get => _categories; - set => RaiseAndSetIfChanged(ref _categories, value); - } - + private void PopulateCategories(IOperationResult result) { if (result.Data == null) diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/UploadStepViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/UploadStepViewModel.cs index 38e6464c1..c797bb1d8 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/UploadStepViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/Steps/UploadStepViewModel.cs @@ -11,13 +11,14 @@ using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop.Exceptions; using Artemis.WebClient.Workshop.Handlers.UploadHandlers; using Artemis.WebClient.Workshop.Services; +using PropertyChanged.SourceGenerator; using ReactiveUI; using Serilog; using StrawberryShake; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; -public class UploadStepViewModel : SubmissionViewModel +public partial class UploadStepViewModel : SubmissionViewModel { private readonly ILogger _logger; private readonly EntryUploadHandlerFactory _entryUploadHandlerFactory; @@ -28,11 +29,10 @@ public class UploadStepViewModel : SubmissionViewModel private readonly IWindowService _windowService; private readonly IWorkshopClient _workshopClient; private readonly IWorkshopService _workshopService; - private long? _entryId; - private bool _failed; - private bool _finished; - private bool _succeeded; + [Notify] private bool _failed; + [Notify] private bool _finished; + [Notify] private bool _succeeded; /// public UploadStepViewModel(ILogger logger, @@ -66,24 +66,6 @@ public class UploadStepViewModel : SubmissionViewModel public int ProgressPercentage => _progressPercentage.Value; public bool ProgressIndeterminate => _progressIndeterminate.Value; - public bool Finished - { - get => _finished; - set => RaiseAndSetIfChanged(ref _finished, value); - } - - public bool Succeeded - { - get => _succeeded; - set => RaiseAndSetIfChanged(ref _succeeded, value); - } - - public bool Failed - { - get => _failed; - set => RaiseAndSetIfChanged(ref _failed, value); - } - private async Task ExecuteUpload(CancellationToken cancellationToken) { // Use the existing entry or create a new one diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionViewModel.cs index 282b34590..5e5284d58 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionViewModel.cs @@ -1,53 +1,18 @@ using System.Reactive; using Artemis.UI.Shared; +using PropertyChanged.SourceGenerator; using ReactiveUI; namespace Artemis.UI.Screens.Workshop.SubmissionWizard; -public abstract class SubmissionViewModel : ValidatableViewModelBase +public abstract partial class SubmissionViewModel : ValidatableViewModelBase { - private ReactiveCommand? _continue; - private ReactiveCommand? _goBack; - private string _continueText = "Continue"; - private bool _showFinish; - private bool _showGoBack = true; - private bool _showHeader = true; + [Notify] private ReactiveCommand? _continue; + [Notify] private ReactiveCommand? _goBack; + [Notify] private string _continueText = "Continue"; + [Notify] private bool _showFinish; + [Notify] private bool _showGoBack = true; + [Notify] private bool _showHeader = true; public SubmissionWizardState State { get; set; } = null!; - - public ReactiveCommand? Continue - { - get => _continue; - set => RaiseAndSetIfChanged(ref _continue, value); - } - - public ReactiveCommand? GoBack - { - get => _goBack; - set => RaiseAndSetIfChanged(ref _goBack, value); - } - - public bool ShowHeader - { - get => _showHeader; - set => RaiseAndSetIfChanged(ref _showHeader, value); - } - - public bool ShowGoBack - { - get => _showGoBack; - set => RaiseAndSetIfChanged(ref _showGoBack, value); - } - - public bool ShowFinish - { - get => _showFinish; - set => RaiseAndSetIfChanged(ref _showFinish, value); - } - - public string ContinueText - { - get => _continueText; - set => RaiseAndSetIfChanged(ref _continueText, value); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardViewModel.cs b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardViewModel.cs index a18c63e71..a0cdc461b 100644 --- a/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/SubmissionWizard/SubmissionWizardViewModel.cs @@ -3,14 +3,15 @@ using Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using DryIoc; +using PropertyChanged.SourceGenerator; namespace Artemis.UI.Screens.Workshop.SubmissionWizard; -public class SubmissionWizardViewModel : ActivatableViewModelBase, IWorkshopWizardViewModel +public partial class SubmissionWizardViewModel : ActivatableViewModelBase, IWorkshopWizardViewModel { private readonly SubmissionWizardState _state; private SubmissionViewModel _screen; - private bool _shouldClose; + [Notify] private bool _shouldClose; public SubmissionWizardViewModel(IContainer container, IWindowService windowService, @@ -38,10 +39,4 @@ public class SubmissionWizardViewModel : ActivatableViewModelBase, IWorkshopWiza RaiseAndSetIfChanged(ref _screen, value); } } - - public bool ShouldClose - { - get => _shouldClose; - set => RaiseAndSetIfChanged(ref _shouldClose, value); - } } \ No newline at end of file diff --git a/src/Artemis.UI/Screens/Workshop/WorkshopViewModel.cs b/src/Artemis.UI/Screens/Workshop/WorkshopViewModel.cs index 96825dcdd..5226d95de 100644 --- a/src/Artemis.UI/Screens/Workshop/WorkshopViewModel.cs +++ b/src/Artemis.UI/Screens/Workshop/WorkshopViewModel.cs @@ -4,13 +4,14 @@ using Artemis.UI.Screens.Workshop.Home; using Artemis.UI.Screens.Workshop.Search; using Artemis.UI.Shared; using Artemis.UI.Shared.Routing; +using PropertyChanged.SourceGenerator; namespace Artemis.UI.Screens.Workshop; -public class WorkshopViewModel : RoutableHostScreen, IMainScreenViewModel +public partial class WorkshopViewModel : RoutableHostScreen, IMainScreenViewModel { private readonly SearchViewModel _searchViewModel; - private ViewModelBase? _titleBarViewModel; + [Notify] private ViewModelBase? _titleBarViewModel; public WorkshopViewModel(SearchViewModel searchViewModel, WorkshopHomeViewModel homeViewModel) { @@ -26,10 +27,4 @@ public class WorkshopViewModel : RoutableHostScreen, IMainScreen TitleBarViewModel = args.Path == "workshop" ? _searchViewModel : null; return base.OnNavigating(args, cancellationToken); } - - public ViewModelBase? TitleBarViewModel - { - get => _titleBarViewModel; - set => RaiseAndSetIfChanged(ref _titleBarViewModel, value); - } } \ No newline at end of file diff --git a/src/Artemis.WebClient.Workshop/WorkshopConstants.cs b/src/Artemis.WebClient.Workshop/WorkshopConstants.cs index 192a92b56..6ae8c0f5a 100644 --- a/src/Artemis.WebClient.Workshop/WorkshopConstants.cs +++ b/src/Artemis.WebClient.Workshop/WorkshopConstants.cs @@ -2,7 +2,9 @@ namespace Artemis.WebClient.Workshop; public static class WorkshopConstants { - public const string AUTHORITY_URL = "https://identity.artemis-rgb.com"; - public const string WORKSHOP_URL = "https://workshop.artemis-rgb.com"; + public const string AUTHORITY_URL = "https://localhost:5001"; + public const string WORKSHOP_URL = "https://localhost:7281"; + // public const string AUTHORITY_URL = "https://identity.artemis-rgb.com"; + // public const string WORKSHOP_URL = "https://workshop.artemis-rgb.com"; public const string WORKSHOP_CLIENT_NAME = "WorkshopApiClient"; } \ No newline at end of file