1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

UI - Use PropertyChanged.SourceGenerator in workshop

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

View File

@ -2,12 +2,13 @@ using System;
using Artemis.UI.Shared; using Artemis.UI.Shared;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using Material.Icons; using Material.Icons;
using PropertyChanged.SourceGenerator;
namespace Artemis.UI.Screens.Workshop.Categories; 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) public CategoryViewModel(IGetCategories_Categories category)
{ {
@ -20,10 +21,4 @@ public class CategoryViewModel : ViewModelBase
public long Id { get; } public long Id { get; }
public string Name { get; } public string Name { get; }
public MaterialIconKind Icon { get; } public MaterialIconKind Icon { get; }
public bool IsSelected
{
get => _isSelected;
set => RaiseAndSetIfChanged(ref _isSelected, value);
}
} }

View File

@ -11,23 +11,24 @@ using Artemis.WebClient.Workshop.Services;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using FluentAvalonia.UI.Controls; using FluentAvalonia.UI.Controls;
using Flurl.Http; using Flurl.Http;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using Serilog; using Serilog;
namespace Artemis.UI.Screens.Workshop.CurrentUser; namespace Artemis.UI.Screens.Workshop.CurrentUser;
public class CurrentUserViewModel : ActivatableViewModelBase public partial class CurrentUserViewModel : ActivatableViewModelBase
{ {
private readonly IAuthenticationService _authenticationService; private readonly IAuthenticationService _authenticationService;
private readonly ObservableAsPropertyHelper<bool> _isAnonymous; private readonly ObservableAsPropertyHelper<bool> _isAnonymous;
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
private bool _allowLogout = true; [Notify] private bool _allowLogout = true;
private Bitmap? _avatar; [Notify(Setter.Private)] private Bitmap? _avatar;
private string? _email; [Notify(Setter.Private)] private string? _email;
private bool _loading = true; [Notify(Setter.Private)] private bool _loading = true;
private string? _name; [Notify(Setter.Private)] private string? _name;
private string? _userId; [Notify(Setter.Private)] private string? _userId;
public CurrentUserViewModel(ILogger logger, IAuthenticationService authenticationService, IWindowService windowService) public CurrentUserViewModel(ILogger logger, IAuthenticationService authenticationService, IWindowService windowService)
{ {
@ -47,42 +48,6 @@ public class CurrentUserViewModel : ActivatableViewModelBase
public bool IsAnonymous => _isAnonymous.Value; 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<Unit, Unit> Login { get; } public ReactiveCommand<Unit, Unit> Login { get; }
public void Logout() public void Logout()

View File

@ -8,14 +8,15 @@ using Artemis.UI.Shared.Routing;
using ReactiveUI; using ReactiveUI;
using System; using System;
using System.Reactive.Linq; using System.Reactive.Linq;
using PropertyChanged.SourceGenerator;
namespace Artemis.UI.Screens.Workshop.Entries; namespace Artemis.UI.Screens.Workshop.Entries;
public class EntriesViewModel : RoutableHostScreen<RoutableScreen> public partial class EntriesViewModel : RoutableHostScreen<RoutableScreen>
{ {
private readonly IRouter _router; private readonly IRouter _router;
private RouteViewModel? _selectedTab;
private ObservableAsPropertyHelper<bool>? _viewingDetails; private ObservableAsPropertyHelper<bool>? _viewingDetails;
[Notify] private RouteViewModel? _selectedTab;
public EntriesViewModel(IRouter router) public EntriesViewModel(IRouter router)
{ {
@ -44,12 +45,6 @@ public class EntriesViewModel : RoutableHostScreen<RoutableScreen>
public bool ViewingDetails => _viewingDetails?.Value ?? false; public bool ViewingDetails => _viewingDetails?.Value ?? false;
public ObservableCollection<RouteViewModel> Tabs { get; } public ObservableCollection<RouteViewModel> Tabs { get; }
public RouteViewModel? SelectedTab
{
get => _selectedTab;
set => RaiseAndSetIfChanged(ref _selectedTab, value);
}
public override async Task OnNavigating(NavigationArguments args, CancellationToken cancellationToken) public override async Task OnNavigating(NavigationArguments args, CancellationToken cancellationToken)
{ {
SelectedTab = Tabs.FirstOrDefault(t => t.Matches(args.Path)); SelectedTab = Tabs.FirstOrDefault(t => t.Matches(args.Path));

View File

@ -1,18 +1,19 @@
using Artemis.Core; using Artemis.Core;
using Artemis.Core.Services; using Artemis.Core.Services;
using Artemis.UI.Shared; using Artemis.UI.Shared;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.Entries; namespace Artemis.UI.Screens.Workshop.Entries;
public class EntryListInputViewModel : ViewModelBase public partial class EntryListInputViewModel : ViewModelBase
{ {
private static string? _lastSearch; private static string? _lastSearch;
private readonly PluginSetting<int> _entriesPerPage; private readonly PluginSetting<int> _entriesPerPage;
private readonly PluginSetting<int> _sortBy; private readonly PluginSetting<int> _sortBy;
private string? _search; private string? _search;
private string _searchWatermark = "Search"; [Notify] private string _searchWatermark = "Search";
private int _totalCount; [Notify] private int _totalCount;
public EntryListInputViewModel(ISettingsService settingsService) public EntryListInputViewModel(ISettingsService settingsService)
{ {
@ -23,12 +24,6 @@ public class EntryListInputViewModel : ViewModelBase
_sortBy.AutoSave = true; _sortBy.AutoSave = true;
} }
public string SearchWatermark
{
get => _searchWatermark;
set => RaiseAndSetIfChanged(ref _searchWatermark, value);
}
public string? Search public string? Search
{ {
get => _search; get => _search;
@ -59,15 +54,8 @@ public class EntryListInputViewModel : ViewModelBase
} }
} }
public int TotalCount
{
get => _totalCount;
set => RaiseAndSetIfChanged(ref _totalCount, value);
}
public void ClearLastSearch() public void ClearLastSearch()
{ {
_lastSearch = null; _lastSearch = null;
} }
} }

View File

@ -13,12 +13,13 @@ using Artemis.UI.Shared.Services.Builders;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using Avalonia.Threading; using Avalonia.Threading;
using DynamicData; using DynamicData;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using StrawberryShake; using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.Entries; namespace Artemis.UI.Screens.Workshop.Entries;
public abstract class EntryListViewModel : RoutableScreen<WorkshopListParameters> public abstract partial class EntryListViewModel : RoutableScreen<WorkshopListParameters>
{ {
private readonly SourceList<IGetEntries_Entries_Items> _entries = new(); private readonly SourceList<IGetEntries_Entries_Items> _entries = new();
private readonly ObservableAsPropertyHelper<bool> _isLoading; private readonly ObservableAsPropertyHelper<bool> _isLoading;
@ -26,10 +27,9 @@ public abstract class EntryListViewModel : RoutableScreen<WorkshopListParameters
private readonly string _route; private readonly string _route;
private readonly ObservableAsPropertyHelper<bool> _showPagination; private readonly ObservableAsPropertyHelper<bool> _showPagination;
private readonly IWorkshopClient _workshopClient; private readonly IWorkshopClient _workshopClient;
private int _loadedPage = -1; [Notify] private int _page;
[Notify] private int _loadedPage = -1;
private int _page; [Notify] private int _totalPages = 1;
private int _totalPages = 1;
protected EntryListViewModel(string route, protected EntryListViewModel(string route,
IWorkshopClient workshopClient, IWorkshopClient workshopClient,
@ -75,25 +75,6 @@ public abstract class EntryListViewModel : RoutableScreen<WorkshopListParameters
public ReadOnlyObservableCollection<EntryListItemViewModel> Entries { get; } public ReadOnlyObservableCollection<EntryListItemViewModel> 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) public override async Task OnNavigating(WorkshopListParameters parameters, NavigationArguments args, CancellationToken cancellationToken)
{ {
Page = Math.Max(1, parameters.Page); Page = Math.Max(1, parameters.Page);

View File

@ -16,6 +16,7 @@ using AvaloniaEdit.Document;
using DynamicData; using DynamicData;
using DynamicData.Aggregation; using DynamicData.Aggregation;
using DynamicData.Binding; using DynamicData.Binding;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Validation.Extensions; using ReactiveUI.Validation.Extensions;
using ReactiveUI.Validation.Helpers; using ReactiveUI.Validation.Helpers;
@ -23,20 +24,19 @@ using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.Entries; namespace Artemis.UI.Screens.Workshop.Entries;
public class EntrySpecificationsViewModel : ValidatableViewModelBase public partial class EntrySpecificationsViewModel : ValidatableViewModelBase
{ {
private readonly ObservableAsPropertyHelper<bool> _categoriesValid; private readonly ObservableAsPropertyHelper<bool> _categoriesValid;
private readonly ObservableAsPropertyHelper<bool> _iconValid; private readonly ObservableAsPropertyHelper<bool> _iconValid;
private readonly ObservableAsPropertyHelper<bool> _descriptionValid; private readonly ObservableAsPropertyHelper<bool> _descriptionValid;
private readonly IWorkshopClient _workshopClient; private readonly IWorkshopClient _workshopClient;
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
[Notify] private string _name = string.Empty;
private string _description = string.Empty; [Notify] private string _summary = string.Empty;
private Bitmap? _iconBitmap; [Notify] private string _description = string.Empty;
private TextDocument? _markdownDocument; [Notify] private Bitmap? _iconBitmap;
private string _name = string.Empty; [Notify] private TextDocument? _markdownDocument;
private string _summary = string.Empty; [Notify(Setter.Private)] private bool _iconChanged;
private bool _iconChanged;
public EntrySpecificationsViewModel(IWorkshopClient workshopClient, IWindowService windowService) public EntrySpecificationsViewModel(IWorkshopClient workshopClient, IWindowService windowService)
{ {
@ -91,42 +91,6 @@ public class EntrySpecificationsViewModel : ValidatableViewModelBase
public bool IconValid => _iconValid.Value; public bool IconValid => _iconValid.Value;
public bool DescriptionValid => _descriptionValid.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<long> PreselectedCategories { get; set; } = new(); public List<long> PreselectedCategories { get; set; } = new();
private void MarkdownDocumentOnTextChanged(object? sender, EventArgs e) private void MarkdownDocumentOnTextChanged(object? sender, EventArgs e)

View File

@ -6,14 +6,15 @@ using Artemis.UI.Screens.Workshop.SubmissionWizard;
using Artemis.UI.Shared.Routing; using Artemis.UI.Shared.Routing;
using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.Home; namespace Artemis.UI.Screens.Workshop.Home;
public class WorkshopHomeViewModel : RoutableScreen public partial class WorkshopHomeViewModel : RoutableScreen
{ {
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
private bool _workshopReachable; [Notify(Setter.Private)] private bool _workshopReachable;
public WorkshopHomeViewModel(IRouter router, IWindowService windowService, IWorkshopService workshopService) public WorkshopHomeViewModel(IRouter router, IWindowService windowService, IWorkshopService workshopService)
{ {
@ -34,12 +35,6 @@ public class WorkshopHomeViewModel : RoutableScreen
public ReactiveCommand<Unit, Unit> AddSubmission { get; } public ReactiveCommand<Unit, Unit> AddSubmission { get; }
public ReactiveCommand<string, Unit> Navigate { get; } public ReactiveCommand<string, Unit> Navigate { get; }
public bool WorkshopReachable
{
get => _workshopReachable;
private set => RaiseAndSetIfChanged(ref _workshopReachable, value);
}
private async Task ExecuteAddSubmission(CancellationToken arg) private async Task ExecuteAddSubmission(CancellationToken arg)
{ {
await _windowService.ShowDialogAsync<SubmissionWizardViewModel>(); await _windowService.ShowDialogAsync<SubmissionWizardViewModel>();

View File

@ -4,15 +4,16 @@ using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Artemis.UI.Shared.Routing; using Artemis.UI.Shared.Routing;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.Home; namespace Artemis.UI.Screens.Workshop.Home;
public class WorkshopOfflineViewModel : RoutableScreen<WorkshopOfflineParameters> public partial class WorkshopOfflineViewModel : RoutableScreen<WorkshopOfflineParameters>
{ {
private readonly IRouter _router; private readonly IRouter _router;
private readonly IWorkshopService _workshopService; private readonly IWorkshopService _workshopService;
private string _message = string.Empty; [Notify] private string _message = string.Empty;
/// <inheritdoc /> /// <inheritdoc />
public WorkshopOfflineViewModel(IWorkshopService workshopService, IRouter router) public WorkshopOfflineViewModel(IWorkshopService workshopService, IRouter router)
@ -25,12 +26,6 @@ public class WorkshopOfflineViewModel : RoutableScreen<WorkshopOfflineParameters
public ReactiveCommand<Unit, Unit> Retry { get; } public ReactiveCommand<Unit, Unit> Retry { get; }
public string Message
{
get => _message;
set => RaiseAndSetIfChanged(ref _message, value);
}
public override Task OnNavigating(WorkshopOfflineParameters parameters, NavigationArguments args, CancellationToken cancellationToken) public override Task OnNavigating(WorkshopOfflineParameters parameters, NavigationArguments args, CancellationToken cancellationToken)
{ {
Message = parameters.Message; Message = parameters.Message;

View File

@ -10,18 +10,19 @@ using Artemis.UI.Shared.Services;
using Artemis.UI.Shared.Services.Builders; using Artemis.UI.Shared.Services.Builders;
using Artemis.UI.Shared.Utilities; using Artemis.UI.Shared.Utilities;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using StrawberryShake; using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.Layout; namespace Artemis.UI.Screens.Workshop.Layout;
public class LayoutDetailsViewModel : RoutableScreen<WorkshopDetailParameters> public partial class LayoutDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
{ {
private readonly IWorkshopClient _client; private readonly IWorkshopClient _client;
private readonly INotificationService _notificationService; private readonly INotificationService _notificationService;
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
private readonly ObservableAsPropertyHelper<DateTimeOffset?> _updatedAt; private readonly ObservableAsPropertyHelper<DateTimeOffset?> _updatedAt;
private IGetEntryById_Entry? _entry; [Notify(Setter.Private)] private IGetEntryById_Entry? _entry;
public LayoutDetailsViewModel(IWorkshopClient client, INotificationService notificationService, IWindowService windowService) public LayoutDetailsViewModel(IWorkshopClient client, INotificationService notificationService, IWindowService windowService)
{ {
@ -37,12 +38,6 @@ public class LayoutDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
public DateTimeOffset? UpdatedAt => _updatedAt.Value; 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) public override async Task OnNavigating(WorkshopDetailParameters parameters, NavigationArguments args, CancellationToken cancellationToken)
{ {
await GetEntry(parameters.EntryId, cancellationToken); await GetEntry(parameters.EntryId, cancellationToken);

View File

@ -18,21 +18,22 @@ using Artemis.WebClient.Workshop.Exceptions;
using Artemis.WebClient.Workshop.Handlers.UploadHandlers; using Artemis.WebClient.Workshop.Handlers.UploadHandlers;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using StrawberryShake; using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.Library; namespace Artemis.UI.Screens.Workshop.Library;
public class SubmissionDetailViewModel : RoutableScreen<WorkshopDetailParameters> public partial class SubmissionDetailViewModel : RoutableScreen<WorkshopDetailParameters>
{ {
private readonly IWorkshopClient _client; private readonly IWorkshopClient _client;
private readonly Func<EntrySpecificationsViewModel> _getGetSpecificationsVm; private readonly Func<EntrySpecificationsViewModel> _getGetSpecificationsVm;
private readonly IRouter _router; private readonly IRouter _router;
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
private readonly IWorkshopService _workshopService; private readonly IWorkshopService _workshopService;
private IGetSubmittedEntryById_Entry? _entry; [Notify] private IGetSubmittedEntryById_Entry? _entry;
private EntrySpecificationsViewModel? _entrySpecificationsViewModel; [Notify] private EntrySpecificationsViewModel? _entrySpecificationsViewModel;
private bool _hasChanges; [Notify(Setter.Private)] private bool _hasChanges;
public SubmissionDetailViewModel(IWorkshopClient client, IWindowService windowService, IWorkshopService workshopService, IRouter router, Func<EntrySpecificationsViewModel> getSpecificationsVm) { public SubmissionDetailViewModel(IWorkshopClient client, IWindowService windowService, IWorkshopService workshopService, IRouter router, Func<EntrySpecificationsViewModel> getSpecificationsVm) {
_client = client; _client = client;
@ -54,24 +55,6 @@ public class SubmissionDetailViewModel : RoutableScreen<WorkshopDetailParameters
public ReactiveCommand<Unit, Unit> SaveChanges { get; } public ReactiveCommand<Unit, Unit> SaveChanges { get; }
public ReactiveCommand<Unit, Unit> DiscardChanges { get; } public ReactiveCommand<Unit, Unit> 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) public override async Task OnNavigating(WorkshopDetailParameters parameters, NavigationArguments args, CancellationToken cancellationToken)
{ {
IOperationResult<IGetSubmittedEntryByIdResult> result = await _client.GetSubmittedEntryById.ExecuteAsync(parameters.EntryId, cancellationToken); IOperationResult<IGetSubmittedEntryByIdResult> result = await _client.GetSubmittedEntryById.ExecuteAsync(parameters.EntryId, cancellationToken);

View File

@ -8,17 +8,18 @@ using Artemis.UI.Shared.Services;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using Artemis.WebClient.Workshop.Handlers.InstallationHandlers; using Artemis.WebClient.Workshop.Handlers.InstallationHandlers;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.Library.Tabs; namespace Artemis.UI.Screens.Workshop.Library.Tabs;
public class InstalledTabItemViewModel : ViewModelBase public partial class InstalledTabItemViewModel : ViewModelBase
{ {
private readonly IWorkshopService _workshopService; private readonly IWorkshopService _workshopService;
private readonly IRouter _router; private readonly IRouter _router;
private readonly EntryInstallationHandlerFactory _factory; private readonly EntryInstallationHandlerFactory _factory;
private readonly IWindowService _windowService; 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) public InstalledTabItemViewModel(InstalledEntry installedEntry, IWorkshopService workshopService, IRouter router, EntryInstallationHandlerFactory factory, IWindowService windowService)
{ {
@ -33,12 +34,6 @@ public class InstalledTabItemViewModel : ViewModelBase
Uninstall = ReactiveCommand.CreateFromTask(ExecuteUninstall); Uninstall = ReactiveCommand.CreateFromTask(ExecuteUninstall);
} }
public bool IsRemoved
{
get => _isRemoved;
private set => RaiseAndSetIfChanged(ref _isRemoved, value);
}
public InstalledEntry InstalledEntry { get; } public InstalledEntry InstalledEntry { get; }
public ReactiveCommand<Unit, Unit> ViewWorkshopPage { get; } public ReactiveCommand<Unit, Unit> ViewWorkshopPage { get; }
public ReactiveCommand<Unit,Unit> ViewLocal { get; } public ReactiveCommand<Unit,Unit> ViewLocal { get; }

View File

@ -7,13 +7,14 @@ using Artemis.UI.Shared.Routing;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using DynamicData; using DynamicData;
using DynamicData.Binding; using DynamicData.Binding;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.Library.Tabs; 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<InstalledEntry, InstalledTabItemViewModel> getInstalledTabItemViewModel) public InstalledTabViewModel(IWorkshopService workshopService, IRouter router, Func<InstalledEntry, InstalledTabItemViewModel> getInstalledTabItemViewModel)
{ {
@ -40,15 +41,8 @@ public class InstalledTabViewModel : RoutableScreen
public bool Empty { get; } public bool Empty { get; }
public ReactiveCommand<Unit, Unit> OpenWorkshop { get; } public ReactiveCommand<Unit, Unit> OpenWorkshop { get; }
public ReadOnlyObservableCollection<InstalledTabItemViewModel> InstalledEntries { get; } public ReadOnlyObservableCollection<InstalledTabItemViewModel> InstalledEntries { get; }
public string? SearchEntryInput
{
get => _searchEntryInput;
set => RaiseAndSetIfChanged(ref _searchEntryInput, value);
}
private Func<InstalledEntry, bool> CreatePredicate(string? text) private Func<InstalledEntry, bool> CreatePredicate(string? text)
{ {
if (string.IsNullOrWhiteSpace(text)) if (string.IsNullOrWhiteSpace(text))

View File

@ -11,18 +11,19 @@ using Artemis.UI.Shared.Services;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using DynamicData; using DynamicData;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using StrawberryShake; using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.Library.Tabs; namespace Artemis.UI.Screens.Workshop.Library.Tabs;
public class SubmissionsTabViewModel : RoutableScreen public partial class SubmissionsTabViewModel : RoutableScreen
{ {
private readonly IWorkshopClient _client; private readonly IWorkshopClient _client;
private readonly SourceCache<IGetSubmittedEntries_SubmittedEntries, long> _entries; private readonly SourceCache<IGetSubmittedEntries_SubmittedEntries, long> _entries;
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
private bool _isLoading = true; [Notify] private bool _isLoading = true;
private bool _workshopReachable; [Notify] private bool _workshopReachable;
public SubmissionsTabViewModel(IWorkshopClient client, public SubmissionsTabViewModel(IWorkshopClient client,
IAuthenticationService authenticationService, IAuthenticationService authenticationService,
@ -54,22 +55,9 @@ public class SubmissionsTabViewModel : RoutableScreen
public ReactiveCommand<Unit, Unit> Login { get; } public ReactiveCommand<Unit, Unit> Login { get; }
public ReactiveCommand<Unit, Unit> AddSubmission { get; } public ReactiveCommand<Unit, Unit> AddSubmission { get; }
public IObservable<bool> IsLoggedIn { get; } public IObservable<bool> IsLoggedIn { get; }
public ReadOnlyObservableCollection<SubmissionsTabItemViewModel> Entries { get; } public ReadOnlyObservableCollection<SubmissionsTabItemViewModel> 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) private async Task ExecuteLogin(CancellationToken ct)
{ {
await _windowService.CreateContentDialog().WithViewModel(out WorkshopLoginViewModel _).WithTitle("Workshop login").ShowAsync(); await _windowService.CreateContentDialog().WithViewModel(out WorkshopLoginViewModel _).WithTitle("Workshop login").ShowAsync();

View File

@ -8,14 +8,15 @@ using Artemis.UI.Shared.Routing;
using ReactiveUI; using ReactiveUI;
using System; using System;
using System.Reactive.Linq; using System.Reactive.Linq;
using PropertyChanged.SourceGenerator;
namespace Artemis.UI.Screens.Workshop.Library; namespace Artemis.UI.Screens.Workshop.Library;
public class WorkshopLibraryViewModel : RoutableHostScreen<RoutableScreen> public partial class WorkshopLibraryViewModel : RoutableHostScreen<RoutableScreen>
{ {
private readonly IRouter _router; private readonly IRouter _router;
private RouteViewModel? _selectedTab;
private ObservableAsPropertyHelper<bool>? _viewingDetails; private ObservableAsPropertyHelper<bool>? _viewingDetails;
[Notify] private RouteViewModel? _selectedTab;
/// <inheritdoc /> /// <inheritdoc />
public WorkshopLibraryViewModel(IRouter router) public WorkshopLibraryViewModel(IRouter router)
@ -42,12 +43,6 @@ public class WorkshopLibraryViewModel : RoutableHostScreen<RoutableScreen>
public bool ViewingDetails => _viewingDetails?.Value ?? false; public bool ViewingDetails => _viewingDetails?.Value ?? false;
public ObservableCollection<RouteViewModel> Tabs { get; } public ObservableCollection<RouteViewModel> Tabs { get; }
public RouteViewModel? SelectedTab
{
get => _selectedTab;
set => RaiseAndSetIfChanged(ref _selectedTab, value);
}
public override async Task OnNavigating(NavigationArguments args, CancellationToken cancellationToken) public override async Task OnNavigating(NavigationArguments args, CancellationToken cancellationToken)
{ {
SelectedTab = Tabs.FirstOrDefault(t => t.Matches(args.Path)); SelectedTab = Tabs.FirstOrDefault(t => t.Matches(args.Path));

View File

@ -12,19 +12,20 @@ using Artemis.UI.Shared.Utilities;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using Artemis.WebClient.Workshop.Handlers.InstallationHandlers; using Artemis.WebClient.Workshop.Handlers.InstallationHandlers;
using Artemis.WebClient.Workshop.Handlers.InstallationHandlers.Implementations; using Artemis.WebClient.Workshop.Handlers.InstallationHandlers.Implementations;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using StrawberryShake; using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.Profile; namespace Artemis.UI.Screens.Workshop.Profile;
public class ProfileDetailsViewModel : RoutableScreen<WorkshopDetailParameters> public partial class ProfileDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
{ {
private readonly IWorkshopClient _client; private readonly IWorkshopClient _client;
private readonly ProfileEntryInstallationHandler _installationHandler; private readonly ProfileEntryInstallationHandler _installationHandler;
private readonly INotificationService _notificationService; private readonly INotificationService _notificationService;
private readonly ObservableAsPropertyHelper<DateTimeOffset?> _updatedAt; private readonly ObservableAsPropertyHelper<DateTimeOffset?> _updatedAt;
private readonly IWindowService _windowService; 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) public ProfileDetailsViewModel(IWorkshopClient client, ProfileEntryInstallationHandler installationHandler, INotificationService notificationService, IWindowService windowService)
{ {
@ -44,12 +45,6 @@ public class ProfileDetailsViewModel : RoutableScreen<WorkshopDetailParameters>
public DateTimeOffset? UpdatedAt => _updatedAt.Value; 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) public override async Task OnNavigating(WorkshopDetailParameters parameters, NavigationArguments args, CancellationToken cancellationToken)
{ {
await GetEntry(parameters.EntryId, cancellationToken); await GetEntry(parameters.EntryId, cancellationToken);

View File

@ -6,15 +6,16 @@ using Artemis.Core;
using Artemis.Core.Services; using Artemis.Core.Services;
using Artemis.UI.Shared; using Artemis.UI.Shared;
using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.Profile; namespace Artemis.UI.Screens.Workshop.Profile;
public class ProfilePreviewViewModel : ActivatableViewModelBase public partial class ProfilePreviewViewModel : ActivatableViewModelBase
{ {
private readonly IProfileService _profileService; private readonly IProfileService _profileService;
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
private ProfileConfiguration? _profileConfiguration; [Notify] private ProfileConfiguration? _profileConfiguration;
public ProfilePreviewViewModel(IProfileService profileService, IDeviceService deviceService, IWindowService windowService) public ProfilePreviewViewModel(IProfileService profileService, IDeviceService deviceService, IWindowService windowService)
{ {
@ -29,12 +30,6 @@ public class ProfilePreviewViewModel : ActivatableViewModelBase
public ObservableCollection<ArtemisDevice> Devices { get; } public ObservableCollection<ArtemisDevice> Devices { get; }
public ProfileConfiguration? ProfileConfiguration
{
get => _profileConfiguration;
set => RaiseAndSetIfChanged(ref _profileConfiguration, value);
}
private void Update() private void Update()
{ {
try try

View File

@ -8,20 +8,21 @@ using Artemis.UI.Services.Interfaces;
using Artemis.UI.Shared; using Artemis.UI.Shared;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using Serilog; using Serilog;
using StrawberryShake; using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.Search; namespace Artemis.UI.Screens.Workshop.Search;
public class SearchViewModel : ViewModelBase public partial class SearchViewModel : ViewModelBase
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly IWorkshopService _workshopService; private readonly IWorkshopService _workshopService;
private readonly IDebugService _debugService; private readonly IDebugService _debugService;
private readonly IWorkshopClient _workshopClient; private readonly IWorkshopClient _workshopClient;
private bool _isLoading; [Notify] private SearchResultViewModel? _selectedEntry;
private SearchResultViewModel? _selectedEntry; [Notify] private bool _isLoading;
public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IWorkshopService workshopService, CurrentUserViewModel currentUserViewModel, IDebugService debugService) public SearchViewModel(ILogger logger, IWorkshopClient workshopClient, IWorkshopService workshopService, CurrentUserViewModel currentUserViewModel, IDebugService debugService)
{ {
@ -39,18 +40,6 @@ public class SearchViewModel : ViewModelBase
public Func<string?, CancellationToken, Task<IEnumerable<object>>> SearchAsync { get; } public Func<string?, CancellationToken, Task<IEnumerable<object>>> 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() public void ShowDebugger()
{ {
_debugService.ShowDebugger(); _debugService.ShowDebugger();

View File

@ -3,14 +3,15 @@ using Artemis.UI.Shared;
using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using DryIoc; using DryIoc;
using PropertyChanged.SourceGenerator;
namespace Artemis.UI.Screens.Workshop.SubmissionWizard; namespace Artemis.UI.Screens.Workshop.SubmissionWizard;
public class ReleaseWizardViewModel : ActivatableViewModelBase, IWorkshopWizardViewModel public partial class ReleaseWizardViewModel : ActivatableViewModelBase, IWorkshopWizardViewModel
{ {
private readonly SubmissionWizardState _state; private readonly SubmissionWizardState _state;
private SubmissionViewModel? _screen; private SubmissionViewModel? _screen;
private bool _shouldClose; [Notify] private bool _shouldClose;
public ReleaseWizardViewModel(IContainer container, IWindowService windowService, CurrentUserViewModel currentUserViewModel, IGetSubmittedEntryById_Entry entry) public ReleaseWizardViewModel(IContainer container, IWindowService windowService, CurrentUserViewModel currentUserViewModel, IGetSubmittedEntryById_Entry entry)
{ {
@ -42,10 +43,4 @@ public class ReleaseWizardViewModel : ActivatableViewModelBase, IWorkshopWizardV
RaiseAndSetIfChanged(ref _screen, value); RaiseAndSetIfChanged(ref _screen, value);
} }
} }
public bool ShouldClose
{
get => _shouldClose;
set => RaiseAndSetIfChanged(ref _shouldClose, value);
}
} }

View File

@ -1,12 +1,13 @@
using System.Reactive.Linq; using System.Reactive.Linq;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps;
public class EntryTypeStepViewModel : SubmissionViewModel public partial class EntryTypeStepViewModel : SubmissionViewModel
{ {
private EntryType? _selectedEntryType; [Notify] private EntryType? _selectedEntryType;
/// <inheritdoc /> /// <inheritdoc />
public EntryTypeStepViewModel() public EntryTypeStepViewModel()
@ -21,12 +22,6 @@ public class EntryTypeStepViewModel : SubmissionViewModel
public bool ShowLayouts => false; public bool ShowLayouts => false;
#endif #endif
public EntryType? SelectedEntryType
{
get => _selectedEntryType;
set => RaiseAndSetIfChanged(ref _selectedEntryType, value);
}
private void ExecuteContinue() private void ExecuteContinue()
{ {
if (SelectedEntryType == null) if (SelectedEntryType == null)

View File

@ -6,16 +6,17 @@ using Artemis.Core.Services;
using Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs; using Artemis.UI.Screens.ProfileEditor.ProfileTree.Dialogs;
using Artemis.UI.Shared; using Artemis.UI.Shared;
using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Profile; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Profile;
public class ProfileAdaptionHintsLayerViewModel : ViewModelBase public partial class ProfileAdaptionHintsLayerViewModel : ViewModelBase
{ {
private readonly ObservableAsPropertyHelper<string> _adaptionHintText; private readonly ObservableAsPropertyHelper<string> _adaptionHintText;
private readonly IProfileService _profileService; private readonly IProfileService _profileService;
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
private int _adaptionHintCount; [Notify(Setter.Private)] private int _adaptionHintCount;
public ProfileAdaptionHintsLayerViewModel(Layer layer, IWindowService windowService, IProfileService profileService) public ProfileAdaptionHintsLayerViewModel(Layer layer, IWindowService windowService, IProfileService profileService)
{ {
@ -29,15 +30,7 @@ public class ProfileAdaptionHintsLayerViewModel : ViewModelBase
} }
public Layer Layer { get; } public Layer Layer { get; }
public ReactiveCommand<Unit, Unit> EditAdaptionHints { get; } public ReactiveCommand<Unit, Unit> EditAdaptionHints { get; }
public int AdaptionHintCount
{
get => _adaptionHintCount;
private set => RaiseAndSetIfChanged(ref _adaptionHintCount, value);
}
public string AdaptionHintText => _adaptionHintText.Value; public string AdaptionHintText => _adaptionHintText.Value;
private async Task ExecuteEditAdaptionHints() private async Task ExecuteEditAdaptionHints()

View File

@ -8,15 +8,16 @@ using Artemis.Core.Services;
using Artemis.UI.Extensions; using Artemis.UI.Extensions;
using Artemis.UI.Screens.Workshop.Profile; using Artemis.UI.Screens.Workshop.Profile;
using Material.Icons; using Material.Icons;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using SkiaSharp; using SkiaSharp;
namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Profile; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Profile;
public class ProfileSelectionStepViewModel : SubmissionViewModel public partial class ProfileSelectionStepViewModel : SubmissionViewModel
{ {
private readonly IProfileService _profileService; private readonly IProfileService _profileService;
private ProfileConfiguration? _selectedProfile; [Notify] private ProfileConfiguration? _selectedProfile;
/// <inheritdoc /> /// <inheritdoc />
public ProfileSelectionStepViewModel(IProfileService profileService, ProfilePreviewViewModel profilePreviewViewModel) public ProfileSelectionStepViewModel(IProfileService profileService, ProfilePreviewViewModel profilePreviewViewModel)
@ -45,12 +46,6 @@ public class ProfileSelectionStepViewModel : SubmissionViewModel
public ObservableCollection<ProfileConfiguration> Profiles { get; } public ObservableCollection<ProfileConfiguration> Profiles { get; }
public ProfilePreviewViewModel ProfilePreview { get; } public ProfilePreviewViewModel ProfilePreview { get; }
public ProfileConfiguration? SelectedProfile
{
get => _selectedProfile;
set => RaiseAndSetIfChanged(ref _selectedProfile, value);
}
private void Update(ProfileConfiguration? profileConfiguration) private void Update(ProfileConfiguration? profileConfiguration)
{ {
ProfilePreview.ProfileConfiguration = null; ProfilePreview.ProfileConfiguration = null;

View File

@ -8,14 +8,15 @@ using Artemis.UI.Screens.Workshop.Entries;
using Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Profile; using Artemis.UI.Screens.Workshop.SubmissionWizard.Steps.Profile;
using Artemis.WebClient.Workshop; using Artemis.WebClient.Workshop;
using DynamicData; using DynamicData;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps;
public class SpecificationsStepViewModel : SubmissionViewModel public partial class SpecificationsStepViewModel : SubmissionViewModel
{ {
private readonly Func<EntrySpecificationsViewModel> _getEntrySpecificationsViewModel; private readonly Func<EntrySpecificationsViewModel> _getEntrySpecificationsViewModel;
private EntrySpecificationsViewModel? _entrySpecificationsViewModel; [Notify] private EntrySpecificationsViewModel? _entrySpecificationsViewModel;
public SpecificationsStepViewModel(Func<EntrySpecificationsViewModel> getEntrySpecificationsViewModel) public SpecificationsStepViewModel(Func<EntrySpecificationsViewModel> getEntrySpecificationsViewModel)
{ {
@ -29,12 +30,6 @@ public class SpecificationsStepViewModel : SubmissionViewModel
}); });
} }
public EntrySpecificationsViewModel? EntrySpecificationsViewModel
{
get => _entrySpecificationsViewModel;
set => RaiseAndSetIfChanged(ref _entrySpecificationsViewModel, value);
}
private void ExecuteGoBack() private void ExecuteGoBack()
{ {
// Apply what's there so far // Apply what's there so far

View File

@ -9,15 +9,16 @@ using Artemis.WebClient.Workshop;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using Avalonia.Media.Imaging; using Avalonia.Media.Imaging;
using IdentityModel; using IdentityModel;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using StrawberryShake; using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps;
public class SubmitStepViewModel : SubmissionViewModel public partial class SubmitStepViewModel : SubmissionViewModel
{ {
private ReadOnlyObservableCollection<CategoryViewModel>? _categories; [Notify] private ReadOnlyObservableCollection<CategoryViewModel>? _categories;
private Bitmap? _iconBitmap; [Notify] private Bitmap? _iconBitmap;
/// <inheritdoc /> /// <inheritdoc />
public SubmitStepViewModel(IAuthenticationService authenticationService, IWorkshopClient workshopClient) public SubmitStepViewModel(IAuthenticationService authenticationService, IWorkshopClient workshopClient)
@ -41,20 +42,8 @@ public class SubmitStepViewModel : SubmissionViewModel
}); });
} }
public Bitmap? IconBitmap
{
get => _iconBitmap;
set => RaiseAndSetIfChanged(ref _iconBitmap, value);
}
public string? CurrentUser { get; } public string? CurrentUser { get; }
public ReadOnlyObservableCollection<CategoryViewModel>? Categories
{
get => _categories;
set => RaiseAndSetIfChanged(ref _categories, value);
}
private void PopulateCategories(IOperationResult<IGetCategoriesResult> result) private void PopulateCategories(IOperationResult<IGetCategoriesResult> result)
{ {
if (result.Data == null) if (result.Data == null)

View File

@ -11,13 +11,14 @@ using Artemis.WebClient.Workshop;
using Artemis.WebClient.Workshop.Exceptions; using Artemis.WebClient.Workshop.Exceptions;
using Artemis.WebClient.Workshop.Handlers.UploadHandlers; using Artemis.WebClient.Workshop.Handlers.UploadHandlers;
using Artemis.WebClient.Workshop.Services; using Artemis.WebClient.Workshop.Services;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
using Serilog; using Serilog;
using StrawberryShake; using StrawberryShake;
namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps; namespace Artemis.UI.Screens.Workshop.SubmissionWizard.Steps;
public class UploadStepViewModel : SubmissionViewModel public partial class UploadStepViewModel : SubmissionViewModel
{ {
private readonly ILogger _logger; private readonly ILogger _logger;
private readonly EntryUploadHandlerFactory _entryUploadHandlerFactory; private readonly EntryUploadHandlerFactory _entryUploadHandlerFactory;
@ -28,11 +29,10 @@ public class UploadStepViewModel : SubmissionViewModel
private readonly IWindowService _windowService; private readonly IWindowService _windowService;
private readonly IWorkshopClient _workshopClient; private readonly IWorkshopClient _workshopClient;
private readonly IWorkshopService _workshopService; private readonly IWorkshopService _workshopService;
private long? _entryId; private long? _entryId;
private bool _failed; [Notify] private bool _failed;
private bool _finished; [Notify] private bool _finished;
private bool _succeeded; [Notify] private bool _succeeded;
/// <inheritdoc /> /// <inheritdoc />
public UploadStepViewModel(ILogger logger, public UploadStepViewModel(ILogger logger,
@ -66,24 +66,6 @@ public class UploadStepViewModel : SubmissionViewModel
public int ProgressPercentage => _progressPercentage.Value; public int ProgressPercentage => _progressPercentage.Value;
public bool ProgressIndeterminate => _progressIndeterminate.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) private async Task ExecuteUpload(CancellationToken cancellationToken)
{ {
// Use the existing entry or create a new one // Use the existing entry or create a new one

View File

@ -1,53 +1,18 @@
using System.Reactive; using System.Reactive;
using Artemis.UI.Shared; using Artemis.UI.Shared;
using PropertyChanged.SourceGenerator;
using ReactiveUI; using ReactiveUI;
namespace Artemis.UI.Screens.Workshop.SubmissionWizard; namespace Artemis.UI.Screens.Workshop.SubmissionWizard;
public abstract class SubmissionViewModel : ValidatableViewModelBase public abstract partial class SubmissionViewModel : ValidatableViewModelBase
{ {
private ReactiveCommand<Unit, Unit>? _continue; [Notify] private ReactiveCommand<Unit, Unit>? _continue;
private ReactiveCommand<Unit, Unit>? _goBack; [Notify] private ReactiveCommand<Unit, Unit>? _goBack;
private string _continueText = "Continue"; [Notify] private string _continueText = "Continue";
private bool _showFinish; [Notify] private bool _showFinish;
private bool _showGoBack = true; [Notify] private bool _showGoBack = true;
private bool _showHeader = true; [Notify] private bool _showHeader = true;
public SubmissionWizardState State { get; set; } = null!; public SubmissionWizardState State { get; set; } = null!;
public ReactiveCommand<Unit, Unit>? Continue
{
get => _continue;
set => RaiseAndSetIfChanged(ref _continue, value);
}
public ReactiveCommand<Unit, Unit>? 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);
}
} }

View File

@ -3,14 +3,15 @@ using Artemis.UI.Screens.Workshop.SubmissionWizard.Steps;
using Artemis.UI.Shared; using Artemis.UI.Shared;
using Artemis.UI.Shared.Services; using Artemis.UI.Shared.Services;
using DryIoc; using DryIoc;
using PropertyChanged.SourceGenerator;
namespace Artemis.UI.Screens.Workshop.SubmissionWizard; namespace Artemis.UI.Screens.Workshop.SubmissionWizard;
public class SubmissionWizardViewModel : ActivatableViewModelBase, IWorkshopWizardViewModel public partial class SubmissionWizardViewModel : ActivatableViewModelBase, IWorkshopWizardViewModel
{ {
private readonly SubmissionWizardState _state; private readonly SubmissionWizardState _state;
private SubmissionViewModel _screen; private SubmissionViewModel _screen;
private bool _shouldClose; [Notify] private bool _shouldClose;
public SubmissionWizardViewModel(IContainer container, public SubmissionWizardViewModel(IContainer container,
IWindowService windowService, IWindowService windowService,
@ -38,10 +39,4 @@ public class SubmissionWizardViewModel : ActivatableViewModelBase, IWorkshopWiza
RaiseAndSetIfChanged(ref _screen, value); RaiseAndSetIfChanged(ref _screen, value);
} }
} }
public bool ShouldClose
{
get => _shouldClose;
set => RaiseAndSetIfChanged(ref _shouldClose, value);
}
} }

View File

@ -4,13 +4,14 @@ using Artemis.UI.Screens.Workshop.Home;
using Artemis.UI.Screens.Workshop.Search; using Artemis.UI.Screens.Workshop.Search;
using Artemis.UI.Shared; using Artemis.UI.Shared;
using Artemis.UI.Shared.Routing; using Artemis.UI.Shared.Routing;
using PropertyChanged.SourceGenerator;
namespace Artemis.UI.Screens.Workshop; namespace Artemis.UI.Screens.Workshop;
public class WorkshopViewModel : RoutableHostScreen<RoutableScreen>, IMainScreenViewModel public partial class WorkshopViewModel : RoutableHostScreen<RoutableScreen>, IMainScreenViewModel
{ {
private readonly SearchViewModel _searchViewModel; private readonly SearchViewModel _searchViewModel;
private ViewModelBase? _titleBarViewModel; [Notify] private ViewModelBase? _titleBarViewModel;
public WorkshopViewModel(SearchViewModel searchViewModel, WorkshopHomeViewModel homeViewModel) public WorkshopViewModel(SearchViewModel searchViewModel, WorkshopHomeViewModel homeViewModel)
{ {
@ -26,10 +27,4 @@ public class WorkshopViewModel : RoutableHostScreen<RoutableScreen>, IMainScreen
TitleBarViewModel = args.Path == "workshop" ? _searchViewModel : null; TitleBarViewModel = args.Path == "workshop" ? _searchViewModel : null;
return base.OnNavigating(args, cancellationToken); return base.OnNavigating(args, cancellationToken);
} }
public ViewModelBase? TitleBarViewModel
{
get => _titleBarViewModel;
set => RaiseAndSetIfChanged(ref _titleBarViewModel, value);
}
} }

View File

@ -2,7 +2,9 @@ namespace Artemis.WebClient.Workshop;
public static class WorkshopConstants public static class WorkshopConstants
{ {
public const string AUTHORITY_URL = "https://identity.artemis-rgb.com"; public const string AUTHORITY_URL = "https://localhost:5001";
public const string WORKSHOP_URL = "https://workshop.artemis-rgb.com"; 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"; public const string WORKSHOP_CLIENT_NAME = "WorkshopApiClient";
} }