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