UI - Use PropertyChanged.SourceGenerator in workshop

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

No files matched your search

@@ -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<bool> _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<Unit, Unit> Login { get; }
public void Logout()