Yeah I can't remember looks like I fixed a bunch of warnings

This commit is contained in:
Robert committed 2022-07-02 14:01:27 +02:00
1 parent 65837e671a
commit a735568c8f
17 files changed
+35 -43

No files matched your search

@@ -23,6 +23,8 @@ public class ProfileTreeView : ReactiveUserControl<ProfileTreeViewModel>
public ProfileTreeView()
{
InitializeComponent();
_treeView = this.Get<TreeView>("ProfileTreeView");
AddHandler(DragDrop.DragEnterEvent, HandleDragEnterEvent, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
AddHandler(DragDrop.DragOverEvent, HandleDragOver, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
AddHandler(PointerEnterEvent, HandlePointerEnter, RoutingStrategies.Direct | RoutingStrategies.Tunnel | RoutingStrategies.Bubble, true);
@@ -116,7 +118,6 @@ public class ProfileTreeView : ReactiveUserControl<ProfileTreeViewModel>
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
_treeView = this.Get<TreeView>("ProfileTreeView");
}
private void ProfileTreeView_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
@@ -10,25 +10,17 @@ namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments;
public class EndSegmentViewModel : TimelineSegmentViewModel
{
private readonly IProfileEditorService _profileEditorService;
private readonly ObservableAsPropertyHelper<double> _width;
private ObservableAsPropertyHelper<double>? _end;
private ObservableAsPropertyHelper<string?>? _endTimestamp;
private TimeSpan _initialLength;
private int _pixelsPerSecond;
private RenderProfileElement? _profileElement;
private ObservableAsPropertyHelper<double>? _start;
private TimeSpan _time;
public EndSegmentViewModel(IProfileEditorService profileEditorService) : base(profileEditorService)
{
_profileEditorService = profileEditorService;
this.WhenActivated(d =>
{
profileEditorService.ProfileElement.Subscribe(p => _profileElement = p).DisposeWith(d);
profileEditorService.Time.Subscribe(t => _time = t).DisposeWith(d);
profileEditorService.PixelsPerSecond.Subscribe(p => _pixelsPerSecond = p).DisposeWith(d);
_start = profileEditorService.ProfileElement
.Select(p => p?.WhenAnyValue(element => element.Timeline.EndSegmentStartPosition) ?? Observable.Never<TimeSpan>())
@@ -10,23 +10,16 @@ namespace Artemis.UI.Screens.ProfileEditor.Properties.Timeline.Segments;
public class StartSegmentViewModel : TimelineSegmentViewModel
{
private readonly IProfileEditorService _profileEditorService;
private readonly ObservableAsPropertyHelper<double> _width;
private ObservableAsPropertyHelper<double>? _end;
private ObservableAsPropertyHelper<string?>? _endTimestamp;
private TimeSpan _initialLength;
private int _pixelsPerSecond;
private RenderProfileElement? _profileElement;
private TimeSpan _time;
public StartSegmentViewModel(IProfileEditorService profileEditorService) : base(profileEditorService)
{
_profileEditorService = profileEditorService;
this.WhenActivated(d =>
{
profileEditorService.ProfileElement.Subscribe(p => _profileElement = p).DisposeWith(d);
profileEditorService.Time.Subscribe(t => _time = t).DisposeWith(d);
profileEditorService.PixelsPerSecond.Subscribe(p => _pixelsPerSecond = p).DisposeWith(d);
_end = profileEditorService.ProfileElement
.Select(p => p?.WhenAnyValue(element => element.Timeline.StartSegmentEndPosition) ?? Observable.Never<TimeSpan>())
@@ -23,7 +23,7 @@ public class TimelineViewModel : ActivatableViewModelBase
{
private readonly IProfileEditorService _profileEditorService;
private ObservableAsPropertyHelper<double>? _caretPosition;
private ObservableAsPropertyHelper<double> _minWidth;
private ObservableAsPropertyHelper<double>? _minWidth;
private List<ITimelineKeyframeViewModel>? _moveKeyframes;
private ObservableAsPropertyHelper<int>? _pixelsPerSecond;
private RenderProfileElement? _profileElement;
@@ -192,7 +192,8 @@ public class TransformToolView : ReactiveUserControl<TransformToolViewModel>
SKPoint position = e.GetCurrentPoint(this).Position.ToSKPoint() - _dragOffset;
ViewModel.UpdateMovement(position, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control));
ToolTip.SetTip((Control) sender, $"X: {ViewModel.Layer.Transform.Position.CurrentValue.X:F3}% Y: {ViewModel.Layer.Transform.Position.CurrentValue.Y:F3}%");
if (sender is Control control)
ToolTip.SetTip(control, $"X: {ViewModel.Layer.Transform.Position.CurrentValue.X:F3}% Y: {ViewModel.Layer.Transform.Position.CurrentValue.Y:F3}%");
e.Handled = true;
}
@@ -236,7 +237,8 @@ public class TransformToolView : ReactiveUserControl<TransformToolViewModel>
SKPoint position = e.GetCurrentPoint(this).Position.ToSKPoint() - _dragOffset;
ViewModel.UpdateAnchorMovement(position, e.KeyModifiers.HasFlag(KeyModifiers.Shift), e.KeyModifiers.HasFlag(KeyModifiers.Control));
ToolTip.SetTip((Control) sender, $"X: {ViewModel.Layer.Transform.AnchorPoint.CurrentValue.X:F3}% Y: {ViewModel.Layer.Transform.AnchorPoint.CurrentValue.Y:F3}%");
if (sender is Control control)
ToolTip.SetTip(control, $"X: {ViewModel.Layer.Transform.AnchorPoint.CurrentValue.X:F3}% Y: {ViewModel.Layer.Transform.AnchorPoint.CurrentValue.Y:F3}%");
e.Handled = true;
}
@@ -366,7 +368,7 @@ public class TransformToolView : ReactiveUserControl<TransformToolViewModel>
private void RotationOnPointerMoved(object? sender, PointerEventArgs e)
{
if (sender == null || !ReferenceEquals(e.Pointer.Captured, sender) || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
if (sender == null || ViewModel == null || !ReferenceEquals(e.Pointer.Captured, sender) || !e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
return;
float angle = CalculateAngleToAnchor(e);
@@ -374,8 +376,8 @@ public class TransformToolView : ReactiveUserControl<TransformToolViewModel>
if (angle < 0)
angle += 360;
ViewModel?.UpdateRotation(angle, e.KeyModifiers.HasFlag(KeyModifiers.Control));
ToolTip.SetTip((Control) sender, $"{ViewModel.Layer.Transform.Rotation.CurrentValue:F3}°");
ViewModel.UpdateRotation(angle, e.KeyModifiers.HasFlag(KeyModifiers.Control));
ToolTip.SetTip((Control) sender, $"{ViewModel.Layer?.Transform.Rotation.CurrentValue:F3}°");
e.Handled = true;
}
@@ -23,7 +23,7 @@ public class VisualEditorViewModel : ActivatableViewModelBase
private readonly IProfileEditorVmFactory _vmFactory;
private ObservableAsPropertyHelper<ProfileConfiguration?>? _profileConfiguration;
private ObservableAsPropertyHelper<bool>? _suspendedEditing;
private ReadOnlyObservableCollection<IToolViewModel> _tools;
private ReadOnlyObservableCollection<IToolViewModel>? _tools;
public VisualEditorViewModel(IProfileEditorService profileEditorService, IRgbService rgbService, IProfileEditorVmFactory vmFactory)
{
@@ -77,7 +77,7 @@ public class VisualEditorViewModel : ActivatableViewModelBase
public ObservableCollection<ArtemisDevice> Devices { get; }
public ReadOnlyObservableCollection<IVisualizerViewModel> Visualizers { get; }
public ReadOnlyObservableCollection<IToolViewModel> Tools
public ReadOnlyObservableCollection<IToolViewModel>? Tools
{
get => _tools;
set => RaiseAndSetIfChanged(ref _tools, value);