Workshop - Offer to apply layout to devices

This commit is contained in:
RobertBeekman committed 2024-01-15 22:21:15 +01:00
1 parent b01c5b16fc
commit 833ab7ac78
7 files changed
+107 -13

No files matched your search

@@ -21,13 +21,12 @@ public partial class ListDeviceViewModel : ViewModelBase
[Notify] private SKColor _color;
[Notify] private bool _isSelected;
public ListDeviceViewModel(ArtemisDevice device, SurfaceEditorViewModel surfaceEditorViewModel, IWindowService windowService, IDeviceService deviceService)
public ListDeviceViewModel(ArtemisDevice device, IWindowService windowService, IDeviceService deviceService)
{
_windowService = windowService;
_deviceService = deviceService;
Device = device;
SurfaceEditorViewModel = surfaceEditorViewModel;
Color = SKColor.FromHsv(Random.NextSingle() * 360, 95, 100);
DetectInput = ReactiveCommand.CreateFromTask(ExecuteDetectInput, this.WhenAnyValue(vm => vm.CanDetectInput));
}
@@ -35,7 +34,6 @@ public partial class ListDeviceViewModel : ViewModelBase
public ReactiveCommand<Unit, Unit> DetectInput { get; }
public ArtemisDevice Device { get; }
public SurfaceEditorViewModel SurfaceEditorViewModel { get; }
public bool CanDetectInput => Device.DeviceType == RGBDeviceType.Keyboard || Device.DeviceType == RGBDeviceType.Mouse;
private async Task ExecuteDetectInput()
@@ -50,7 +50,7 @@ public partial class SurfaceEditorViewModel : RoutableScreen, IMainScreenViewMod
DisplayName = "Surface Editor";
SurfaceDeviceViewModels = new ObservableCollection<SurfaceDeviceViewModel>(deviceService.EnabledDevices.OrderBy(d => d.ZIndex).Select(d => surfaceVmFactory.SurfaceDeviceViewModel(d, this)));
ListDeviceViewModels = new ObservableCollection<ListDeviceViewModel>(deviceService.EnabledDevices.OrderBy(d => d.ZIndex).Select(d => surfaceVmFactory.ListDeviceViewModel(d, this)));
ListDeviceViewModels = new ObservableCollection<ListDeviceViewModel>(deviceService.EnabledDevices.OrderBy(d => d.ZIndex).Select(d => surfaceVmFactory.ListDeviceViewModel(d)));
AutoArrange = ReactiveCommand.CreateFromTask(ExecuteAutoArrange);
IdentifyDevice = ReactiveCommand.Create<ArtemisDevice>(ExecuteIdentifyDevice);
@@ -163,7 +163,7 @@ public partial class SurfaceEditorViewModel : RoutableScreen, IMainScreenViewMod
return;
SurfaceDeviceViewModels.Add(_surfaceVmFactory.SurfaceDeviceViewModel(e.Device, this));
ListDeviceViewModels.Add(_surfaceVmFactory.ListDeviceViewModel(e.Device, this));
ListDeviceViewModels.Add(_surfaceVmFactory.ListDeviceViewModel(e.Device));
SurfaceDeviceViewModels.Sort(l => l.Device.ZIndex * -1);
ListDeviceViewModels.Sort(l => l.Device.ZIndex * -1);
}