Profile editor - Fixed easing options not applying

Device properties - Fixed layout changes not saving
This commit is contained in:
Robert committed 2023-10-06 21:28:02 +02:00
1 parent e866afbfb0
commit f985682e78
8 files changed
+36 -43

No files matched your search

@@ -218,8 +218,7 @@ public class DeviceGeneralTabViewModel : ActivatableViewModelBase
Device.RedScale = RedScale / 100f;
Device.GreenScale = GreenScale / 100f;
Device.BlueScale = BlueScale / 100f;
_renderService.FlushLeds = true;
Device.RgbDevice.Update(true);
}
public void ResetScaling()
@@ -227,6 +226,7 @@ public class DeviceGeneralTabViewModel : ActivatableViewModelBase
RedScale = _initialRedScale * 100;
GreenScale = _initialGreenScale * 100;
BlueScale = _initialBlueScale * 100;
Device.RgbDevice.Update(true);
}
private void OnFrameRendering(object? sender, FrameRenderingEventArgs e)
@@ -37,11 +37,7 @@ public class DeviceLayoutTabViewModel : ActivatableViewModelBase
this.WhenActivated(d =>
{
Device.PropertyChanged += DeviceOnPropertyChanged;
Disposable.Create(() =>
{
Device.PropertyChanged -= DeviceOnPropertyChanged;
}).DisposeWith(d);
Disposable.Create(() => Device.PropertyChanged -= DeviceOnPropertyChanged).DisposeWith(d);
});
}
@@ -51,7 +47,7 @@ public class DeviceLayoutTabViewModel : ActivatableViewModelBase
public string? ImagePath => Device.Layout?.Image?.LocalPath;
public string CustomLayoutPath => Device.CustomLayoutPath;
public string? CustomLayoutPath => Device.CustomLayoutPath;
public bool HasCustomLayout => Device.CustomLayoutPath != null;
@@ -61,6 +57,8 @@ public class DeviceLayoutTabViewModel : ActivatableViewModelBase
_notificationService.CreateNotification()
.WithMessage("Cleared imported layout.")
.WithSeverity(NotificationSeverity.Informational);
_deviceService.SaveDevice(Device);
}
public async Task BrowseCustomLayout()
@@ -77,6 +75,8 @@ public class DeviceLayoutTabViewModel : ActivatableViewModelBase
.WithTitle("Imported layout")
.WithMessage($"File loaded from {files[0]}")
.WithSeverity(NotificationSeverity.Informational);
_deviceService.SaveDevice(Device);
}
}
@@ -153,6 +153,10 @@ public class DeviceLayoutTabViewModel : ActivatableViewModelBase
private void DeviceOnPropertyChanged(object? sender, PropertyChangedEventArgs e)
{
if (e.PropertyName is nameof(Device.CustomLayoutPath) or nameof(Device.DisableDefaultLayout))
{
Task.Run(() => _deviceService.ApplyDeviceLayout(Device, Device.GetBestDeviceLayout()));
this.RaisePropertyChanged(nameof(CustomLayoutPath));
this.RaisePropertyChanged(nameof(HasCustomLayout));
}
}
}