Code style - Omit the type in a new expressions

This commit is contained in:
SpoinkyNL committed 2020-12-18 17:54:01 +01:00
1 parent 099f56f4fe
commit 10e6cdc54b
117 files changed
+251 -252

No files matched your search

@@ -74,7 +74,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
}
}
public Thickness LayerPosition => new Thickness(ViewportRectangle.Left, ViewportRectangle.Top, 0, 0);
public Thickness LayerPosition => new(ViewportRectangle.Left, ViewportRectangle.Top, 0, 0);
public bool IsSelected
{
@@ -188,7 +188,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
base.OnInitialActivate();
}
protected override void OnClose()
{
_coreService.FrameRendered -= OnFrameRendered;
@@ -367,13 +367,13 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
{
TimeSpan delta = DateTime.Now - _lastUpdate;
_lastUpdate = DateTime.Now;
if (!AlwaysApplyDataBindings.Value || _profileEditorService.SelectedProfile == null)
if (!AlwaysApplyDataBindings.Value || _profileEditorService.SelectedProfile == null || ((ProfileEditorViewModel) Parent).LayerPropertiesViewModel.Playing)
return;
foreach (IDataBindingRegistration dataBindingRegistration in _profileEditorService.SelectedProfile.GetAllFolders()
.SelectMany(f => f.GetAllLayerProperties(), (f, p) => p)
.SelectMany(p => p.GetAllDataBindingRegistrations()))
.SelectMany(p => p.GetAllDataBindingRegistrations()))
dataBindingRegistration.GetDataBinding()?.UpdateWithDelta(delta);
foreach (IDataBindingRegistration dataBindingRegistration in _profileEditorService.SelectedProfile.GetAllLayers()
.SelectMany(f => f.GetAllLayerProperties(), (f, p) => p)
@@ -420,13 +420,13 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization
{
UpdateCanSelectEditTool();
}
private void TransformValueChanged(object sender, LayerPropertyEventArgs e)
{
if (ActiveToolIndex != 1)
ActivateToolByIndex(1);
}
private void OnSelectedProfileElementUpdated(object sender, EventArgs e)
{
ApplyActiveProfile();
@@ -62,7 +62,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
ShapeAnchor = _layerEditorService.GetLayerAnchorPosition(layer).ToSKPoint();
Execute.PostToUIThread(() =>
{
RectangleGeometry shapeGeometry = new RectangleGeometry(_layerEditorService.GetLayerBounds(layer))
RectangleGeometry shapeGeometry = new(_layerEditorService.GetLayerBounds(layer))
{
Transform = _layerEditorService.GetLayerTransformGroup(layer)
};
@@ -392,12 +392,12 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
private static SKPoint RoundPoint(SKPoint point, int decimals)
{
return new SKPoint((float) Math.Round(point.X, decimals, MidpointRounding.AwayFromZero), (float) Math.Round(point.Y, decimals, MidpointRounding.AwayFromZero));
return new((float) Math.Round(point.X, decimals, MidpointRounding.AwayFromZero), (float) Math.Round(point.Y, decimals, MidpointRounding.AwayFromZero));
}
private static SKPoint[] UnTransformPoints(SKPoint[] skPoints, Layer layer, SKPoint pivot, bool includeScale)
{
using SKPath counterRotatePath = new SKPath();
using SKPath counterRotatePath = new();
counterRotatePath.AddPoly(skPoints, false);
counterRotatePath.Transform(SKMatrix.CreateRotationDegrees(layer.Transform.Rotation.CurrentValue * -1, pivot.X, pivot.Y));
if (includeScale)
@@ -15,7 +15,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
public SelectionRemoveToolViewModel(ProfileViewModel profileViewModel, IProfileEditorService profileEditorService) : base(profileViewModel, profileEditorService)
{
using (MemoryStream stream = new MemoryStream(Resources.aero_pen_min))
using (MemoryStream stream = new(Resources.aero_pen_min))
{
Cursor = new Cursor(stream);
}
@@ -32,7 +32,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
base.MouseUp(sender, e);
Point position = ProfileViewModel.PanZoomViewModel.GetRelativeMousePosition(sender, e);
Rect selectedRect = new Rect(MouseDownStartPosition, position);
Rect selectedRect = new(MouseDownStartPosition, position);
// Get selected LEDs
List<ArtemisLed> selectedLeds = ProfileViewModel.GetLedsInRectangle(selectedRect);
@@ -60,7 +60,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
}
Point position = ProfileViewModel.PanZoomViewModel.GetRelativeMousePosition(sender, e);
Rect selectedRect = new Rect(MouseDownStartPosition, position);
Rect selectedRect = new(MouseDownStartPosition, position);
List<ArtemisLed> selectedLeds = ProfileViewModel.GetLedsInRectangle(selectedRect);
// Unless shift is held down, clear the current selection
@@ -21,7 +21,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
ILayerBrushService layerBrushService) : base(profileViewModel, profileEditorService)
{
_layerBrushService = layerBrushService;
using (MemoryStream stream = new MemoryStream(Resources.aero_crosshair))
using (MemoryStream stream = new(Resources.aero_crosshair))
{
Cursor = new Cursor(stream);
}
@@ -38,7 +38,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
base.MouseUp(sender, e);
Point position = ProfileViewModel.PanZoomViewModel.GetRelativeMousePosition(sender, e);
Rect selectedRect = new Rect(MouseDownStartPosition, position);
Rect selectedRect = new(MouseDownStartPosition, position);
// Get selected LEDs
List<ArtemisLed> selectedLeds = ProfileViewModel.GetLedsInRectangle(selectedRect);
@@ -78,7 +78,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
}
Point position = ProfileViewModel.PanZoomViewModel.GetRelativeMousePosition(sender, e);
Rect selectedRect = new Rect(MouseDownStartPosition, position);
Rect selectedRect = new(MouseDownStartPosition, position);
List<ArtemisLed> selectedLeds = ProfileViewModel.GetLedsInRectangle(selectedRect);
// Unless shift is held down, clear the current selection
@@ -91,7 +91,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.Tools
private void CreateLayer(Folder folder, List<ArtemisLed> selectedLeds)
{
Layer newLayer = new Layer(folder, "New layer");
Layer newLayer = new(folder, "New layer");
LayerBrushDescriptor brush = _layerBrushService.GetDefaultLayerBrush();
if (brush != null)
@@ -161,7 +161,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Visualization.UserControls
private void UpdateControlPosition(UIElement control, SKPoint point1, SKPoint point2)
{
SKPoint point = new SKPoint((point1.X + point2.X) / 2, (point1.Y + point2.Y) / 2);
SKPoint point = new((point1.X + point2.X) / 2, (point1.Y + point2.Y) / 2);
UpdateControlPosition(control, point);
}