mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 03:48:56 +00:00
UI - Use PropertyChanged.SourceGenerator everywhere else
This commit is contained in:
1 parent
d656c6960d
commit
190d797f1a
40 files changed
+223
-934
No files matched your search
@@ -6,20 +6,20 @@ using Artemis.Core.Services;
|
||||
using Artemis.UI.Screens.Device;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Screens.SurfaceEditor;
|
||||
|
||||
public class ListDeviceViewModel : ViewModelBase
|
||||
public partial class ListDeviceViewModel : ViewModelBase
|
||||
{
|
||||
private static readonly Random Random = new();
|
||||
private readonly IWindowService _windowService;
|
||||
private readonly IDeviceService _deviceService;
|
||||
|
||||
private SKColor _color;
|
||||
private bool _isSelected;
|
||||
[Notify] private SKColor _color;
|
||||
[Notify] private bool _isSelected;
|
||||
|
||||
public ListDeviceViewModel(ArtemisDevice device, SurfaceEditorViewModel surfaceEditorViewModel, IWindowService windowService, IDeviceService deviceService)
|
||||
{
|
||||
@@ -37,19 +37,7 @@ public class ListDeviceViewModel : ViewModelBase
|
||||
public ArtemisDevice Device { get; }
|
||||
public SurfaceEditorViewModel SurfaceEditorViewModel { get; }
|
||||
public bool CanDetectInput => Device.DeviceType == RGBDeviceType.Keyboard || Device.DeviceType == RGBDeviceType.Mouse;
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get => _isSelected;
|
||||
set => RaiseAndSetIfChanged(ref _isSelected, value);
|
||||
}
|
||||
|
||||
public SKColor Color
|
||||
{
|
||||
get => _color;
|
||||
set => RaiseAndSetIfChanged(ref _color, value);
|
||||
}
|
||||
|
||||
|
||||
private async Task ExecuteDetectInput()
|
||||
{
|
||||
if (!CanDetectInput)
|
||||
|
||||
@@ -10,6 +10,7 @@ using Artemis.Core.Services;
|
||||
using Artemis.UI.Screens.Device;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
@@ -17,16 +18,16 @@ using Point = Avalonia.Point;
|
||||
|
||||
namespace Artemis.UI.Screens.SurfaceEditor;
|
||||
|
||||
public class SurfaceDeviceViewModel : ActivatableViewModelBase
|
||||
public partial class SurfaceDeviceViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IDeviceService _deviceService;
|
||||
private readonly ISettingsService _settingsService;
|
||||
private readonly IWindowService _windowService;
|
||||
private double _dragOffsetX;
|
||||
private double _dragOffsetY;
|
||||
private bool _isSelected;
|
||||
private float _x;
|
||||
private float _y;
|
||||
[Notify] private bool _isSelected;
|
||||
[Notify] private float _x;
|
||||
[Notify] private float _y;
|
||||
|
||||
public SurfaceDeviceViewModel(ArtemisDevice device, SurfaceEditorViewModel surfaceEditorViewModel, IDeviceService deviceService, ISettingsService settingsService, IWindowService windowService)
|
||||
{
|
||||
@@ -48,29 +49,10 @@ public class SurfaceDeviceViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Unit> DetectInput { get; }
|
||||
|
||||
public ArtemisDevice Device { get; }
|
||||
public SurfaceEditorViewModel SurfaceEditorViewModel { get; }
|
||||
public bool CanDetectInput => Device.DeviceType == RGBDeviceType.Keyboard || Device.DeviceType == RGBDeviceType.Mouse;
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get => _isSelected;
|
||||
set => RaiseAndSetIfChanged(ref _isSelected, value);
|
||||
}
|
||||
|
||||
public float X
|
||||
{
|
||||
get => _x;
|
||||
set => RaiseAndSetIfChanged(ref _x, value);
|
||||
}
|
||||
|
||||
public float Y
|
||||
{
|
||||
get => _y;
|
||||
set => RaiseAndSetIfChanged(ref _y, value);
|
||||
}
|
||||
|
||||
public void StartMouseDrag(Point mouseStartPosition)
|
||||
{
|
||||
if (!IsSelected)
|
||||
|
||||
@@ -13,12 +13,13 @@ using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Routing;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Avalonia;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Screens.SurfaceEditor;
|
||||
|
||||
public class SurfaceEditorViewModel : RoutableScreen, IMainScreenViewModel
|
||||
public partial class SurfaceEditorViewModel : RoutableScreen, IMainScreenViewModel
|
||||
{
|
||||
private readonly IDeviceService _deviceService;
|
||||
private readonly IRenderService _renderService;
|
||||
@@ -26,11 +27,11 @@ public class SurfaceEditorViewModel : RoutableScreen, IMainScreenViewModel
|
||||
private readonly ISettingsService _settingsService;
|
||||
private readonly ISurfaceVmFactory _surfaceVmFactory;
|
||||
private readonly IWindowService _windowService;
|
||||
private bool _colorDevices;
|
||||
private bool _colorFirstLedOnly;
|
||||
private List<SurfaceDeviceViewModel>? _initialSelection;
|
||||
private double _overlayOpacity;
|
||||
private bool _saving;
|
||||
[Notify] private bool _colorDevices;
|
||||
[Notify] private bool _colorFirstLedOnly;
|
||||
|
||||
public SurfaceEditorViewModel(ICoreService coreService,
|
||||
ISurfaceVmFactory surfaceVmFactory,
|
||||
@@ -74,19 +75,7 @@ public class SurfaceEditorViewModel : RoutableScreen, IMainScreenViewModel
|
||||
}
|
||||
|
||||
public ViewModelBase? TitleBarViewModel => null;
|
||||
|
||||
public bool ColorDevices
|
||||
{
|
||||
get => _colorDevices;
|
||||
set => RaiseAndSetIfChanged(ref _colorDevices, value);
|
||||
}
|
||||
|
||||
public bool ColorFirstLedOnly
|
||||
{
|
||||
get => _colorFirstLedOnly;
|
||||
set => RaiseAndSetIfChanged(ref _colorFirstLedOnly, value);
|
||||
}
|
||||
|
||||
|
||||
public ObservableCollection<SurfaceDeviceViewModel> SurfaceDeviceViewModels { get; }
|
||||
public ObservableCollection<ListDeviceViewModel> ListDeviceViewModels { get; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user