Code cleanup

This commit is contained in:
Robert committed 2020-01-14 17:25:13 +01:00
1 parent c97b479779
commit f071871695
73 files changed
+372 -364

No files matched your search

@@ -14,11 +14,11 @@
d:DataContext="{d:DesignInstance local:LayerPropertiesViewModel}"
behaviors:InputBindingBehavior.PropagateInputBindingsToWindow="True">
<UserControl.InputBindings>
<KeyBinding Command="{s:Action Play}" Key="Space"></KeyBinding>
<KeyBinding Command="{s:Action PlayFromStart}" Modifiers="Shift" Key="Space"></KeyBinding>
<KeyBinding Command="{s:Action Play}" Key="Space" />
<KeyBinding Command="{s:Action PlayFromStart}" Modifiers="Shift" Key="Space" />
</UserControl.InputBindings>
<UserControl.Resources>
<s:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter"/>
<s:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
</UserControl.Resources>
<Grid x:Name="ContainerGrid">
<Grid.RowDefinitions>
@@ -1,5 +1,4 @@
using System.Windows.Controls;
using System.Windows.Input;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
{
@@ -17,13 +16,9 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
private void TimelineScrollChanged(object sender, ScrollChangedEventArgs e)
{
if (sender == TimelineHeaderScrollViewer)
{
TimelineRailsScrollViewer.ScrollToHorizontalOffset(e.HorizontalOffset);
}
else if (sender == TimelineRailsScrollViewer)
{
TimelineHeaderScrollViewer.ScrollToHorizontalOffset(e.HorizontalOffset);
}
}
}
}
@@ -15,7 +15,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties
private readonly IProfileEditorService _profileEditorService;
private bool _keyframesEnabled;
public LayerPropertyViewModel(BaseLayerProperty layerProperty, LayerPropertyViewModel parent, ILayerPropertyViewModelFactory layerPropertyViewModelFactory, IKernel kernel, IProfileEditorService profileEditorService)
public LayerPropertyViewModel(BaseLayerProperty layerProperty, LayerPropertyViewModel parent, ILayerPropertyViewModelFactory layerPropertyViewModelFactory, IKernel kernel,
IProfileEditorService profileEditorService)
{
_kernel = kernel;
_profileEditorService = profileEditorService;
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.UI.Services.Interfaces;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput
@@ -15,7 +15,7 @@
Padding="0 -1"
materialDesign:ValidationAssist.UsePopup="True"
HorizontalAlignment="Left"
Text="{Binding IntInputValue}"/>
Text="{Binding IntInputValue}" />
<TextBlock Margin="5 0 0 0" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
</StackPanel>
</UserControl>
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.UI.Services.Interfaces;
namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Artemis.UI.Exceptions;
using Artemis.UI.Services.Interfaces;
using Stylet;
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.UI.Services.Interfaces;
using PropertyChanged;
using SkiaSharp;
@@ -26,7 +25,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
[DependsOn(nameof(InputValue))]
public float Y
{
get => ((SKPoint?)InputValue)?.Y ?? 0;
get => ((SKPoint?) InputValue)?.Y ?? 0;
set => InputValue = new SKPoint(X, value);
}
@@ -16,7 +16,7 @@
materialDesign:ValidationAssist.UsePopup="True"
HorizontalAlignment="Left"
ToolTip="Height"
Text="{Binding Height}"/>
Text="{Binding Height}" />
<TextBlock Margin="5 0" VerticalAlignment="Bottom">,</TextBlock>
<TextBox Width="60"
Margin="0 2"
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using Artemis.Core.Models.Profile.LayerProperties;
using Artemis.UI.Services.Interfaces;
using PropertyChanged;
using SkiaSharp;
@@ -26,7 +25,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
[DependsOn(nameof(InputValue))]
public float Height
{
get => ((SKSize?)InputValue)?.Height ?? 0;
get => ((SKSize?) InputValue)?.Height ?? 0;
set => InputValue = new SKSize(Width, value);
}
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using Artemis.UI.Services.Interfaces;
using Stylet;
@@ -74,7 +74,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
}
/// <summary>
/// Updates the time line's keyframes
/// Updates the time line's keyframes
/// </summary>
public void Update()
{
@@ -18,7 +18,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
EasingFunction = easingFunction;
Description = easingFunction.Humanize();
CreateGeometry();
}
@@ -21,8 +21,8 @@
</UserControl.Resources>
<UserControl.InputBindings>
<KeyBinding Command="{s:Action Undo}" Modifiers="Control" Key="Z"></KeyBinding>
<KeyBinding Command="{s:Action Redo}" Modifiers="Control" Key="Y"></KeyBinding>
<KeyBinding Command="{s:Action Undo}" Modifiers="Control" Key="Z" />
<KeyBinding Command="{s:Action Redo}" Modifiers="Control" Key="Y" />
</UserControl.InputBindings>
<Grid Margin="16">
@@ -14,8 +14,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
public abstract class TreeItemViewModel : PropertyChangedBase
{
private readonly IDialogService _dialogService;
private readonly ILayerService _layerService;
private readonly IFolderViewModelFactory _folderViewModelFactory;
private readonly ILayerService _layerService;
private readonly ILayerViewModelFactory _layerViewModelFactory;
private readonly IProfileEditorService _profileEditorService;
@@ -122,7 +122,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.ProfileTree.TreeItem
throw new ArtemisUIException("Cannot add a layer to a profile element of type " + ProfileElement.GetType().Name);
var layer = new Layer(ProfileElement.Profile, ProfileElement, "New layer");
foreach (var baseLayerProperty in layer.Properties)
foreach (var baseLayerProperty in layer.Properties)
_layerService.InstantiateKeyframeEngine(baseLayerProperty);
ProfileElement.AddChild(layer);
UpdateProfileElements();
@@ -1,7 +1,6 @@
using System;
using System.Linq;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using Artemis.Core.Models.Profile;
using Artemis.Core.Models.Profile.LayerShapes;
@@ -9,8 +8,6 @@ using Artemis.Core.Models.Surface;
using Artemis.UI.Extensions;
using Artemis.UI.Services.Interfaces;
using RGB.NET.Core;
using SkiaSharp;
using SkiaSharp.Views.WPF;
using Rectangle = Artemis.Core.Models.Profile.LayerShapes.Rectangle;
namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization
@@ -55,7 +55,7 @@
</ListBox.ItemsPanel>
<ListBoxItem ToolTip="Pan over different parts of the surface">
<materialDesign:PackIcon Kind="HandLeft" />
</ListBoxItem>
</ListBoxItem>
<ListBoxItem ToolTip="Edit shape in layer">
<materialDesign:PackIcon Kind="Edit" />
</ListBoxItem>
@@ -171,7 +171,6 @@
</ItemsControl>
</Grid>
<StackPanel ZIndex="1" VerticalAlignment="Bottom" HorizontalAlignment="Left" Margin="10">
<materialDesign:Card Padding="8">
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using System.Windows.Input;
@@ -1,23 +1,21 @@
using System;
using System.Diagnostics.Eventing.Reader;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using Artemis.Core.Models.Profile;
using Artemis.UI.Services.Interfaces;
using SkiaSharp;
using SkiaSharp.Views.WPF;
namespace Artemis.UI.Screens.Module.ProfileEditor.Visualization.Tools
{
public class EditToolViewModel : VisualizationToolViewModel
{
private bool _isDragging;
private double _dragOffsetY;
private double _dragOffsetX;
private Point _dragStart;
private bool _draggingHorizontally;
private bool _draggingVertically;
private double _dragOffsetX;
private double _dragOffsetY;
private Point _dragStart;
private bool _isDragging;
public EditToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService) : base(profileViewModel, profileEditorService)
{