mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-12 13:28:33 +00:00
UI - Use PropertyChanged.SourceGenerator everywhere else
This commit is contained in:
parent
d656c6960d
commit
190d797f1a
@ -8,13 +8,14 @@ using Artemis.UI.Screens.Debugger.Render;
|
||||
using Artemis.UI.Screens.Debugger.Routing;
|
||||
using Artemis.UI.Services.Interfaces;
|
||||
using Artemis.UI.Shared;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger;
|
||||
|
||||
public class DebugViewModel : ActivatableViewModelBase, IScreen
|
||||
public partial class DebugViewModel : ActivatableViewModelBase, IScreen
|
||||
{
|
||||
private ViewModelBase _selectedItem;
|
||||
[Notify] private ViewModelBase _selectedItem;
|
||||
|
||||
public DebugViewModel(IDebugService debugService, RenderDebugViewModel render, DataModelDebugViewModel dataModel, PerformanceDebugViewModel performance, RoutingDebugViewModel routing, LogsDebugViewModel logs)
|
||||
{
|
||||
@ -25,13 +26,7 @@ public class DebugViewModel : ActivatableViewModelBase, IScreen
|
||||
}
|
||||
|
||||
public ObservableCollection<ViewModelBase> Items { get; }
|
||||
|
||||
public ViewModelBase SelectedItem
|
||||
{
|
||||
get => _selectedItem;
|
||||
set => RaiseAndSetIfChanged(ref _selectedItem, value);
|
||||
}
|
||||
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
OnActivationRequested();
|
||||
|
||||
@ -12,21 +12,21 @@ using Artemis.UI.Shared.DataModelVisualization.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Avalonia.Threading;
|
||||
using DynamicData;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.DataModel;
|
||||
|
||||
public class DataModelDebugViewModel : ActivatableViewModelBase
|
||||
public partial class DataModelDebugViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IDataModelUIService _dataModelUIService;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly DispatcherTimer _updateTimer;
|
||||
|
||||
private bool _isModuleFilterEnabled;
|
||||
private DataModelPropertiesViewModel? _mainDataModel;
|
||||
private string? _propertySearch;
|
||||
private Module? _selectedModule;
|
||||
private bool _slowUpdates;
|
||||
[Notify] private DataModelPropertiesViewModel? _mainDataModel;
|
||||
[Notify] private string? _propertySearch;
|
||||
|
||||
public DataModelDebugViewModel(IDataModelUIService dataModelUIService, IPluginManagementService pluginManagementService)
|
||||
{
|
||||
@ -57,18 +57,6 @@ public class DataModelDebugViewModel : ActivatableViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
public DataModelPropertiesViewModel? MainDataModel
|
||||
{
|
||||
get => _mainDataModel;
|
||||
set => RaiseAndSetIfChanged(ref _mainDataModel, value);
|
||||
}
|
||||
|
||||
public string? PropertySearch
|
||||
{
|
||||
get => _propertySearch;
|
||||
set => RaiseAndSetIfChanged(ref _propertySearch, value);
|
||||
}
|
||||
|
||||
public bool SlowUpdates
|
||||
{
|
||||
get => _slowUpdates;
|
||||
|
||||
@ -1,16 +1,17 @@
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Performance;
|
||||
|
||||
public class PerformanceDebugMeasurementViewModel : ViewModelBase
|
||||
public partial class PerformanceDebugMeasurementViewModel : ViewModelBase
|
||||
{
|
||||
private string? _average;
|
||||
private string? _last;
|
||||
private string? _max;
|
||||
private string? _min;
|
||||
private string? _percentile;
|
||||
private string? _count;
|
||||
[Notify] private string? _average;
|
||||
[Notify] private string? _last;
|
||||
[Notify] private string? _max;
|
||||
[Notify] private string? _min;
|
||||
[Notify] private string? _percentile;
|
||||
[Notify] private string? _count;
|
||||
|
||||
public PerformanceDebugMeasurementViewModel(ProfilingMeasurement measurement)
|
||||
{
|
||||
@ -19,42 +20,6 @@ public class PerformanceDebugMeasurementViewModel : ViewModelBase
|
||||
|
||||
public ProfilingMeasurement Measurement { get; }
|
||||
|
||||
public string? Last
|
||||
{
|
||||
get => _last;
|
||||
set => RaiseAndSetIfChanged(ref _last, value);
|
||||
}
|
||||
|
||||
public string? Average
|
||||
{
|
||||
get => _average;
|
||||
set => RaiseAndSetIfChanged(ref _average, value);
|
||||
}
|
||||
|
||||
public string? Min
|
||||
{
|
||||
get => _min;
|
||||
set => RaiseAndSetIfChanged(ref _min, value);
|
||||
}
|
||||
|
||||
public string? Max
|
||||
{
|
||||
get => _max;
|
||||
set => RaiseAndSetIfChanged(ref _max, value);
|
||||
}
|
||||
|
||||
public string? Percentile
|
||||
{
|
||||
get => _percentile;
|
||||
set => RaiseAndSetIfChanged(ref _percentile, value);
|
||||
}
|
||||
|
||||
public string? Count
|
||||
{
|
||||
get => _count;
|
||||
set => RaiseAndSetIfChanged(ref _count, value);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
Last = Measurement.GetLast().TotalMilliseconds + " ms";
|
||||
|
||||
@ -7,20 +7,21 @@ using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared;
|
||||
using Avalonia.Threading;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Performance;
|
||||
|
||||
public class PerformanceDebugViewModel : ActivatableViewModelBase
|
||||
public partial class PerformanceDebugViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IRenderService _renderService;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly DispatcherTimer _updateTimer;
|
||||
private double _currentFps;
|
||||
private string? _renderer;
|
||||
private int _renderHeight;
|
||||
private int _renderWidth;
|
||||
[Notify] private double _currentFps;
|
||||
[Notify] private string? _renderer;
|
||||
[Notify] private int _renderHeight;
|
||||
[Notify] private int _renderWidth;
|
||||
|
||||
public PerformanceDebugViewModel(IRenderService renderService, IPluginManagementService pluginManagementService)
|
||||
{
|
||||
@ -59,31 +60,7 @@ public class PerformanceDebugViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
public ObservableCollection<PerformanceDebugPluginViewModel> Items { get; } = new();
|
||||
|
||||
public double CurrentFps
|
||||
{
|
||||
get => _currentFps;
|
||||
set => RaiseAndSetIfChanged(ref _currentFps, value);
|
||||
}
|
||||
|
||||
public int RenderWidth
|
||||
{
|
||||
get => _renderWidth;
|
||||
set => RaiseAndSetIfChanged(ref _renderWidth, value);
|
||||
}
|
||||
|
||||
public int RenderHeight
|
||||
{
|
||||
get => _renderHeight;
|
||||
set => RaiseAndSetIfChanged(ref _renderHeight, value);
|
||||
}
|
||||
|
||||
public string? Renderer
|
||||
{
|
||||
get => _renderer;
|
||||
set => RaiseAndSetIfChanged(ref _renderer, value);
|
||||
}
|
||||
|
||||
|
||||
private void HandleActivation()
|
||||
{
|
||||
Renderer = Constants.ManagedGraphicsContext != null ? Constants.ManagedGraphicsContext.GetType().Name : "Software";
|
||||
|
||||
@ -4,21 +4,21 @@ using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared;
|
||||
using Avalonia.Media.Imaging;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Render;
|
||||
|
||||
public class RenderDebugViewModel : ActivatableViewModelBase
|
||||
public partial class RenderDebugViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IRenderService _renderService;
|
||||
private double _currentFps;
|
||||
|
||||
private Bitmap? _currentFrame;
|
||||
private string? _frameTargetPath;
|
||||
private string? _renderer;
|
||||
private int _renderHeight;
|
||||
private int _renderWidth;
|
||||
[Notify] private double _currentFps;
|
||||
[Notify] private Bitmap? _currentFrame;
|
||||
[Notify] private string? _renderer;
|
||||
[Notify] private int _renderHeight;
|
||||
[Notify] private int _renderWidth;
|
||||
|
||||
public RenderDebugViewModel(IRenderService renderService)
|
||||
{
|
||||
@ -33,36 +33,6 @@ public class RenderDebugViewModel : ActivatableViewModelBase
|
||||
});
|
||||
}
|
||||
|
||||
public Bitmap? CurrentFrame
|
||||
{
|
||||
get => _currentFrame;
|
||||
set => RaiseAndSetIfChanged(ref _currentFrame, value);
|
||||
}
|
||||
|
||||
public double CurrentFps
|
||||
{
|
||||
get => _currentFps;
|
||||
set => RaiseAndSetIfChanged(ref _currentFps, value);
|
||||
}
|
||||
|
||||
public int RenderWidth
|
||||
{
|
||||
get => _renderWidth;
|
||||
set => RaiseAndSetIfChanged(ref _renderWidth, value);
|
||||
}
|
||||
|
||||
public int RenderHeight
|
||||
{
|
||||
get => _renderHeight;
|
||||
set => RaiseAndSetIfChanged(ref _renderHeight, value);
|
||||
}
|
||||
|
||||
public string? Renderer
|
||||
{
|
||||
get => _renderer;
|
||||
set => RaiseAndSetIfChanged(ref _renderer, value);
|
||||
}
|
||||
|
||||
private void HandleActivation()
|
||||
{
|
||||
Renderer = Constants.ManagedGraphicsContext != null ? Constants.ManagedGraphicsContext.GetType().Name : "Software";
|
||||
|
||||
@ -11,18 +11,19 @@ using Artemis.UI.Shared.Routing;
|
||||
using Avalonia.Controls.Documents;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Threading;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using Serilog.Events;
|
||||
using Serilog.Formatting.Display;
|
||||
|
||||
namespace Artemis.UI.Screens.Debugger.Routing;
|
||||
|
||||
public class RoutingDebugViewModel : ActivatableViewModelBase
|
||||
public partial class RoutingDebugViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IRouter _router;
|
||||
private const int MAX_ENTRIES = 1000;
|
||||
private readonly MessageTemplateTextFormatter _formatter;
|
||||
private string? _route;
|
||||
[Notify] private string? _route;
|
||||
|
||||
public RoutingDebugViewModel(IRouter router)
|
||||
{
|
||||
@ -49,12 +50,6 @@ public class RoutingDebugViewModel : ActivatableViewModelBase
|
||||
public InlineCollection Lines { get; } = new();
|
||||
public ReactiveCommand<Unit, Unit> Navigate { get; }
|
||||
|
||||
public string? Route
|
||||
{
|
||||
get => _route;
|
||||
set => RaiseAndSetIfChanged(ref _route, value);
|
||||
}
|
||||
|
||||
private void OnLogEventAdded(object? sender, LogEventEventArgs e)
|
||||
{
|
||||
Dispatcher.UIThread.Post(() => AddLogEvent(e.LogEvent));
|
||||
|
||||
@ -6,16 +6,17 @@ using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.DryIoc.Factories;
|
||||
using Artemis.UI.Shared;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DevicePropertiesViewModel : DialogViewModelBase<object>
|
||||
public partial class DevicePropertiesViewModel : DialogViewModelBase<object>
|
||||
{
|
||||
private readonly IDeviceVmFactory _deviceVmFactory;
|
||||
private ArtemisDevice _device;
|
||||
[Notify] private ArtemisDevice _device;
|
||||
|
||||
public DevicePropertiesViewModel(ArtemisDevice device, IRenderService renderService, IDeviceService deviceService, IDeviceVmFactory deviceVmFactory)
|
||||
{
|
||||
@ -42,12 +43,6 @@ public class DevicePropertiesViewModel : DialogViewModelBase<object>
|
||||
ClearSelectedLeds = ReactiveCommand.Create(ExecuteClearSelectedLeds);
|
||||
}
|
||||
|
||||
public ArtemisDevice Device
|
||||
{
|
||||
get => _device;
|
||||
set => RaiseAndSetIfChanged(ref _device, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<ArtemisLed> SelectedLeds { get; }
|
||||
public ObservableCollection<ActivatableViewModelBase> Tabs { get; }
|
||||
public ReactiveCommand<Unit, Unit> ClearSelectedLeds { get; }
|
||||
|
||||
@ -8,18 +8,19 @@ using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Avalonia.Threading;
|
||||
using Humanizer;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using RGB.NET.Core;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DeviceSettingsViewModel : ActivatableViewModelBase
|
||||
public partial class DeviceSettingsViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IDeviceService _deviceService;
|
||||
private readonly DevicesTabViewModel _devicesTabViewModel;
|
||||
private readonly IDeviceVmFactory _deviceVmFactory;
|
||||
private readonly IWindowService _windowService;
|
||||
private bool _togglingDevice;
|
||||
[Notify] private bool _togglingDevice;
|
||||
|
||||
public DeviceSettingsViewModel(ArtemisDevice device, DevicesTabViewModel devicesTabViewModel, IDeviceService deviceService, IWindowService windowService, IDeviceVmFactory deviceVmFactory)
|
||||
{
|
||||
@ -51,12 +52,6 @@ public class DeviceSettingsViewModel : ActivatableViewModelBase
|
||||
set => Dispatcher.UIThread.InvokeAsync(async () => await UpdateIsDeviceEnabled(value));
|
||||
}
|
||||
|
||||
public bool TogglingDevice
|
||||
{
|
||||
get => _togglingDevice;
|
||||
set => RaiseAndSetIfChanged(ref _togglingDevice, value);
|
||||
}
|
||||
|
||||
public void IdentifyDevice()
|
||||
{
|
||||
_deviceService.IdentifyDevice(Device);
|
||||
|
||||
@ -6,38 +6,35 @@ using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using RGB.NET.Core;
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DeviceGeneralTabViewModel : ActivatableViewModelBase
|
||||
public partial class DeviceGeneralTabViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly ICoreService _coreService;
|
||||
private readonly IDeviceService _deviceService;
|
||||
private readonly IRenderService _renderService;
|
||||
private readonly IWindowService _windowService;
|
||||
private readonly List<DeviceCategory> _categories;
|
||||
|
||||
private readonly float _initialBlueScale;
|
||||
private readonly float _initialGreenScale;
|
||||
private readonly float _initialRedScale;
|
||||
|
||||
private int _rotation;
|
||||
private float _scale;
|
||||
private int _x;
|
||||
private int _y;
|
||||
[Notify] private int _rotation;
|
||||
[Notify] private float _scale;
|
||||
[Notify] private int _x;
|
||||
[Notify] private int _y;
|
||||
[Notify] private float _redScale;
|
||||
[Notify] private float _greenScale;
|
||||
[Notify] private float _blueScale;
|
||||
[Notify] private SKColor _currentColor;
|
||||
[Notify] private bool _displayOnDevices;
|
||||
|
||||
private float _redScale;
|
||||
private float _greenScale;
|
||||
private float _blueScale;
|
||||
private SKColor _currentColor;
|
||||
private bool _displayOnDevices;
|
||||
|
||||
public DeviceGeneralTabViewModel(ArtemisDevice device, ICoreService coreService, IDeviceService deviceService, IRenderService renderService, IWindowService windowService)
|
||||
public DeviceGeneralTabViewModel(ArtemisDevice device, IDeviceService deviceService, IRenderService renderService, IWindowService windowService)
|
||||
{
|
||||
_coreService = coreService;
|
||||
_deviceService = deviceService;
|
||||
_renderService = renderService;
|
||||
_windowService = windowService;
|
||||
@ -76,31 +73,7 @@ public class DeviceGeneralTabViewModel : ActivatableViewModelBase
|
||||
public bool RequiresManualSetup => !Device.DeviceProvider.CanDetectPhysicalLayout || !Device.DeviceProvider.CanDetectLogicalLayout;
|
||||
|
||||
public ArtemisDevice Device { get; }
|
||||
|
||||
public int X
|
||||
{
|
||||
get => _x;
|
||||
set => RaiseAndSetIfChanged(ref _x, value);
|
||||
}
|
||||
|
||||
public int Y
|
||||
{
|
||||
get => _y;
|
||||
set => RaiseAndSetIfChanged(ref _y, value);
|
||||
}
|
||||
|
||||
public float Scale
|
||||
{
|
||||
get => _scale;
|
||||
set => RaiseAndSetIfChanged(ref _scale, value);
|
||||
}
|
||||
|
||||
public int Rotation
|
||||
{
|
||||
get => _rotation;
|
||||
set => RaiseAndSetIfChanged(ref _rotation, value);
|
||||
}
|
||||
|
||||
|
||||
public bool IsKeyboard => Device.DeviceType == RGBDeviceType.Keyboard;
|
||||
|
||||
public bool HasDeskCategory
|
||||
@ -132,37 +105,7 @@ public class DeviceGeneralTabViewModel : ActivatableViewModelBase
|
||||
get => GetCategory(DeviceCategory.Peripherals);
|
||||
set => SetCategory(DeviceCategory.Peripherals, value);
|
||||
}
|
||||
|
||||
public float RedScale
|
||||
{
|
||||
get => _redScale;
|
||||
set => RaiseAndSetIfChanged(ref _redScale, value);
|
||||
}
|
||||
|
||||
public float GreenScale
|
||||
{
|
||||
get => _greenScale;
|
||||
set => RaiseAndSetIfChanged(ref _greenScale, value);
|
||||
}
|
||||
|
||||
public float BlueScale
|
||||
{
|
||||
get => _blueScale;
|
||||
set => RaiseAndSetIfChanged(ref _blueScale, value);
|
||||
}
|
||||
|
||||
public SKColor CurrentColor
|
||||
{
|
||||
get => _currentColor;
|
||||
set => RaiseAndSetIfChanged(ref _currentColor, value);
|
||||
}
|
||||
|
||||
public bool DisplayOnDevices
|
||||
{
|
||||
get => _displayOnDevices;
|
||||
set => RaiseAndSetIfChanged(ref _displayOnDevices, value);
|
||||
}
|
||||
|
||||
|
||||
private bool GetCategory(DeviceCategory category)
|
||||
{
|
||||
return _categories.Contains(category);
|
||||
|
||||
@ -8,18 +8,18 @@ using Artemis.Core;
|
||||
using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using ContentDialogButton = Artemis.UI.Shared.Services.Builders.ContentDialogButton;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class DeviceLogicalLayoutDialogViewModel : ContentDialogViewModelBase
|
||||
public partial class DeviceLogicalLayoutDialogViewModel : ContentDialogViewModelBase
|
||||
{
|
||||
private const int LOCALE_NEUTRAL = 0x0000;
|
||||
private const int LOCALE_CUSTOM_DEFAULT = 0x0c00;
|
||||
private const int LOCALE_INVARIANT = 0x007F;
|
||||
|
||||
private RegionInfo? _selectedRegion;
|
||||
[Notify] private RegionInfo? _selectedRegion;
|
||||
|
||||
public DeviceLogicalLayoutDialogViewModel(ArtemisDevice device)
|
||||
{
|
||||
@ -44,12 +44,6 @@ public class DeviceLogicalLayoutDialogViewModel : ContentDialogViewModelBase
|
||||
public ObservableCollection<RegionInfo> Regions { get; }
|
||||
public bool Applied { get; set; }
|
||||
|
||||
public RegionInfo? SelectedRegion
|
||||
{
|
||||
get => _selectedRegion;
|
||||
set => RaiseAndSetIfChanged(ref _selectedRegion, value);
|
||||
}
|
||||
|
||||
public static async Task<bool> SelectLogicalLayout(IWindowService windowService, ArtemisDevice device)
|
||||
{
|
||||
await windowService.CreateContentDialog()
|
||||
|
||||
@ -7,18 +7,19 @@ using Artemis.Core.Services;
|
||||
using Artemis.UI.Exceptions;
|
||||
using Artemis.UI.Shared;
|
||||
using HidSharp.Reports.Units;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using RGB.NET.Core;
|
||||
using Unit = System.Reactive.Unit;
|
||||
|
||||
namespace Artemis.UI.Screens.Device;
|
||||
|
||||
public class InputMappingsTabViewModel : ActivatableViewModelBase
|
||||
public partial class InputMappingsTabViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IInputService _inputService;
|
||||
private readonly IDeviceService _deviceService;
|
||||
private readonly ObservableCollection<ArtemisLed> _selectedLeds;
|
||||
private ArtemisLed? _selectedLed;
|
||||
[Notify] private ArtemisLed? _selectedLed;
|
||||
|
||||
public InputMappingsTabViewModel(ArtemisDevice device, ObservableCollection<ArtemisLed> selectedLeds, IInputService inputService, IDeviceService deviceService)
|
||||
{
|
||||
@ -49,15 +50,7 @@ public class InputMappingsTabViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
public ReactiveCommand<ArtemisInputMapping, Unit> DeleteMapping { get; }
|
||||
|
||||
public ArtemisDevice Device { get; }
|
||||
|
||||
public ArtemisLed? SelectedLed
|
||||
{
|
||||
get => _selectedLed;
|
||||
set => RaiseAndSetIfChanged(ref _selectedLed, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<ArtemisInputMapping> InputMappings { get; }
|
||||
|
||||
private void ExecuteDeleteMapping(ArtemisInputMapping inputMapping)
|
||||
|
||||
@ -14,20 +14,21 @@ using Artemis.UI.Shared.Services;
|
||||
using Avalonia.Threading;
|
||||
using FluentAvalonia.Core;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using ContentDialogButton = Artemis.UI.Shared.Services.Builders.ContentDialogButton;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginPrerequisitesInstallDialogViewModel : ContentDialogViewModelBase
|
||||
public partial class PluginPrerequisitesInstallDialogViewModel : ContentDialogViewModelBase
|
||||
{
|
||||
private PluginPrerequisiteViewModel? _activePrerequisite;
|
||||
private bool _canInstall;
|
||||
private bool _showFailed;
|
||||
private bool _showInstall = true;
|
||||
private bool _showIntro = true;
|
||||
private bool _showProgress;
|
||||
private CancellationTokenSource? _tokenSource;
|
||||
[Notify] private PluginPrerequisiteViewModel? _activePrerequisite;
|
||||
[Notify] private bool _canInstall;
|
||||
[Notify] private bool _showFailed;
|
||||
[Notify] private bool _showInstall = true;
|
||||
[Notify] private bool _showIntro = true;
|
||||
[Notify] private bool _showProgress;
|
||||
|
||||
public PluginPrerequisitesInstallDialogViewModel(List<IPrerequisitesSubject> subjects, IPrerequisitesVmFactory prerequisitesVmFactory)
|
||||
{
|
||||
@ -50,43 +51,7 @@ public class PluginPrerequisitesInstallDialogViewModel : ContentDialogViewModelB
|
||||
|
||||
public ReactiveCommand<Unit, Unit> Install { get; }
|
||||
public ObservableCollection<PluginPrerequisiteViewModel> Prerequisites { get; }
|
||||
|
||||
public PluginPrerequisiteViewModel? ActivePrerequisite
|
||||
{
|
||||
get => _activePrerequisite;
|
||||
set => RaiseAndSetIfChanged(ref _activePrerequisite, value);
|
||||
}
|
||||
|
||||
public bool ShowProgress
|
||||
{
|
||||
get => _showProgress;
|
||||
set => RaiseAndSetIfChanged(ref _showProgress, value);
|
||||
}
|
||||
|
||||
public bool ShowIntro
|
||||
{
|
||||
get => _showIntro;
|
||||
set => RaiseAndSetIfChanged(ref _showIntro, value);
|
||||
}
|
||||
|
||||
public bool ShowFailed
|
||||
{
|
||||
get => _showFailed;
|
||||
set => RaiseAndSetIfChanged(ref _showFailed, value);
|
||||
}
|
||||
|
||||
public bool ShowInstall
|
||||
{
|
||||
get => _showInstall;
|
||||
set => RaiseAndSetIfChanged(ref _showInstall, value);
|
||||
}
|
||||
|
||||
public bool CanInstall
|
||||
{
|
||||
get => _canInstall;
|
||||
set => RaiseAndSetIfChanged(ref _canInstall, value);
|
||||
}
|
||||
|
||||
|
||||
public static async Task Show(IWindowService windowService, List<IPrerequisitesSubject> subjects)
|
||||
{
|
||||
await windowService.CreateContentDialog()
|
||||
|
||||
@ -15,19 +15,20 @@ using Artemis.UI.Shared.Services;
|
||||
using Avalonia.Threading;
|
||||
using FluentAvalonia.Core;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using ContentDialogButton = Artemis.UI.Shared.Services.Builders.ContentDialogButton;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginPrerequisitesUninstallDialogViewModel : ContentDialogViewModelBase
|
||||
public partial class PluginPrerequisitesUninstallDialogViewModel : ContentDialogViewModelBase
|
||||
{
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly List<IPrerequisitesSubject> _subjects;
|
||||
private readonly IWindowService _windowService;
|
||||
private PluginPrerequisiteViewModel? _activePrerequisite;
|
||||
private bool _canUninstall;
|
||||
private CancellationTokenSource? _tokenSource;
|
||||
[Notify] private PluginPrerequisiteViewModel? _activePrerequisite;
|
||||
[Notify] private bool _canUninstall;
|
||||
|
||||
public PluginPrerequisitesUninstallDialogViewModel(List<IPrerequisitesSubject> subjects,
|
||||
IPrerequisitesVmFactory prerequisitesVmFactory,
|
||||
@ -59,19 +60,7 @@ public class PluginPrerequisitesUninstallDialogViewModel : ContentDialogViewMode
|
||||
|
||||
public ReactiveCommand<Unit, Unit> Uninstall { get; }
|
||||
public ObservableCollection<PluginPrerequisiteViewModel> Prerequisites { get; }
|
||||
|
||||
public PluginPrerequisiteViewModel? ActivePrerequisite
|
||||
{
|
||||
get => _activePrerequisite;
|
||||
set => RaiseAndSetIfChanged(ref _activePrerequisite, value);
|
||||
}
|
||||
|
||||
public bool CanUninstall
|
||||
{
|
||||
get => _canUninstall;
|
||||
set => RaiseAndSetIfChanged(ref _canUninstall, value);
|
||||
}
|
||||
|
||||
|
||||
public static async Task Show(IWindowService windowService, List<IPrerequisitesSubject> subjects, string cancelLabel = "Cancel")
|
||||
{
|
||||
await windowService.CreateContentDialog()
|
||||
|
||||
@ -16,16 +16,17 @@ using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Shared.Services.Builders;
|
||||
using Avalonia.Threading;
|
||||
using Material.Icons;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins.Features;
|
||||
|
||||
public class PluginFeatureViewModel : ActivatableViewModelBase
|
||||
public partial class PluginFeatureViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly ICoreService _coreService;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly IWindowService _windowService;
|
||||
private bool _enabling;
|
||||
[Notify] private bool _enabling;
|
||||
|
||||
public PluginFeatureViewModel(PluginFeatureInfo pluginFeatureInfo,
|
||||
bool showShield,
|
||||
@ -73,15 +74,8 @@ public class PluginFeatureViewModel : ActivatableViewModelBase
|
||||
|
||||
public PluginFeatureInfo FeatureInfo { get; }
|
||||
public Exception? LoadException => FeatureInfo.LoadException;
|
||||
|
||||
public bool ShowShield { get; }
|
||||
|
||||
public bool Enabling
|
||||
{
|
||||
get => _enabling;
|
||||
set => RaiseAndSetIfChanged(ref _enabling, value);
|
||||
}
|
||||
|
||||
|
||||
public bool IsEnabled
|
||||
{
|
||||
get => FeatureInfo.AlwaysEnabled || (FeatureInfo.Instance != null && FeatureInfo.Instance.IsEnabled);
|
||||
|
||||
@ -14,21 +14,22 @@ using Artemis.UI.Shared.Services.Builders;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Threading;
|
||||
using Material.Icons;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins;
|
||||
|
||||
public class PluginViewModel : ActivatableViewModelBase
|
||||
public partial class PluginViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly ICoreService _coreService;
|
||||
private readonly INotificationService _notificationService;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly IWindowService _windowService;
|
||||
private bool _canInstallPrerequisites;
|
||||
private bool _canRemovePrerequisites;
|
||||
private bool _enabling;
|
||||
private Plugin _plugin;
|
||||
private Window? _settingsWindow;
|
||||
[Notify] private bool _canInstallPrerequisites;
|
||||
[Notify] private bool _canRemovePrerequisites;
|
||||
[Notify] private bool _enabling;
|
||||
[Notify] private Plugin _plugin;
|
||||
|
||||
public PluginViewModel(Plugin plugin,
|
||||
ReactiveCommand<Unit, Unit>? reload,
|
||||
@ -87,34 +88,9 @@ public class PluginViewModel : ActivatableViewModelBase
|
||||
public ReactiveCommand<Unit, Unit> OpenPluginDirectory { get; }
|
||||
|
||||
public ObservableCollection<PluginPlatformViewModel> Platforms { get; }
|
||||
|
||||
public Plugin Plugin
|
||||
{
|
||||
get => _plugin;
|
||||
set => RaiseAndSetIfChanged(ref _plugin, value);
|
||||
}
|
||||
|
||||
public bool Enabling
|
||||
{
|
||||
get => _enabling;
|
||||
set => RaiseAndSetIfChanged(ref _enabling, value);
|
||||
}
|
||||
|
||||
public string Type => Plugin.GetType().BaseType?.Name ?? Plugin.GetType().Name;
|
||||
public bool IsEnabled => Plugin.IsEnabled;
|
||||
|
||||
public bool CanInstallPrerequisites
|
||||
{
|
||||
get => _canInstallPrerequisites;
|
||||
set => RaiseAndSetIfChanged(ref _canInstallPrerequisites, value);
|
||||
}
|
||||
|
||||
public bool CanRemovePrerequisites
|
||||
{
|
||||
get => _canRemovePrerequisites;
|
||||
set => RaiseAndSetIfChanged(ref _canRemovePrerequisites, value);
|
||||
}
|
||||
|
||||
|
||||
public async Task UpdateEnabled(bool enable)
|
||||
{
|
||||
if (Enabling)
|
||||
|
||||
@ -6,21 +6,20 @@ using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Artemis.Core;
|
||||
using Artemis.UI.Shared;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Plugins.Prerequisites;
|
||||
|
||||
public class PluginPrerequisiteViewModel : ActivatableViewModelBase
|
||||
public partial class PluginPrerequisiteViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly ObservableAsPropertyHelper<int> _activeStepNumber;
|
||||
private readonly ObservableAsPropertyHelper<bool> _busy;
|
||||
private readonly bool _uninstall;
|
||||
|
||||
private PluginPrerequisiteActionViewModel? _activeAction;
|
||||
|
||||
private bool _installing;
|
||||
private bool _isMet;
|
||||
private bool _uninstalling;
|
||||
[Notify] private PluginPrerequisiteActionViewModel? _activeAction;
|
||||
[Notify] private bool _installing;
|
||||
[Notify] private bool _isMet;
|
||||
[Notify] private bool _uninstalling;
|
||||
|
||||
public PluginPrerequisiteViewModel(PluginPrerequisite pluginPrerequisite, bool uninstall)
|
||||
{
|
||||
@ -45,33 +44,7 @@ public class PluginPrerequisiteViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
public ObservableCollection<PluginPrerequisiteActionViewModel> Actions { get; }
|
||||
|
||||
public PluginPrerequisiteActionViewModel? ActiveAction
|
||||
{
|
||||
get => _activeAction;
|
||||
set => RaiseAndSetIfChanged(ref _activeAction, value);
|
||||
}
|
||||
|
||||
public PluginPrerequisite PluginPrerequisite { get; }
|
||||
|
||||
public bool Installing
|
||||
{
|
||||
get => _installing;
|
||||
set => RaiseAndSetIfChanged(ref _installing, value);
|
||||
}
|
||||
|
||||
public bool Uninstalling
|
||||
{
|
||||
get => _uninstalling;
|
||||
set => RaiseAndSetIfChanged(ref _uninstalling, value);
|
||||
}
|
||||
|
||||
public bool IsMet
|
||||
{
|
||||
get => _isMet;
|
||||
set => RaiseAndSetIfChanged(ref _isMet, value);
|
||||
}
|
||||
|
||||
public bool Busy => _busy.Value;
|
||||
public int ActiveStepNumber => _activeStepNumber.Value;
|
||||
|
||||
|
||||
@ -17,18 +17,19 @@ using Avalonia;
|
||||
using Avalonia.Input;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Keyframes;
|
||||
|
||||
public class TimelineKeyframeViewModel<T> : ActivatableViewModelBase, ITimelineKeyframeViewModel
|
||||
public partial class TimelineKeyframeViewModel<T> : ActivatableViewModelBase, ITimelineKeyframeViewModel
|
||||
{
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private bool _canPaste;
|
||||
private bool _isFlyoutOpen;
|
||||
private ObservableAsPropertyHelper<bool>? _isSelected;
|
||||
private string _timestamp;
|
||||
private double _x;
|
||||
[Notify] private bool _canPaste;
|
||||
[Notify] private bool _isFlyoutOpen;
|
||||
[Notify] private string _timestamp;
|
||||
[Notify] private double _x;
|
||||
|
||||
public TimelineKeyframeViewModel(LayerPropertyKeyframe<T> layerPropertyKeyframe, IProfileEditorService profileEditorService)
|
||||
{
|
||||
@ -60,31 +61,6 @@ public class TimelineKeyframeViewModel<T> : ActivatableViewModelBase, ITimelineK
|
||||
public LayerPropertyKeyframe<T> LayerPropertyKeyframe { get; }
|
||||
public ObservableCollection<TimelineEasingViewModel> EasingViewModels { get; }
|
||||
|
||||
|
||||
public double X
|
||||
{
|
||||
get => _x;
|
||||
set => RaiseAndSetIfChanged(ref _x, value);
|
||||
}
|
||||
|
||||
public string Timestamp
|
||||
{
|
||||
get => _timestamp;
|
||||
set => RaiseAndSetIfChanged(ref _timestamp, value);
|
||||
}
|
||||
|
||||
public bool IsFlyoutOpen
|
||||
{
|
||||
get => _isFlyoutOpen;
|
||||
set => RaiseAndSetIfChanged(ref _isFlyoutOpen, value);
|
||||
}
|
||||
|
||||
public bool CanPaste
|
||||
{
|
||||
get => _canPaste;
|
||||
set => RaiseAndSetIfChanged(ref _canPaste, value);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
X = _pixelsPerSecond * LayerPropertyKeyframe.Position.TotalSeconds;
|
||||
|
||||
@ -2,12 +2,13 @@
|
||||
using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
|
||||
namespace Artemis.UI.Screens.Root;
|
||||
|
||||
public class SplashViewModel : ViewModelBase
|
||||
public partial class SplashViewModel : ViewModelBase
|
||||
{
|
||||
private string _status;
|
||||
[Notify] private string _status;
|
||||
|
||||
public SplashViewModel(ICoreService coreService, IPluginManagementService pluginManagementService)
|
||||
{
|
||||
@ -24,13 +25,7 @@ public class SplashViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
public ICoreService CoreService { get; }
|
||||
|
||||
public string Status
|
||||
{
|
||||
get => _status;
|
||||
set => RaiseAndSetIfChanged(ref _status, value);
|
||||
}
|
||||
|
||||
|
||||
private void OnPluginManagementServiceOnPluginManagementLoaded(object? sender, PluginEventArgs args)
|
||||
{
|
||||
Status = "Initializing UI";
|
||||
|
||||
@ -5,15 +5,16 @@ using Artemis.Core.ScriptingProviders;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Validation.Extensions;
|
||||
|
||||
namespace Artemis.UI.Screens.Scripting.Dialogs;
|
||||
|
||||
public class ScriptConfigurationCreateViewModel : ContentDialogViewModelBase
|
||||
public partial class ScriptConfigurationCreateViewModel : ContentDialogViewModelBase
|
||||
{
|
||||
private string? _scriptName;
|
||||
private ScriptingProvider _selectedScriptingProvider;
|
||||
[Notify] private string? _scriptName;
|
||||
[Notify] private ScriptingProvider _selectedScriptingProvider;
|
||||
|
||||
public ScriptConfigurationCreateViewModel(IScriptingService scriptingService)
|
||||
{
|
||||
@ -26,19 +27,6 @@ public class ScriptConfigurationCreateViewModel : ContentDialogViewModelBase
|
||||
|
||||
public ScriptConfiguration? ScriptConfiguration { get; private set; }
|
||||
public List<ScriptingProvider> ScriptingProviders { get; }
|
||||
|
||||
public string? ScriptName
|
||||
{
|
||||
get => _scriptName;
|
||||
set => RaiseAndSetIfChanged(ref _scriptName, value);
|
||||
}
|
||||
|
||||
public ScriptingProvider SelectedScriptingProvider
|
||||
{
|
||||
get => _selectedScriptingProvider;
|
||||
set => RaiseAndSetIfChanged(ref _selectedScriptingProvider, value);
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Unit> Submit { get; }
|
||||
|
||||
private void ExecuteSubmit()
|
||||
|
||||
@ -2,14 +2,15 @@
|
||||
using Artemis.Core.ScriptingProviders;
|
||||
using Artemis.UI.Shared;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Validation.Extensions;
|
||||
|
||||
namespace Artemis.UI.Screens.Scripting.Dialogs;
|
||||
|
||||
public class ScriptConfigurationEditViewModel : ContentDialogViewModelBase
|
||||
public partial class ScriptConfigurationEditViewModel : ContentDialogViewModelBase
|
||||
{
|
||||
private string? _scriptName;
|
||||
[Notify] private string? _scriptName;
|
||||
|
||||
public ScriptConfigurationEditViewModel(ScriptConfiguration scriptConfiguration)
|
||||
{
|
||||
@ -23,12 +24,6 @@ public class ScriptConfigurationEditViewModel : ContentDialogViewModelBase
|
||||
public ScriptConfiguration ScriptConfiguration { get; }
|
||||
public ReactiveCommand<Unit, Unit> Submit { get; }
|
||||
|
||||
public string? ScriptName
|
||||
{
|
||||
get => _scriptName;
|
||||
set => RaiseAndSetIfChanged(ref _scriptName, value);
|
||||
}
|
||||
|
||||
private void ExecuteSubmit()
|
||||
{
|
||||
if (ScriptName == null)
|
||||
|
||||
@ -16,19 +16,20 @@ using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Shared.Services.Builders;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Scripting;
|
||||
|
||||
public class ScriptsDialogViewModel : DialogViewModelBase<object?>
|
||||
public partial class ScriptsDialogViewModel : DialogViewModelBase<object?>
|
||||
{
|
||||
private readonly Dictionary<ScriptingProvider, IScriptEditorViewModel> _providerViewModels = new();
|
||||
private readonly IScriptingService _scriptingService;
|
||||
private readonly IWindowService _windowService;
|
||||
private ObservableAsPropertyHelper<bool>? _hasScripts;
|
||||
private ReadOnlyObservableCollection<ScriptConfigurationViewModel> _scriptConfigurations;
|
||||
private IScriptEditorViewModel? _scriptEditorViewModel;
|
||||
private ScriptConfigurationViewModel? _selectedScript;
|
||||
[Notify] private ReadOnlyObservableCollection<ScriptConfigurationViewModel> _scriptConfigurations;
|
||||
[Notify] private IScriptEditorViewModel? _scriptEditorViewModel;
|
||||
[Notify] private ScriptConfigurationViewModel? _selectedScript;
|
||||
|
||||
public ScriptsDialogViewModel(IScriptingService scriptingService, IWindowService windowService, IProfileService profileService, IScriptVmFactory scriptVmFactory)
|
||||
{
|
||||
@ -74,25 +75,6 @@ public class ScriptsDialogViewModel : DialogViewModelBase<object?>
|
||||
public List<ScriptingProvider> ScriptingProviders { get; }
|
||||
public Profile? Profile { get; }
|
||||
public bool HasScripts => _hasScripts?.Value ?? false;
|
||||
|
||||
public ReadOnlyObservableCollection<ScriptConfigurationViewModel> ScriptConfigurations
|
||||
{
|
||||
get => _scriptConfigurations;
|
||||
set => RaiseAndSetIfChanged(ref _scriptConfigurations, value);
|
||||
}
|
||||
|
||||
public ScriptConfigurationViewModel? SelectedScript
|
||||
{
|
||||
get => _selectedScript;
|
||||
set => RaiseAndSetIfChanged(ref _selectedScript, value);
|
||||
}
|
||||
|
||||
public IScriptEditorViewModel? ScriptEditorViewModel
|
||||
{
|
||||
get => _scriptEditorViewModel;
|
||||
set => RaiseAndSetIfChanged(ref _scriptEditorViewModel, value);
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Unit> AddScriptConfiguration { get; }
|
||||
|
||||
public async Task<bool> CanClose()
|
||||
|
||||
@ -15,16 +15,17 @@ using Artemis.UI.Shared.Services.Builders;
|
||||
using Avalonia.ReactiveUI;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Settings;
|
||||
|
||||
public class PluginsTabViewModel : RoutableScreen
|
||||
public partial class PluginsTabViewModel : RoutableScreen
|
||||
{
|
||||
private readonly INotificationService _notificationService;
|
||||
private readonly IPluginManagementService _pluginManagementService;
|
||||
private readonly IWindowService _windowService;
|
||||
private string? _searchPluginInput;
|
||||
[Notify] private string? _searchPluginInput;
|
||||
|
||||
public PluginsTabViewModel(IPluginManagementService pluginManagementService, INotificationService notificationService, IWindowService windowService, ISettingsVmFactory settingsVmFactory)
|
||||
{
|
||||
@ -62,13 +63,7 @@ public class PluginsTabViewModel : RoutableScreen
|
||||
|
||||
public ReadOnlyObservableCollection<PluginSettingsViewModel> Plugins { get; }
|
||||
public ReactiveCommand<Unit, Unit> ImportPlugin { get; }
|
||||
|
||||
public string? SearchPluginInput
|
||||
{
|
||||
get => _searchPluginInput;
|
||||
set => RaiseAndSetIfChanged(ref _searchPluginInput, value);
|
||||
}
|
||||
|
||||
|
||||
public void OpenUrl(string url)
|
||||
{
|
||||
Utilities.OpenUrl(url);
|
||||
|
||||
@ -16,13 +16,14 @@ using Artemis.WebClient.Updating;
|
||||
using Avalonia.ReactiveUI;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using Serilog;
|
||||
using StrawberryShake;
|
||||
|
||||
namespace Artemis.UI.Screens.Settings;
|
||||
|
||||
public class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsViewModel>
|
||||
public partial class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsViewModel>
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUpdateService _updateService;
|
||||
@ -30,8 +31,8 @@ public class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsViewModel>
|
||||
private readonly INotificationService _notificationService;
|
||||
private readonly IRouter _router;
|
||||
private readonly SourceList<IGetReleases_PublishedReleases_Nodes> _releases;
|
||||
private bool _loading;
|
||||
private ReleaseViewModel? _selectedReleaseViewModel;
|
||||
[Notify(Setter.Private)] private bool _loading;
|
||||
[Notify] private ReleaseViewModel? _selectedReleaseViewModel;
|
||||
|
||||
public ReleasesTabViewModel(ILogger logger, IUpdateService updateService, IUpdatingClient updatingClient, IReleaseVmFactory releaseVmFactory, INotificationService notificationService,
|
||||
IRouter router)
|
||||
@ -61,19 +62,7 @@ public class ReleasesTabViewModel : RoutableHostScreen<ReleaseDetailsViewModel>
|
||||
|
||||
public ReadOnlyObservableCollection<ReleaseViewModel> ReleaseViewModels { get; }
|
||||
public string Channel { get; }
|
||||
|
||||
public ReleaseViewModel? SelectedReleaseViewModel
|
||||
{
|
||||
get => _selectedReleaseViewModel;
|
||||
set => RaiseAndSetIfChanged(ref _selectedReleaseViewModel, value);
|
||||
}
|
||||
|
||||
public bool Loading
|
||||
{
|
||||
get => _loading;
|
||||
private set => RaiseAndSetIfChanged(ref _loading, value);
|
||||
}
|
||||
|
||||
|
||||
public async Task GetReleases(CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
|
||||
@ -12,27 +12,27 @@ using Artemis.UI.Shared.Routing;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using Artemis.UI.Shared.Services.Builders;
|
||||
using Artemis.WebClient.Updating;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using Serilog;
|
||||
using StrawberryShake;
|
||||
|
||||
namespace Artemis.UI.Screens.Settings.Updating;
|
||||
|
||||
public class ReleaseDetailsViewModel : RoutableScreen<ReleaseDetailsViewModelParameters>
|
||||
public partial class ReleaseDetailsViewModel : RoutableScreen<ReleaseDetailsViewModelParameters>
|
||||
{
|
||||
private readonly ObservableAsPropertyHelper<long> _fileSize;
|
||||
private readonly ILogger _logger;
|
||||
private readonly INotificationService _notificationService;
|
||||
private readonly IUpdateService _updateService;
|
||||
private readonly IUpdatingClient _updatingClient;
|
||||
private bool _installationAvailable;
|
||||
private bool _installationFinished;
|
||||
private bool _installationInProgress;
|
||||
|
||||
private CancellationTokenSource? _installerCts;
|
||||
private bool _loading = true;
|
||||
private IGetReleaseById_PublishedRelease? _release;
|
||||
private ReleaseInstaller? _releaseInstaller;
|
||||
[Notify(Setter.Private)] private bool _loading = true;
|
||||
[Notify] private IGetReleaseById_PublishedRelease? _release;
|
||||
[Notify] private ReleaseInstaller? _releaseInstaller;
|
||||
[Notify] private bool _installationAvailable;
|
||||
[Notify] private bool _installationFinished;
|
||||
[Notify] private bool _installationInProgress;
|
||||
|
||||
public ReleaseDetailsViewModel(ILogger logger, IUpdatingClient updatingClient, INotificationService notificationService, IUpdateService updateService)
|
||||
{
|
||||
@ -67,43 +67,7 @@ public class ReleaseDetailsViewModel : RoutableScreen<ReleaseDetailsViewModelPar
|
||||
public ReactiveCommand<Unit, Unit> CancelInstall { get; }
|
||||
|
||||
public long FileSize => _fileSize.Value;
|
||||
|
||||
public IGetReleaseById_PublishedRelease? Release
|
||||
{
|
||||
get => _release;
|
||||
set => RaiseAndSetIfChanged(ref _release, value);
|
||||
}
|
||||
|
||||
public ReleaseInstaller? ReleaseInstaller
|
||||
{
|
||||
get => _releaseInstaller;
|
||||
set => RaiseAndSetIfChanged(ref _releaseInstaller, value);
|
||||
}
|
||||
|
||||
public bool Loading
|
||||
{
|
||||
get => _loading;
|
||||
private set => RaiseAndSetIfChanged(ref _loading, value);
|
||||
}
|
||||
|
||||
public bool InstallationAvailable
|
||||
{
|
||||
get => _installationAvailable;
|
||||
set => RaiseAndSetIfChanged(ref _installationAvailable, value);
|
||||
}
|
||||
|
||||
public bool InstallationInProgress
|
||||
{
|
||||
get => _installationInProgress;
|
||||
set => RaiseAndSetIfChanged(ref _installationInProgress, value);
|
||||
}
|
||||
|
||||
public bool InstallationFinished
|
||||
{
|
||||
get => _installationFinished;
|
||||
set => RaiseAndSetIfChanged(ref _installationFinished, value);
|
||||
}
|
||||
|
||||
|
||||
public void NavigateToSource()
|
||||
{
|
||||
if (Release != null)
|
||||
|
||||
@ -4,16 +4,17 @@ using Artemis.Core;
|
||||
using Artemis.Core.Services;
|
||||
using Artemis.UI.Shared;
|
||||
using FluentAvalonia.UI.Controls;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Validation.Extensions;
|
||||
|
||||
namespace Artemis.UI.Screens.Sidebar;
|
||||
|
||||
public class SidebarCategoryEditViewModel : ContentDialogViewModelBase
|
||||
public partial class SidebarCategoryEditViewModel : ContentDialogViewModelBase
|
||||
{
|
||||
private readonly ProfileCategory? _category;
|
||||
private readonly IProfileService _profileService;
|
||||
private string? _categoryName;
|
||||
[Notify] private string? _categoryName;
|
||||
|
||||
public SidebarCategoryEditViewModel(IProfileService profileService, ProfileCategory category)
|
||||
{
|
||||
@ -27,13 +28,7 @@ public class SidebarCategoryEditViewModel : ContentDialogViewModelBase
|
||||
this.ValidationRule(vm => vm.CategoryName, categoryName => !string.IsNullOrWhiteSpace(categoryName?.Trim()), "You must specify a valid name");
|
||||
this.ValidationRule(vm => vm.CategoryName, categoryName => profileService.ProfileCategories.All(c => c.Name != categoryName?.Trim()), "You must specify a unique name");
|
||||
}
|
||||
|
||||
public string? CategoryName
|
||||
{
|
||||
get => _categoryName;
|
||||
set => RaiseAndSetIfChanged(ref _categoryName, value);
|
||||
}
|
||||
|
||||
|
||||
public ReactiveCommand<Unit, Unit> Confirm { get; }
|
||||
|
||||
private void ExecuteConfirm()
|
||||
|
||||
@ -4,15 +4,16 @@ using System.Timers;
|
||||
using Artemis.Core.Modules;
|
||||
using Artemis.UI.Shared;
|
||||
using Humanizer;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Sidebar;
|
||||
|
||||
public class ModuleActivationRequirementViewModel : ActivatableViewModelBase
|
||||
public partial class ModuleActivationRequirementViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IModuleActivationRequirement _activationRequirement;
|
||||
private string _requirementDescription;
|
||||
private bool _requirementMet;
|
||||
[Notify] private string _requirementDescription;
|
||||
[Notify] private bool _requirementMet;
|
||||
|
||||
public ModuleActivationRequirementViewModel(IModuleActivationRequirement activationRequirement)
|
||||
{
|
||||
@ -31,18 +32,6 @@ public class ModuleActivationRequirementViewModel : ActivatableViewModelBase
|
||||
|
||||
public string RequirementName { get; }
|
||||
|
||||
public string RequirementDescription
|
||||
{
|
||||
get => _requirementDescription;
|
||||
set => RaiseAndSetIfChanged(ref _requirementDescription, value);
|
||||
}
|
||||
|
||||
public bool RequirementMet
|
||||
{
|
||||
get => _requirementMet;
|
||||
set => RaiseAndSetIfChanged(ref _requirementMet, value);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
RequirementDescription = _activationRequirement.GetUserFriendlyDescription();
|
||||
|
||||
@ -17,28 +17,29 @@ using Artemis.UI.Shared.Services.ProfileEditor;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Threading;
|
||||
using Material.Icons;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Sidebar;
|
||||
|
||||
public class ProfileConfigurationEditViewModel : DialogViewModelBase<ProfileConfiguration?>
|
||||
public partial class ProfileConfigurationEditViewModel : DialogViewModelBase<ProfileConfiguration?>
|
||||
{
|
||||
private readonly ObservableAsPropertyHelper<ModuleActivationRequirementsViewModel?> _moduleActivationRequirementsViewModel;
|
||||
private readonly ProfileCategory _profileCategory;
|
||||
private readonly IProfileEditorService _profileEditorService;
|
||||
private readonly IProfileService _profileService;
|
||||
private readonly IWindowService _windowService;
|
||||
private Hotkey? _disableHotkey;
|
||||
private Hotkey? _enableHotkey;
|
||||
private bool _fadeInAndOut;
|
||||
private ProfileConfigurationHotkeyMode _hotkeyMode;
|
||||
private ProfileConfigurationIconType _iconType;
|
||||
private ProfileConfiguration _profileConfiguration;
|
||||
private string _profileName;
|
||||
private Bitmap? _selectedBitmapSource;
|
||||
private string? _selectedIconPath;
|
||||
private ProfileIconViewModel? _selectedMaterialIcon;
|
||||
private ProfileModuleViewModel? _selectedModule;
|
||||
[Notify] private ProfileConfigurationIconType _iconType;
|
||||
[Notify] private Bitmap? _selectedBitmapSource;
|
||||
[Notify] private ProfileIconViewModel? _selectedMaterialIcon;
|
||||
[Notify] private Hotkey? _disableHotkey;
|
||||
[Notify] private Hotkey? _enableHotkey;
|
||||
[Notify] private bool _fadeInAndOut;
|
||||
[Notify] private ProfileConfigurationHotkeyMode _hotkeyMode;
|
||||
[Notify] private ProfileConfiguration _profileConfiguration;
|
||||
[Notify] private string _profileName;
|
||||
[Notify] private ProfileModuleViewModel? _selectedModule;
|
||||
|
||||
public ProfileConfigurationEditViewModel(
|
||||
ProfileCategory profileCategory,
|
||||
@ -88,51 +89,7 @@ public class ProfileConfigurationEditViewModel : DialogViewModelBase<ProfileConf
|
||||
}
|
||||
|
||||
public bool IsNew { get; }
|
||||
|
||||
public ProfileConfiguration ProfileConfiguration
|
||||
{
|
||||
get => _profileConfiguration;
|
||||
set => RaiseAndSetIfChanged(ref _profileConfiguration, value);
|
||||
}
|
||||
|
||||
public string ProfileName
|
||||
{
|
||||
get => _profileName;
|
||||
set => RaiseAndSetIfChanged(ref _profileName, value);
|
||||
}
|
||||
|
||||
public ProfileConfigurationHotkeyMode HotkeyMode
|
||||
{
|
||||
get => _hotkeyMode;
|
||||
set => RaiseAndSetIfChanged(ref _hotkeyMode, value);
|
||||
}
|
||||
|
||||
public Hotkey? EnableHotkey
|
||||
{
|
||||
get => _enableHotkey;
|
||||
set => RaiseAndSetIfChanged(ref _enableHotkey, value);
|
||||
}
|
||||
|
||||
public Hotkey? DisableHotkey
|
||||
{
|
||||
get => _disableHotkey;
|
||||
set => RaiseAndSetIfChanged(ref _disableHotkey, value);
|
||||
}
|
||||
|
||||
public bool FadeInAndOut
|
||||
{
|
||||
get => _fadeInAndOut;
|
||||
set => RaiseAndSetIfChanged(ref _fadeInAndOut, value);
|
||||
}
|
||||
|
||||
public ObservableCollection<ProfileModuleViewModel?> Modules { get; }
|
||||
|
||||
public ProfileModuleViewModel? SelectedModule
|
||||
{
|
||||
get => _selectedModule;
|
||||
set => RaiseAndSetIfChanged(ref _selectedModule, value);
|
||||
}
|
||||
|
||||
public NodeScriptViewModel VisualEditorViewModel { get; }
|
||||
public ModuleActivationRequirementsViewModel? ModuleActivationRequirementsViewModel => _moduleActivationRequirementsViewModel.Value;
|
||||
|
||||
@ -179,25 +136,7 @@ public class ProfileConfigurationEditViewModel : DialogViewModelBase<ProfileConf
|
||||
}
|
||||
|
||||
#region Icon
|
||||
|
||||
public ProfileConfigurationIconType IconType
|
||||
{
|
||||
get => _iconType;
|
||||
set => RaiseAndSetIfChanged(ref _iconType, value);
|
||||
}
|
||||
|
||||
public ProfileIconViewModel? SelectedMaterialIcon
|
||||
{
|
||||
get => _selectedMaterialIcon;
|
||||
set => RaiseAndSetIfChanged(ref _selectedMaterialIcon, value);
|
||||
}
|
||||
|
||||
public Bitmap? SelectedBitmapSource
|
||||
{
|
||||
get => _selectedBitmapSource;
|
||||
set => RaiseAndSetIfChanged(ref _selectedBitmapSource, value);
|
||||
}
|
||||
|
||||
|
||||
private void LoadIcon()
|
||||
{
|
||||
// Preselect the icon based on streams if needed
|
||||
|
||||
@ -19,11 +19,12 @@ using Artemis.UI.Shared.Services.Builders;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using Newtonsoft.Json;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Sidebar;
|
||||
|
||||
public class SidebarCategoryViewModel : ActivatableViewModelBase
|
||||
public partial class SidebarCategoryViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IProfileService _profileService;
|
||||
private readonly IRouter _router;
|
||||
@ -31,7 +32,7 @@ public class SidebarCategoryViewModel : ActivatableViewModelBase
|
||||
private readonly IWindowService _windowService;
|
||||
private ObservableAsPropertyHelper<bool>? _isCollapsed;
|
||||
private ObservableAsPropertyHelper<bool>? _isSuspended;
|
||||
private SidebarProfileConfigurationViewModel? _selectedProfileConfiguration;
|
||||
[Notify] private SidebarProfileConfigurationViewModel? _selectedProfileConfiguration;
|
||||
|
||||
public SidebarCategoryViewModel(ProfileCategory profileCategory, IProfileService profileService, IWindowService windowService, ISidebarVmFactory vmFactory, IRouter router)
|
||||
{
|
||||
@ -102,16 +103,9 @@ public class SidebarCategoryViewModel : ActivatableViewModelBase
|
||||
|
||||
public ProfileCategory ProfileCategory { get; }
|
||||
public ReadOnlyObservableCollection<SidebarProfileConfigurationViewModel> ProfileConfigurations { get; }
|
||||
|
||||
public bool IsCollapsed => _isCollapsed?.Value ?? false;
|
||||
public bool IsSuspended => _isSuspended?.Value ?? false;
|
||||
|
||||
public SidebarProfileConfigurationViewModel? SelectedProfileConfiguration
|
||||
{
|
||||
get => _selectedProfileConfiguration;
|
||||
set => RaiseAndSetIfChanged(ref _selectedProfileConfiguration, value);
|
||||
}
|
||||
|
||||
|
||||
public void AddProfileConfiguration(ProfileConfiguration profileConfiguration, int? index)
|
||||
{
|
||||
ProfileCategory oldCategory = profileConfiguration.Category;
|
||||
|
||||
@ -3,12 +3,13 @@ using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using Artemis.UI.Shared;
|
||||
using Material.Icons;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
|
||||
namespace Artemis.UI.Screens.Sidebar;
|
||||
|
||||
public class SidebarScreenViewModel : ViewModelBase
|
||||
public partial class SidebarScreenViewModel : ViewModelBase
|
||||
{
|
||||
private bool _isExpanded;
|
||||
[Notify] private bool _isExpanded;
|
||||
|
||||
public SidebarScreenViewModel(MaterialIconKind icon, string displayName, string path, string? rootPath = null, ObservableCollection<SidebarScreenViewModel>? screens = null)
|
||||
{
|
||||
@ -22,15 +23,8 @@ public class SidebarScreenViewModel : ViewModelBase
|
||||
public MaterialIconKind Icon { get; }
|
||||
public string Path { get; }
|
||||
public string RootPath { get; }
|
||||
|
||||
public ObservableCollection<SidebarScreenViewModel> Screens { get; }
|
||||
|
||||
public bool IsExpanded
|
||||
{
|
||||
get => _isExpanded;
|
||||
set => RaiseAndSetIfChanged(ref _isExpanded, value);
|
||||
}
|
||||
|
||||
|
||||
public bool Matches(string? path)
|
||||
{
|
||||
if (path == null)
|
||||
|
||||
@ -16,19 +16,20 @@ using Avalonia.Threading;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using Material.Icons;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.Sidebar;
|
||||
|
||||
public class SidebarViewModel : ActivatableViewModelBase
|
||||
public partial class SidebarViewModel : ActivatableViewModelBase
|
||||
{
|
||||
public const string ROOT_SCREEN = "root";
|
||||
|
||||
private readonly IRouter _router;
|
||||
private readonly IWindowService _windowService;
|
||||
private ReadOnlyObservableCollection<SidebarCategoryViewModel> _sidebarCategories = new(new ObservableCollection<SidebarCategoryViewModel>());
|
||||
private SidebarScreenViewModel? _selectedScreen;
|
||||
private bool _updating;
|
||||
[Notify] private ReadOnlyObservableCollection<SidebarCategoryViewModel> _sidebarCategories = new(new ObservableCollection<SidebarCategoryViewModel>());
|
||||
[Notify] private SidebarScreenViewModel? _selectedScreen;
|
||||
|
||||
public SidebarViewModel(IRouter router, IProfileService profileService, IWindowService windowService, ISidebarVmFactory sidebarVmFactory)
|
||||
{
|
||||
@ -91,19 +92,6 @@ public class SidebarViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
public SidebarScreenViewModel SidebarScreen { get; }
|
||||
|
||||
public SidebarScreenViewModel? SelectedScreen
|
||||
{
|
||||
get => _selectedScreen;
|
||||
set => RaiseAndSetIfChanged(ref _selectedScreen, value);
|
||||
}
|
||||
|
||||
public ReadOnlyObservableCollection<SidebarCategoryViewModel> SidebarCategories
|
||||
{
|
||||
get => _sidebarCategories;
|
||||
set => RaiseAndSetIfChanged(ref _sidebarCategories, value);
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Unit> AddCategory { get; }
|
||||
|
||||
private async Task ExecuteAddCategory()
|
||||
|
||||
@ -13,21 +13,22 @@ using Artemis.UI.Shared;
|
||||
using Artemis.UI.Shared.Providers;
|
||||
using Artemis.UI.Shared.Services;
|
||||
using DryIoc;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.StartupWizard;
|
||||
|
||||
public class StartupWizardViewModel : DialogViewModelBase<bool>
|
||||
public partial class StartupWizardViewModel : DialogViewModelBase<bool>
|
||||
{
|
||||
private readonly IAutoRunProvider? _autoRunProvider;
|
||||
private readonly IProtocolProvider? _protocolProvider;
|
||||
private readonly ISettingsService _settingsService;
|
||||
private readonly IWindowService _windowService;
|
||||
private readonly IDeviceService _deviceService;
|
||||
private int _currentStep;
|
||||
private bool _showContinue;
|
||||
private bool _showFinish;
|
||||
private bool _showGoBack;
|
||||
[Notify] private int _currentStep;
|
||||
[Notify] private bool _showContinue;
|
||||
[Notify] private bool _showFinish;
|
||||
[Notify] private bool _showGoBack;
|
||||
|
||||
public StartupWizardViewModel(IContainer container,
|
||||
ISettingsService settingsService,
|
||||
@ -90,31 +91,7 @@ public class StartupWizardViewModel : DialogViewModelBase<bool>
|
||||
public PluginSetting<bool> UIShowOnStartup => _settingsService.GetSetting("UI.ShowOnStartup", true);
|
||||
public PluginSetting<bool> UICheckForUpdates => _settingsService.GetSetting("UI.Updating.AutoCheck", true);
|
||||
public PluginSetting<bool> UIAutoUpdate => _settingsService.GetSetting("UI.Updating.AutoInstall", true);
|
||||
|
||||
public int CurrentStep
|
||||
{
|
||||
get => _currentStep;
|
||||
set => RaiseAndSetIfChanged(ref _currentStep, value);
|
||||
}
|
||||
|
||||
public bool ShowContinue
|
||||
{
|
||||
get => _showContinue;
|
||||
set => RaiseAndSetIfChanged(ref _showContinue, value);
|
||||
}
|
||||
|
||||
public bool ShowGoBack
|
||||
{
|
||||
get => _showGoBack;
|
||||
set => RaiseAndSetIfChanged(ref _showGoBack, value);
|
||||
}
|
||||
|
||||
public bool ShowFinish
|
||||
{
|
||||
get => _showFinish;
|
||||
set => RaiseAndSetIfChanged(ref _showFinish, value);
|
||||
}
|
||||
|
||||
|
||||
private void ExecuteGoBack()
|
||||
{
|
||||
if (CurrentStep > 1)
|
||||
|
||||
@ -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; }
|
||||
|
||||
|
||||
@ -11,23 +11,23 @@ using Avalonia;
|
||||
using Avalonia.Media;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.VisualScripting;
|
||||
|
||||
public class CableViewModel : ActivatableViewModelBase
|
||||
public partial class CableViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly IPin _from;
|
||||
private readonly NodeScriptViewModel _nodeScriptViewModel;
|
||||
private readonly IPin _to;
|
||||
private ObservableAsPropertyHelper<Color>? _cableColor;
|
||||
private ObservableAsPropertyHelper<bool>? _connected;
|
||||
private bool _displayValue;
|
||||
private ObservableAsPropertyHelper<Point>? _fromPoint;
|
||||
|
||||
private PinViewModel? _fromViewModel;
|
||||
private ObservableAsPropertyHelper<Point>? _toPoint;
|
||||
private PinViewModel? _toViewModel;
|
||||
[Notify] private PinViewModel? _fromViewModel;
|
||||
[Notify] private PinViewModel? _toViewModel;
|
||||
[Notify] private bool _displayValue;
|
||||
|
||||
public CableViewModel(NodeScriptViewModel nodeScriptViewModel, IPin from, IPin to, ISettingsService settingsService)
|
||||
{
|
||||
@ -79,28 +79,8 @@ public class CableViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
public PluginSetting<bool> AlwaysShowValues { get; }
|
||||
|
||||
public PinViewModel? FromViewModel
|
||||
{
|
||||
get => _fromViewModel;
|
||||
set => RaiseAndSetIfChanged(ref _fromViewModel, value);
|
||||
}
|
||||
|
||||
public PinViewModel? ToViewModel
|
||||
{
|
||||
get => _toViewModel;
|
||||
set => RaiseAndSetIfChanged(ref _toViewModel, value);
|
||||
}
|
||||
|
||||
public bool DisplayValue
|
||||
{
|
||||
get => _displayValue;
|
||||
set => RaiseAndSetIfChanged(ref _displayValue, value);
|
||||
}
|
||||
|
||||
public bool Connected => _connected?.Value ?? false;
|
||||
public bool IsFirst => _from.ConnectedTo.FirstOrDefault() == _to;
|
||||
|
||||
public Point FromPoint => _fromPoint?.Value ?? new Point();
|
||||
public Point ToPoint => _toPoint?.Value ?? new Point();
|
||||
public Color CableColor => _cableColor?.Value ?? new Color(255, 255, 255, 255);
|
||||
|
||||
@ -3,16 +3,16 @@ using Artemis.Core;
|
||||
using Artemis.UI.Screens.VisualScripting.Pins;
|
||||
using Artemis.UI.Shared;
|
||||
using Avalonia;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.VisualScripting;
|
||||
|
||||
public class DragCableViewModel : ActivatableViewModelBase
|
||||
public partial class DragCableViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private Point _dragPoint;
|
||||
|
||||
private ObservableAsPropertyHelper<Point>? _fromPoint;
|
||||
private ObservableAsPropertyHelper<Point>? _toPoint;
|
||||
[Notify] private Point _dragPoint;
|
||||
|
||||
public DragCableViewModel(PinViewModel pinViewModel)
|
||||
{
|
||||
@ -35,10 +35,4 @@ public class DragCableViewModel : ActivatableViewModelBase
|
||||
public PinViewModel PinViewModel { get; }
|
||||
public Point FromPoint => _fromPoint?.Value ?? new Point(0, 0);
|
||||
public Point ToPoint => _toPoint?.Value ?? new Point(0, 0);
|
||||
|
||||
public Point DragPoint
|
||||
{
|
||||
get => _dragPoint;
|
||||
set => RaiseAndSetIfChanged(ref _dragPoint, value);
|
||||
}
|
||||
}
|
||||
@ -11,20 +11,20 @@ using Artemis.UI.Shared.Services.NodeEditor.Commands;
|
||||
using Avalonia;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.VisualScripting;
|
||||
|
||||
public class NodePickerViewModel : ActivatableViewModelBase
|
||||
public partial class NodePickerViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly INodeEditorService _nodeEditorService;
|
||||
private readonly NodeScript _nodeScript;
|
||||
|
||||
private bool _isVisible;
|
||||
private Point _position;
|
||||
private string? _searchText;
|
||||
private object? _selectedNode;
|
||||
private IPin? _targetPin;
|
||||
[Notify] private bool _isVisible;
|
||||
[Notify] private Point _position;
|
||||
[Notify] private string? _searchText;
|
||||
[Notify] private object? _selectedNode;
|
||||
[Notify] private IPin? _targetPin;
|
||||
|
||||
public NodePickerViewModel(NodeScript nodeScript, INodeService nodeService, INodeEditorService nodeEditorService)
|
||||
{
|
||||
@ -67,37 +67,7 @@ public class NodePickerViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
public ReadOnlyObservableCollection<NodeCategoryViewModel> Categories { get; }
|
||||
|
||||
public bool IsVisible
|
||||
{
|
||||
get => _isVisible;
|
||||
set => RaiseAndSetIfChanged(ref _isVisible, value);
|
||||
}
|
||||
|
||||
public Point Position
|
||||
{
|
||||
get => _position;
|
||||
set => RaiseAndSetIfChanged(ref _position, value);
|
||||
}
|
||||
|
||||
public string? SearchText
|
||||
{
|
||||
get => _searchText;
|
||||
set => RaiseAndSetIfChanged(ref _searchText, value);
|
||||
}
|
||||
|
||||
public IPin? TargetPin
|
||||
{
|
||||
get => _targetPin;
|
||||
set => RaiseAndSetIfChanged(ref _targetPin, value);
|
||||
}
|
||||
|
||||
public object? SelectedNode
|
||||
{
|
||||
get => _selectedNode;
|
||||
set => RaiseAndSetIfChanged(ref _selectedNode, value);
|
||||
}
|
||||
|
||||
|
||||
public void CreateNode(NodeData data)
|
||||
{
|
||||
INode node = data.CreateNode(_nodeScript, null);
|
||||
|
||||
@ -21,11 +21,12 @@ using Avalonia;
|
||||
using Avalonia.Input;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.VisualScripting;
|
||||
|
||||
public class NodeScriptViewModel : ActivatableViewModelBase
|
||||
public partial class NodeScriptViewModel : ActivatableViewModelBase
|
||||
{
|
||||
public const string CLIPBOARD_DATA_FORMAT = "Artemis.Nodes";
|
||||
|
||||
@ -34,11 +35,10 @@ public class NodeScriptViewModel : ActivatableViewModelBase
|
||||
private readonly SourceList<NodeViewModel> _nodeViewModels;
|
||||
private readonly INodeVmFactory _nodeVmFactory;
|
||||
private readonly Subject<Point> _requestedPickerPositionSubject;
|
||||
|
||||
private DragCableViewModel? _dragViewModel;
|
||||
private List<NodeViewModel>? _initialNodeSelection;
|
||||
private Matrix _panMatrix;
|
||||
private Point _pastePosition;
|
||||
[Notify] private DragCableViewModel? _dragViewModel;
|
||||
[Notify] private Matrix _panMatrix;
|
||||
[Notify] private Point _pastePosition;
|
||||
|
||||
public NodeScriptViewModel(NodeScript nodeScript, bool isPreview, INodeVmFactory nodeVmFactory, INodeService nodeService, INodeEditorService nodeEditorService)
|
||||
{
|
||||
@ -111,25 +111,7 @@ public class NodeScriptViewModel : ActivatableViewModelBase
|
||||
public ReactiveCommand<Unit, Unit> DuplicateSelected { get; }
|
||||
public ReactiveCommand<Unit, Unit> CopySelected { get; }
|
||||
public ReactiveCommand<Unit, Unit> PasteSelected { get; }
|
||||
|
||||
public DragCableViewModel? DragViewModel
|
||||
{
|
||||
get => _dragViewModel;
|
||||
set => RaiseAndSetIfChanged(ref _dragViewModel, value);
|
||||
}
|
||||
|
||||
public Matrix PanMatrix
|
||||
{
|
||||
get => _panMatrix;
|
||||
set => RaiseAndSetIfChanged(ref _panMatrix, value);
|
||||
}
|
||||
|
||||
public Point PastePosition
|
||||
{
|
||||
get => _pastePosition;
|
||||
set => RaiseAndSetIfChanged(ref _pastePosition, value);
|
||||
}
|
||||
|
||||
|
||||
public void DeleteSelectedNodes()
|
||||
{
|
||||
List<NodeViewModel> toRemove = NodeViewModels.Where(vm => vm.IsSelected && !vm.Node.IsDefaultNode && !vm.Node.IsExitNode).ToList();
|
||||
|
||||
@ -16,29 +16,28 @@ using Avalonia;
|
||||
using Avalonia.Layout;
|
||||
using DynamicData;
|
||||
using DynamicData.Binding;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.VisualScripting;
|
||||
|
||||
public class NodeViewModel : ActivatableViewModelBase
|
||||
public partial class NodeViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly INodeEditorService _nodeEditorService;
|
||||
private readonly IWindowService _windowService;
|
||||
|
||||
private ICustomNodeViewModel? _customNodeViewModel;
|
||||
private double _dragOffsetX;
|
||||
private double _dragOffsetY;
|
||||
private ObservableAsPropertyHelper<bool>? _hasInputPins;
|
||||
private ObservableAsPropertyHelper<bool>? _hasOutputPins;
|
||||
private bool _isSelected;
|
||||
|
||||
private ObservableAsPropertyHelper<bool>? _isStaticNode;
|
||||
private double _dragOffsetX;
|
||||
private double _dragOffsetY;
|
||||
private double _startX;
|
||||
private double _startY;
|
||||
private bool _displayCustomViewModelAbove;
|
||||
private bool _displayCustomViewModelBetween;
|
||||
private bool _displayCustomViewModelBelow;
|
||||
private VerticalAlignment _customViewModelVerticalAlignment;
|
||||
[Notify] private bool _isSelected;
|
||||
[Notify] private ICustomNodeViewModel? _customNodeViewModel;
|
||||
[Notify] private bool _displayCustomViewModelAbove;
|
||||
[Notify] private bool _displayCustomViewModelBetween;
|
||||
[Notify] private bool _displayCustomViewModelBelow;
|
||||
[Notify] private VerticalAlignment _customViewModelVerticalAlignment;
|
||||
|
||||
public NodeViewModel(NodeScriptViewModel nodeScriptViewModel, INode node, INodeVmFactory nodeVmFactory, INodeEditorService nodeEditorService, IWindowService windowService)
|
||||
{
|
||||
@ -170,43 +169,6 @@ public class NodeViewModel : ActivatableViewModelBase
|
||||
public ReadOnlyObservableCollection<PinViewModel> OutputPinViewModels { get; }
|
||||
public ReadOnlyObservableCollection<PinCollectionViewModel> OutputPinCollectionViewModels { get; }
|
||||
public ReadOnlyObservableCollection<PinViewModel> PinViewModels { get; }
|
||||
|
||||
public bool IsSelected
|
||||
{
|
||||
get => _isSelected;
|
||||
set => RaiseAndSetIfChanged(ref _isSelected, value);
|
||||
}
|
||||
|
||||
public ICustomNodeViewModel? CustomNodeViewModel
|
||||
{
|
||||
get => _customNodeViewModel;
|
||||
set => RaiseAndSetIfChanged(ref _customNodeViewModel, value);
|
||||
}
|
||||
|
||||
public bool DisplayCustomViewModelAbove
|
||||
{
|
||||
get => _displayCustomViewModelAbove;
|
||||
set => RaiseAndSetIfChanged(ref _displayCustomViewModelAbove, value);
|
||||
}
|
||||
|
||||
public bool DisplayCustomViewModelBetween
|
||||
{
|
||||
get => _displayCustomViewModelBetween;
|
||||
set => RaiseAndSetIfChanged(ref _displayCustomViewModelBetween, value);
|
||||
}
|
||||
|
||||
public bool DisplayCustomViewModelBelow
|
||||
{
|
||||
get => _displayCustomViewModelBelow;
|
||||
set => RaiseAndSetIfChanged(ref _displayCustomViewModelBelow, value);
|
||||
}
|
||||
|
||||
public VerticalAlignment CustomViewModelVerticalAlignment
|
||||
{
|
||||
get => _customViewModelVerticalAlignment;
|
||||
set => RaiseAndSetIfChanged(ref _customViewModelVerticalAlignment, value);
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Unit> ShowBrokenState { get; }
|
||||
public ReactiveCommand<Unit, Unit> DeleteNode { get; }
|
||||
|
||||
|
||||
@ -13,17 +13,18 @@ using Artemis.UI.Shared.Services.NodeEditor.Commands;
|
||||
using Avalonia;
|
||||
using Avalonia.Media;
|
||||
using DynamicData;
|
||||
using PropertyChanged.SourceGenerator;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Artemis.UI.Screens.VisualScripting.Pins;
|
||||
|
||||
public abstract class PinViewModel : ActivatableViewModelBase
|
||||
public abstract partial class PinViewModel : ActivatableViewModelBase
|
||||
{
|
||||
private readonly INodeService _nodeService;
|
||||
private Color _darkenedPinColor;
|
||||
private Color _pinColor;
|
||||
private Point _position;
|
||||
private ReactiveCommand<IPin, Unit>? _removePin;
|
||||
[Notify] private Color _darkenedPinColor;
|
||||
[Notify] private Color _pinColor;
|
||||
[Notify] private Point _position;
|
||||
[Notify] private ReactiveCommand<IPin, Unit>? _removePin;
|
||||
|
||||
protected PinViewModel(IPin pin, NodeScriptViewModel nodeScriptViewModel, INodeService nodeService, INodeEditorService nodeEditorService)
|
||||
{
|
||||
@ -49,33 +50,7 @@ public abstract class PinViewModel : ActivatableViewModelBase
|
||||
}
|
||||
|
||||
public IObservableList<IPin> Connections { get; }
|
||||
|
||||
public IPin Pin { get; }
|
||||
|
||||
public Color PinColor
|
||||
{
|
||||
get => _pinColor;
|
||||
set => RaiseAndSetIfChanged(ref _pinColor, value);
|
||||
}
|
||||
|
||||
public Color DarkenedPinColor
|
||||
{
|
||||
get => _darkenedPinColor;
|
||||
set => RaiseAndSetIfChanged(ref _darkenedPinColor, value);
|
||||
}
|
||||
|
||||
public Point Position
|
||||
{
|
||||
get => _position;
|
||||
set => RaiseAndSetIfChanged(ref _position, value);
|
||||
}
|
||||
|
||||
public ReactiveCommand<IPin, Unit>? RemovePin
|
||||
{
|
||||
get => _removePin;
|
||||
set => RaiseAndSetIfChanged(ref _removePin, value);
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Unit> DisconnectPin { get; }
|
||||
|
||||
public bool IsCompatibleWith(PinViewModel pinViewModel)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user