diff --git a/src/Artemis.Core/Constants.cs b/src/Artemis.Core/Constants.cs
index caf0a2bad..61a2754e2 100644
--- a/src/Artemis.Core/Constants.cs
+++ b/src/Artemis.Core/Constants.cs
@@ -35,7 +35,7 @@ namespace Artemis.Core
///
/// The plugin info used by core components of Artemis
///
- public static readonly PluginInfo CorePluginInfo = new PluginInfo
+ public static readonly PluginInfo CorePluginInfo = new()
{
Guid = Guid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff"), Name = "Artemis Core", Version = new Version(2, 0)
};
@@ -43,16 +43,16 @@ namespace Artemis.Core
///
/// The plugin used by core components of Artemis
///
- public static readonly Plugin CorePlugin = new Plugin(CorePluginInfo, new DirectoryInfo(ApplicationFolder), null);
+ public static readonly Plugin CorePlugin = new(CorePluginInfo, new DirectoryInfo(ApplicationFolder), null);
- internal static readonly CorePluginFeature CorePluginFeature = new CorePluginFeature {Plugin = CorePlugin};
- internal static readonly EffectPlaceholderPlugin EffectPlaceholderPlugin = new EffectPlaceholderPlugin {Plugin = CorePlugin};
+ internal static readonly CorePluginFeature CorePluginFeature = new() {Plugin = CorePlugin};
+ internal static readonly EffectPlaceholderPlugin EffectPlaceholderPlugin = new() {Plugin = CorePlugin};
- internal static JsonSerializerSettings JsonConvertSettings = new JsonSerializerSettings
+ internal static JsonSerializerSettings JsonConvertSettings = new()
{
Converters = new List {new SKColorConverter(), new ForgivingIntConverter()}
};
- internal static JsonSerializerSettings JsonConvertTypedSettings = new JsonSerializerSettings
+ internal static JsonSerializerSettings JsonConvertTypedSettings = new()
{
TypeNameHandling = TypeNameHandling.All,
Converters = new List { new SKColorConverter(), new ForgivingIntConverter() }
diff --git a/src/Artemis.Core/Extensions/IEnumerableExtensions.cs b/src/Artemis.Core/Extensions/IEnumerableExtensions.cs
index 980240c35..3fe2b8caa 100644
--- a/src/Artemis.Core/Extensions/IEnumerableExtensions.cs
+++ b/src/Artemis.Core/Extensions/IEnumerableExtensions.cs
@@ -84,7 +84,7 @@ namespace Artemis.Core
IEnumerable _()
{
- HashSet knownKeys = new HashSet(comparer);
+ HashSet knownKeys = new(comparer);
foreach (TSource element in source)
{
if (knownKeys.Add(keySelector(element)))
diff --git a/src/Artemis.Core/Extensions/ProcessExtensions.cs b/src/Artemis.Core/Extensions/ProcessExtensions.cs
index 28685d781..8b9ee1213 100644
--- a/src/Artemis.Core/Extensions/ProcessExtensions.cs
+++ b/src/Artemis.Core/Extensions/ProcessExtensions.cs
@@ -19,7 +19,7 @@ namespace Artemis.Core
public static string GetProcessFilename(this Process p)
{
int capacity = 2000;
- StringBuilder builder = new StringBuilder(capacity);
+ StringBuilder builder = new(capacity);
IntPtr ptr = OpenProcess(ProcessAccessFlags.QueryLimitedInformation, false, p.Id);
if (!QueryFullProcessImageName(ptr, 0, builder, ref capacity)) return string.Empty;
diff --git a/src/Artemis.Core/Extensions/RgbDeviceExtensions.cs b/src/Artemis.Core/Extensions/RgbDeviceExtensions.cs
index 1ef6ba8dd..12c6988d4 100644
--- a/src/Artemis.Core/Extensions/RgbDeviceExtensions.cs
+++ b/src/Artemis.Core/Extensions/RgbDeviceExtensions.cs
@@ -8,7 +8,7 @@ namespace Artemis.Core
{
public static string GetDeviceIdentifier(this IRGBDevice rgbDevice)
{
- StringBuilder builder = new StringBuilder();
+ StringBuilder builder = new();
builder.Append(rgbDevice.DeviceInfo.DeviceName);
builder.Append('-');
builder.Append(rgbDevice.DeviceInfo.Manufacturer);
diff --git a/src/Artemis.Core/Extensions/SKColorExtensions.cs b/src/Artemis.Core/Extensions/SKColorExtensions.cs
index 819e09045..dbc14239f 100644
--- a/src/Artemis.Core/Extensions/SKColorExtensions.cs
+++ b/src/Artemis.Core/Extensions/SKColorExtensions.cs
@@ -16,7 +16,7 @@ namespace Artemis.Core
/// The RGB.NET color
public static Color ToRgbColor(this SKColor color)
{
- return new Color(color.Alpha, color.Red, color.Green, color.Blue);
+ return new(color.Alpha, color.Red, color.Green, color.Blue);
}
///
@@ -49,7 +49,7 @@ namespace Artemis.Core
/// The sum of the two colors
public static SKColor Sum(this SKColor a, SKColor b)
{
- return new SKColor(
+ return new(
ClampToByte(a.Red + b.Red),
ClampToByte(a.Green + b.Green),
ClampToByte(a.Blue + b.Blue),
diff --git a/src/Artemis.Core/Extensions/TypeExtensions.cs b/src/Artemis.Core/Extensions/TypeExtensions.cs
index 7bfbc5260..44f851c16 100644
--- a/src/Artemis.Core/Extensions/TypeExtensions.cs
+++ b/src/Artemis.Core/Extensions/TypeExtensions.cs
@@ -11,7 +11,7 @@ namespace Artemis.Core
///
public static class TypeExtensions
{
- private static readonly Dictionary> PrimitiveTypeConversions = new Dictionary>
+ private static readonly Dictionary> PrimitiveTypeConversions = new()
{
{typeof(decimal), new List {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char)}},
{typeof(double), new List {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float)}},
@@ -24,7 +24,7 @@ namespace Artemis.Core
{typeof(short), new List {typeof(byte)}}
};
- private static readonly Dictionary TypeKeywords = new Dictionary
+ private static readonly Dictionary TypeKeywords = new()
{
{typeof(bool), "bool"},
{typeof(byte), "byte"},
diff --git a/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs b/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs
index 0bf2517ea..9f18fa243 100644
--- a/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs
+++ b/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs
@@ -34,7 +34,7 @@ namespace Artemis.Core
return Stops.OrderBy(c => c.Position).Select(c => c.Color).ToArray();
List colors = Stops.OrderBy(c => c.Position).Select(c => c.Color).ToList();
- List result = new List();
+ List result = new();
for (int i = 0; i <= timesToRepeat; i++)
result.AddRange(colors);
@@ -57,7 +57,7 @@ namespace Artemis.Core
// Create stops and a list of divided stops
List stops = Stops.OrderBy(c => c.Position).Select(c => c.Position / (timesToRepeat + 1)).ToList();
- List result = new List();
+ List result = new();
// For each repeat cycle, add the base stops to the end result
for (int i = 0; i <= timesToRepeat; i++)
@@ -120,7 +120,7 @@ namespace Artemis.Core
public static ColorGradient GetUnicornBarf()
{
const int amount = 8;
- ColorGradient gradient = new ColorGradient();
+ ColorGradient gradient = new();
for (int i = 0; i <= amount; i++)
{
diff --git a/src/Artemis.Core/Models/Profile/Conditions/Abstract/DataModelConditionPart.cs b/src/Artemis.Core/Models/Profile/Conditions/Abstract/DataModelConditionPart.cs
index 182e4dc30..abbdfb519 100644
--- a/src/Artemis.Core/Models/Profile/Conditions/Abstract/DataModelConditionPart.cs
+++ b/src/Artemis.Core/Models/Profile/Conditions/Abstract/DataModelConditionPart.cs
@@ -11,7 +11,7 @@ namespace Artemis.Core
///
public abstract class DataModelConditionPart : IDisposable
{
- private readonly List _children = new List();
+ private readonly List _children = new();
///
/// Gets the parent of this part
diff --git a/src/Artemis.Core/Models/Profile/Conditions/DataModelConditionEvent.cs b/src/Artemis.Core/Models/Profile/Conditions/DataModelConditionEvent.cs
index fc3b0967b..49a2a0072 100644
--- a/src/Artemis.Core/Models/Profile/Conditions/DataModelConditionEvent.cs
+++ b/src/Artemis.Core/Models/Profile/Conditions/DataModelConditionEvent.cs
@@ -153,7 +153,7 @@ namespace Artemis.Core
return;
// Ensure the list path is valid and points to a list
- DataModelPath eventPath = new DataModelPath(null, Entity.EventPath);
+ DataModelPath eventPath = new(null, Entity.EventPath);
// Can't check this on an invalid list, if it becomes valid later lets hope for the best
if (eventPath.IsValid && !PointsToEvent(eventPath))
return;
diff --git a/src/Artemis.Core/Models/Profile/Conditions/DataModelConditionList.cs b/src/Artemis.Core/Models/Profile/Conditions/DataModelConditionList.cs
index a7d523f53..9dd05a5e8 100644
--- a/src/Artemis.Core/Models/Profile/Conditions/DataModelConditionList.cs
+++ b/src/Artemis.Core/Models/Profile/Conditions/DataModelConditionList.cs
@@ -177,7 +177,7 @@ namespace Artemis.Core
return;
// Ensure the list path is valid and points to a list
- DataModelPath listPath = new DataModelPath(null, Entity.ListPath);
+ DataModelPath listPath = new(null, Entity.ListPath);
Type listType = listPath.GetPropertyType()!;
// Can't check this on an invalid list, if it becomes valid later lets hope for the best
if (listPath.IsValid && !PointsToList(listPath))
diff --git a/src/Artemis.Core/Models/Profile/DataBindings/Modes/Conditional/ConditionalDataBinding.cs b/src/Artemis.Core/Models/Profile/DataBindings/Modes/Conditional/ConditionalDataBinding.cs
index db98a5b86..96a8a5450 100644
--- a/src/Artemis.Core/Models/Profile/DataBindings/Modes/Conditional/ConditionalDataBinding.cs
+++ b/src/Artemis.Core/Models/Profile/DataBindings/Modes/Conditional/ConditionalDataBinding.cs
@@ -11,7 +11,7 @@ namespace Artemis.Core
///
public class ConditionalDataBinding : IDataBindingMode
{
- private readonly List> _conditions = new List>();
+ private readonly List> _conditions = new();
private bool _disposed;
internal ConditionalDataBinding(DataBinding dataBinding, ConditionalDataBindingEntity entity)
@@ -81,7 +81,7 @@ namespace Artemis.Core
if (_disposed)
throw new ObjectDisposedException("ConditionalDataBinding");
- DataBindingCondition condition = new DataBindingCondition(this);
+ DataBindingCondition condition = new(this);
_conditions.Add(condition);
ApplyOrder();
diff --git a/src/Artemis.Core/Models/Profile/DataBindings/Modes/DirectDataBinding.cs b/src/Artemis.Core/Models/Profile/DataBindings/Modes/DirectDataBinding.cs
index 6dab244f4..0dba4bd45 100644
--- a/src/Artemis.Core/Models/Profile/DataBindings/Modes/DirectDataBinding.cs
+++ b/src/Artemis.Core/Models/Profile/DataBindings/Modes/DirectDataBinding.cs
@@ -10,7 +10,7 @@ namespace Artemis.Core
///
public class DirectDataBinding : IDataBindingMode
{
- private readonly List> _modifiers = new List>();
+ private readonly List> _modifiers = new();
private bool _disposed;
internal DirectDataBinding(DataBinding dataBinding, DirectDataBindingEntity entity)
@@ -156,7 +156,7 @@ namespace Artemis.Core
if (_disposed)
throw new ObjectDisposedException("DirectDataBinding");
- DataBindingModifier modifier = new DataBindingModifier(this, type);
+ DataBindingModifier modifier = new(this, type);
_modifiers.Add(modifier);
ApplyOrder();
diff --git a/src/Artemis.Core/Models/Profile/DataModel/DataModelEvent.cs b/src/Artemis.Core/Models/Profile/DataModel/DataModelEvent.cs
index c9e2c32d8..e4165a125 100644
--- a/src/Artemis.Core/Models/Profile/DataModel/DataModelEvent.cs
+++ b/src/Artemis.Core/Models/Profile/DataModel/DataModelEvent.cs
@@ -47,7 +47,7 @@ namespace Artemis.Core
/// Always empty if is
///
[DataModelProperty(Description = "The arguments of the last time this event triggered")]
- public Queue EventArgumentsHistory { get; } = new Queue(20);
+ public Queue EventArgumentsHistory { get; } = new(20);
///
/// Trigger the event with the given
@@ -157,14 +157,14 @@ namespace Artemis.Core
/// Always empty if is
///
[DataModelProperty(Description = "The arguments of the last time this event triggered")]
- public Queue EventArgumentsHistory { get; } = new Queue(20);
+ public Queue EventArgumentsHistory { get; } = new(20);
///
/// Trigger the event
///
public void Trigger()
{
- DataModelEventArgs eventArgs = new DataModelEventArgs {TriggerTime = DateTime.Now};
+ DataModelEventArgs eventArgs = new() {TriggerTime = DateTime.Now};
LastEventArguments = eventArgs;
LastTrigger = DateTime.Now;
diff --git a/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs b/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs
index 357da89a2..931ba1d02 100644
--- a/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs
+++ b/src/Artemis.Core/Models/Profile/DataModel/DataModelPath.cs
@@ -192,7 +192,7 @@ namespace Artemis.Core
if (Target == null)
return;
- DataModelPathSegment startSegment = new DataModelPathSegment(this, "target", "target");
+ DataModelPathSegment startSegment = new(this, "target", "target");
startSegment.Node = _segments.AddFirst(startSegment);
// On an empty path don't bother processing segments
diff --git a/src/Artemis.Core/Models/Profile/Folder.cs b/src/Artemis.Core/Models/Profile/Folder.cs
index 6b30eb6c5..a69f1d372 100644
--- a/src/Artemis.Core/Models/Profile/Folder.cs
+++ b/src/Artemis.Core/Models/Profile/Folder.cs
@@ -68,7 +68,7 @@ namespace Artemis.Core
///
public override List GetAllLayerProperties()
{
- List result = new List();
+ List result = new();
foreach (BaseLayerEffect layerEffect in LayerEffects)
if (layerEffect.BaseProperties != null)
result.AddRange(layerEffect.BaseProperties.GetAllLayerProperties());
@@ -151,7 +151,7 @@ namespace Artemis.Core
if (Disposed)
throw new ObjectDisposedException("Folder");
- SKPath path = new SKPath {FillType = SKPathFillType.Winding};
+ SKPath path = new() {FillType = SKPathFillType.Winding};
foreach (ProfileElement child in Children)
if (child is RenderProfileElement effectChild && effectChild.Path != null)
path.AddPath(effectChild.Path);
diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs
index 8d6ba6b77..abb71c632 100644
--- a/src/Artemis.Core/Models/Profile/Layer.cs
+++ b/src/Artemis.Core/Models/Profile/Layer.cs
@@ -125,7 +125,7 @@ namespace Artemis.Core
///
public override List GetAllLayerProperties()
{
- List result = new List();
+ List result = new();
result.AddRange(General.GetAllLayerProperties());
result.AddRange(Transform.GetAllLayerProperties());
if (LayerBrush?.BaseProperties != null)
@@ -221,7 +221,7 @@ namespace Artemis.Core
LayerEntity.Leds.Clear();
foreach (ArtemisLed artemisLed in Leds)
{
- LedEntity ledEntity = new LedEntity
+ LedEntity ledEntity = new()
{
DeviceIdentifier = artemisLed.Device.RgbDevice.GetDeviceIdentifier(),
LedName = artemisLed.RgbLed.Id.ToString()
@@ -336,7 +336,7 @@ namespace Artemis.Core
Renderer.Paint.BlendMode = General.BlendMode.CurrentValue;
Renderer.Paint.Color = new SKColor(0, 0, 0, (byte) (Transform.Opacity.CurrentValue * 2.55f));
- using SKPath renderPath = new SKPath();
+ using SKPath renderPath = new();
if (General.ShapeType.CurrentValue == LayerShapeType.Rectangle)
renderPath.AddRect(Renderer.Path.Bounds);
else
@@ -415,7 +415,7 @@ namespace Artemis.Core
}
else
{
- SKPath path = new SKPath {FillType = SKPathFillType.Winding};
+ SKPath path = new() {FillType = SKPathFillType.Winding};
foreach (ArtemisLed artemisLed in Leds)
path.AddRect(artemisLed.AbsoluteRectangle);
@@ -569,7 +569,7 @@ namespace Artemis.Core
if (Disposed)
throw new ObjectDisposedException("Layer");
- List leds = new List();
+ List leds = new();
// Get the surface LEDs for this layer
List availableLeds = surface.Devices.SelectMany(d => d.Leds).ToList();
diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
index 6ccb85428..362b93b37 100644
--- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
+++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs
@@ -292,7 +292,7 @@ namespace Artemis.Core
if (value == null)
return null;
- LayerPropertyKeyframe keyframe = new LayerPropertyKeyframe(
+ LayerPropertyKeyframe keyframe = new(
CoreJson.DeserializeObject(keyframeEntity.Value)!, keyframeEntity.Position, (Easings.Functions) keyframeEntity.EasingFunction, this
);
AddKeyframe(keyframe);
@@ -366,9 +366,9 @@ namespace Artemis.Core
#region Data bindings
// ReSharper disable InconsistentNaming
- internal readonly List _dataBindingRegistrations = new List();
+ internal readonly List _dataBindingRegistrations = new();
- internal readonly List _dataBindings = new List();
+ internal readonly List _dataBindings = new();
// ReSharper restore InconsistentNaming
///
@@ -444,7 +444,7 @@ namespace Artemis.Core
if (dataBindingRegistration.DataBinding != null)
throw new ArtemisCoreException("Provided data binding registration already has an enabled data binding");
- DataBinding dataBinding = new DataBinding(dataBindingRegistration);
+ DataBinding dataBinding = new(dataBindingRegistration);
_dataBindings.Add(dataBinding);
OnDataBindingEnabled(new LayerPropertyEventArgs(dataBinding.LayerProperty));
diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerPropertyKeyFrame.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerPropertyKeyFrame.cs
index 299c0638e..a7cd776a6 100644
--- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerPropertyKeyFrame.cs
+++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerPropertyKeyFrame.cs
@@ -66,7 +66,7 @@ namespace Artemis.Core
///
public KeyframeEntity GetKeyframeEntity()
{
- return new KeyframeEntity
+ return new()
{
Value = CoreJson.SerializeObject(Value),
Position = Position,
diff --git a/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs b/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs
index b82052a89..ebc09376a 100644
--- a/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs
+++ b/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs
@@ -113,7 +113,7 @@ namespace Artemis.Core
if (!PropertiesInitialized)
return new List();
- List result = new List(LayerProperties);
+ List result = new(LayerProperties);
foreach (LayerPropertyGroup layerPropertyGroup in LayerPropertyGroups)
result.AddRange(layerPropertyGroup.GetAllLayerProperties());
diff --git a/src/Artemis.Core/Models/Profile/LayerShapes/EllipseShape.cs b/src/Artemis.Core/Models/Profile/LayerShapes/EllipseShape.cs
index 8e74af7b7..766837492 100644
--- a/src/Artemis.Core/Models/Profile/LayerShapes/EllipseShape.cs
+++ b/src/Artemis.Core/Models/Profile/LayerShapes/EllipseShape.cs
@@ -14,7 +14,7 @@ namespace Artemis.Core
///
public override void CalculateRenderProperties()
{
- SKPath path = new SKPath();
+ SKPath path = new();
path.AddOval(SKRect.Create(Layer.Bounds.Width, Layer.Bounds.Height));
Path = path;
}
diff --git a/src/Artemis.Core/Models/Profile/LayerShapes/RectangleShape.cs b/src/Artemis.Core/Models/Profile/LayerShapes/RectangleShape.cs
index 9a737a6f8..93a2006a1 100644
--- a/src/Artemis.Core/Models/Profile/LayerShapes/RectangleShape.cs
+++ b/src/Artemis.Core/Models/Profile/LayerShapes/RectangleShape.cs
@@ -14,7 +14,7 @@ namespace Artemis.Core
///
public override void CalculateRenderProperties()
{
- SKPath path = new SKPath();
+ SKPath path = new();
path.AddRect(SKRect.Create(Layer.Bounds.Width, Layer.Bounds.Height));
Path = path;
}
diff --git a/src/Artemis.Core/Models/Profile/Profile.cs b/src/Artemis.Core/Models/Profile/Profile.cs
index 51c47682a..28ee0ac5a 100644
--- a/src/Artemis.Core/Models/Profile/Profile.cs
+++ b/src/Artemis.Core/Models/Profile/Profile.cs
@@ -12,7 +12,7 @@ namespace Artemis.Core
///
public sealed class Profile : ProfileElement
{
- private readonly object _lock = new object();
+ private readonly object _lock = new();
private bool _isActivated;
internal Profile(ProfileModule module, string name) : base(null!)
@@ -26,7 +26,7 @@ namespace Artemis.Core
UndoStack = new Stack();
RedoStack = new Stack();
- Folder _ = new Folder(this, "Root folder");
+ Folder _ = new(this, "Root folder");
Save();
}
@@ -168,7 +168,7 @@ namespace Artemis.Core
FolderEntity? rootFolder = ProfileEntity.Folders.FirstOrDefault(f => f.ParentId == EntityId);
if (rootFolder == null)
{
- Folder _ = new Folder(this, "Root folder");
+ Folder _ = new(this, "Root folder");
}
else
{
diff --git a/src/Artemis.Core/Models/Profile/ProfileElement.cs b/src/Artemis.Core/Models/Profile/ProfileElement.cs
index 87e8574b2..086a27886 100644
--- a/src/Artemis.Core/Models/Profile/ProfileElement.cs
+++ b/src/Artemis.Core/Models/Profile/ProfileElement.cs
@@ -189,7 +189,7 @@ namespace Artemis.Core
if (Disposed)
throw new ObjectDisposedException(GetType().Name);
- List folders = new List();
+ List folders = new();
foreach (Folder childFolder in Children.Where(c => c is Folder).Cast())
{
// Add all folders in this element
@@ -210,7 +210,7 @@ namespace Artemis.Core
if (Disposed)
throw new ObjectDisposedException(GetType().Name);
- List layers = new List();
+ List layers = new();
// Add all layers in this element
layers.AddRange(Children.Where(c => c is Layer).Cast());
diff --git a/src/Artemis.Core/Models/Profile/RenderProfileElement.cs b/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
index fc9e59ba2..7af947574 100644
--- a/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
+++ b/src/Artemis.Core/Models/Profile/RenderProfileElement.cs
@@ -67,7 +67,7 @@ namespace Artemis.Core
RenderElementEntity.LayerEffects.Clear();
foreach (BaseLayerEffect layerEffect in LayerEffects)
{
- LayerEffectEntity layerEffectEntity = new LayerEffectEntity
+ LayerEffectEntity layerEffectEntity = new()
{
Id = layerEffect.EntityId,
ProviderId = layerEffect.Descriptor?.PlaceholderFor ?? layerEffect.ProviderId,
@@ -208,7 +208,7 @@ namespace Artemis.Core
if (descriptor == null)
throw new ArgumentNullException(nameof(descriptor));
- LayerEffectEntity entity = new LayerEffectEntity
+ LayerEffectEntity entity = new()
{
Id = Guid.NewGuid(),
Enabled = true,
diff --git a/src/Artemis.Core/Models/Profile/Timeline.cs b/src/Artemis.Core/Models/Profile/Timeline.cs
index de8065ca7..727ef3109 100644
--- a/src/Artemis.Core/Models/Profile/Timeline.cs
+++ b/src/Artemis.Core/Models/Profile/Timeline.cs
@@ -12,7 +12,7 @@ namespace Artemis.Core
public class Timeline : CorePropertyChanged, IStorageModel
{
private const int MaxExtraTimelines = 15;
- private readonly object _lock = new object();
+ private readonly object _lock = new();
///
/// Creates a new instance of the class
diff --git a/src/Artemis.Core/Models/Surface/ArtemisDevice.cs b/src/Artemis.Core/Models/Surface/ArtemisDevice.cs
index 4bac85052..732b5c08b 100644
--- a/src/Artemis.Core/Models/Surface/ArtemisDevice.cs
+++ b/src/Artemis.Core/Models/Surface/ArtemisDevice.cs
@@ -288,7 +288,7 @@ namespace Artemis.Core
foreach (ArtemisLed led in Leds)
led.CalculateRectangles();
- SKPath path = new SKPath {FillType = SKPathFillType.Winding};
+ SKPath path = new() {FillType = SKPathFillType.Winding};
foreach (ArtemisLed artemisLed in Leds)
path.AddRect(artemisLed.AbsoluteRectangle);
diff --git a/src/Artemis.Core/Models/Surface/ArtemisSurface.cs b/src/Artemis.Core/Models/Surface/ArtemisSurface.cs
index ffb574f7e..58af700eb 100644
--- a/src/Artemis.Core/Models/Surface/ArtemisSurface.cs
+++ b/src/Artemis.Core/Models/Surface/ArtemisSurface.cs
@@ -12,8 +12,8 @@ namespace Artemis.Core
///
public class ArtemisSurface : CorePropertyChanged
{
- private List _devices = new List();
- private ReadOnlyDictionary _ledMap = new ReadOnlyDictionary(new Dictionary());
+ private List _devices = new();
+ private ReadOnlyDictionary _ledMap = new(new Dictionary());
private bool _isActive;
private string _name;
diff --git a/src/Artemis.Core/Ninject/LoggerProvider.cs b/src/Artemis.Core/Ninject/LoggerProvider.cs
index e39a4a434..8a944fe26 100644
--- a/src/Artemis.Core/Ninject/LoggerProvider.cs
+++ b/src/Artemis.Core/Ninject/LoggerProvider.cs
@@ -8,7 +8,7 @@ namespace Artemis.Core.Ninject
{
internal class LoggerProvider : Provider
{
- internal static readonly LoggingLevelSwitch LoggingLevelSwitch = new LoggingLevelSwitch(LogEventLevel.Verbose);
+ internal static readonly LoggingLevelSwitch LoggingLevelSwitch = new(LogEventLevel.Verbose);
private static readonly ILogger Logger = new LoggerConfiguration()
.Enrich.FromLogContext()
diff --git a/src/Artemis.Core/Ninject/PluginSettingsProvider.cs b/src/Artemis.Core/Ninject/PluginSettingsProvider.cs
index 66b707460..878180ee1 100644
--- a/src/Artemis.Core/Ninject/PluginSettingsProvider.cs
+++ b/src/Artemis.Core/Ninject/PluginSettingsProvider.cs
@@ -9,7 +9,7 @@ namespace Artemis.Core.Ninject
// TODO: Investigate if this can't just be set as a constant on the plugin child kernel
internal class PluginSettingsProvider : Provider
{
- private static readonly List PluginSettings = new List();
+ private static readonly List PluginSettings = new();
private readonly IPluginRepository _pluginRepository;
private readonly IPluginManagementService _pluginManagementService;
@@ -41,7 +41,7 @@ namespace Artemis.Core.Ninject
if (existingSettings != null)
return existingSettings;
- PluginSettings? settings = new PluginSettings(plugin, _pluginRepository);
+ PluginSettings? settings = new(plugin, _pluginRepository);
PluginSettings.Add(settings);
return settings;
}
diff --git a/src/Artemis.Core/Plugins/DataModelExpansions/DataModel.cs b/src/Artemis.Core/Plugins/DataModelExpansions/DataModel.cs
index 3377bb081..27418f2d1 100644
--- a/src/Artemis.Core/Plugins/DataModelExpansions/DataModel.cs
+++ b/src/Artemis.Core/Plugins/DataModelExpansions/DataModel.cs
@@ -13,7 +13,7 @@ namespace Artemis.Core.DataModelExpansions
///
public abstract class DataModel
{
- private readonly Dictionary _dynamicDataModels = new Dictionary();
+ private readonly Dictionary _dynamicDataModels = new();
///
/// Creates a new instance of the class
@@ -47,7 +47,7 @@ namespace Artemis.Core.DataModelExpansions
/// Gets an read-only dictionary of all dynamic data models
///
[DataModelIgnore]
- public ReadOnlyDictionary DynamicDataModels => new ReadOnlyDictionary(_dynamicDataModels);
+ public ReadOnlyDictionary DynamicDataModels => new(_dynamicDataModels);
///
/// Returns a read-only collection of all properties in this datamodel that are to be ignored
diff --git a/src/Artemis.Core/Plugins/DataModelExpansions/Internal/BaseDataModelExpansion.cs b/src/Artemis.Core/Plugins/DataModelExpansions/Internal/BaseDataModelExpansion.cs
index d11c81bd7..1c3397ef4 100644
--- a/src/Artemis.Core/Plugins/DataModelExpansions/Internal/BaseDataModelExpansion.cs
+++ b/src/Artemis.Core/Plugins/DataModelExpansions/Internal/BaseDataModelExpansion.cs
@@ -13,7 +13,7 @@ namespace Artemis.Core.DataModelExpansions
///
/// Gets a list of all properties ignored at runtime using IgnoreProperty(x => x.y)
///
- protected internal readonly List HiddenPropertiesList = new List();
+ protected internal readonly List HiddenPropertiesList = new();
///
/// Gets a list of all properties ignored at runtime using IgnoreProperty(x => x.y)
@@ -41,7 +41,7 @@ namespace Artemis.Core.DataModelExpansions
///
public virtual DataModelPropertyAttribute GetDataModelDescription()
{
- return new DataModelPropertyAttribute {Name = Plugin.Info.Name, Description = Plugin.Info.Description};
+ return new() {Name = Plugin.Info.Name, Description = Plugin.Info.Description};
}
}
}
\ No newline at end of file
diff --git a/src/Artemis.Core/Plugins/DeviceProviders/DeviceProvider.cs b/src/Artemis.Core/Plugins/DeviceProviders/DeviceProvider.cs
index 06b465cc6..84b276192 100644
--- a/src/Artemis.Core/Plugins/DeviceProviders/DeviceProvider.cs
+++ b/src/Artemis.Core/Plugins/DeviceProviders/DeviceProvider.cs
@@ -34,7 +34,7 @@ namespace Artemis.Core.DeviceProviders
[Inject]
public ILogger? Logger { get; set; }
- internal Dictionary DeviceLayoutPaths { get; set; } = new Dictionary();
+ internal Dictionary DeviceLayoutPaths { get; set; } = new();
///
public override void Disable()
diff --git a/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs b/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs
index 9b83b0b6b..d99011fe3 100644
--- a/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs
+++ b/src/Artemis.Core/Plugins/LayerBrushes/LayerBrushProvider.cs
@@ -41,7 +41,7 @@ namespace Artemis.Core.LayerBrushes
if (!IsEnabled)
throw new ArtemisPluginException(Plugin, "Can only add a layer brush descriptor when the plugin is enabled");
- LayerBrushDescriptor descriptor = new LayerBrushDescriptor(displayName, description, icon, typeof(T), this);
+ LayerBrushDescriptor descriptor = new(displayName, description, icon, typeof(T), this);
_layerBrushDescriptors.Add(descriptor);
LayerBrushStore.Add(descriptor);
}
diff --git a/src/Artemis.Core/Plugins/LayerBrushes/PerLedLayerBrush.cs b/src/Artemis.Core/Plugins/LayerBrushes/PerLedLayerBrush.cs
index 1fecd1b4f..bb48793e6 100644
--- a/src/Artemis.Core/Plugins/LayerBrushes/PerLedLayerBrush.cs
+++ b/src/Artemis.Core/Plugins/LayerBrushes/PerLedLayerBrush.cs
@@ -34,8 +34,8 @@ namespace Artemis.Core.LayerBrushes
if (Layer.General.TransformMode.CurrentValue == LayerTransformMode.Normal && SupportsTransformation)
canvas.SetMatrix(canvas.TotalMatrix.PreConcat(Layer.GetTransformMatrix(true, false, false, true).Invert()));
- using SKPath pointsPath = new SKPath();
- using SKPaint ledPaint = new SKPaint();
+ using SKPath pointsPath = new();
+ using SKPaint ledPaint = new();
foreach (ArtemisLed artemisLed in Layer.Leds)
{
pointsPath.AddPoly(new[]
diff --git a/src/Artemis.Core/Plugins/LayerEffects/LayerEffectDescriptor.cs b/src/Artemis.Core/Plugins/LayerEffects/LayerEffectDescriptor.cs
index 0b742742a..13f66a592 100644
--- a/src/Artemis.Core/Plugins/LayerEffects/LayerEffectDescriptor.cs
+++ b/src/Artemis.Core/Plugins/LayerEffects/LayerEffectDescriptor.cs
@@ -87,7 +87,7 @@ namespace Artemis.Core.LayerEffects
{
if (PlaceholderFor == null)
throw new ArtemisCoreException("Cannot create a placeholder instance using a layer effect descriptor that is not a placeholder for anything");
- PlaceholderLayerEffect effect = new PlaceholderLayerEffect(entity, PlaceholderFor)
+ PlaceholderLayerEffect effect = new(entity, PlaceholderFor)
{
ProfileElement = renderElement,
Descriptor = this
diff --git a/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs b/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs
index 7de03159e..28eadf5c9 100644
--- a/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs
+++ b/src/Artemis.Core/Plugins/LayerEffects/LayerEffectProvider.cs
@@ -41,7 +41,7 @@ namespace Artemis.Core.LayerEffects
if (!IsEnabled)
throw new ArtemisPluginFeatureException(this, "Can only add a layer effect descriptor when the plugin is enabled");
- LayerEffectDescriptor descriptor = new LayerEffectDescriptor(displayName, description, icon, typeof(T), this);
+ LayerEffectDescriptor descriptor = new(displayName, description, icon, typeof(T), this);
_layerEffectDescriptors.Add(descriptor);
LayerEffectStore.Add(descriptor);
}
diff --git a/src/Artemis.Core/Plugins/LayerEffects/Placeholder/PlaceholderLayerEffectDescriptor.cs b/src/Artemis.Core/Plugins/LayerEffects/Placeholder/PlaceholderLayerEffectDescriptor.cs
index 762c187d6..374340bb1 100644
--- a/src/Artemis.Core/Plugins/LayerEffects/Placeholder/PlaceholderLayerEffectDescriptor.cs
+++ b/src/Artemis.Core/Plugins/LayerEffects/Placeholder/PlaceholderLayerEffectDescriptor.cs
@@ -4,7 +4,7 @@
{
public static LayerEffectDescriptor Create(string missingProviderId)
{
- LayerEffectDescriptor descriptor = new LayerEffectDescriptor("Missing effect", "This effect could not be loaded", "FileQuestion", null, Constants.EffectPlaceholderPlugin)
+ LayerEffectDescriptor descriptor = new("Missing effect", "This effect could not be loaded", "FileQuestion", null, Constants.EffectPlaceholderPlugin)
{
PlaceholderFor = missingProviderId
};
diff --git a/src/Artemis.Core/Plugins/Modules/Module.cs b/src/Artemis.Core/Plugins/Modules/Module.cs
index 88a194349..99a7b5980 100644
--- a/src/Artemis.Core/Plugins/Modules/Module.cs
+++ b/src/Artemis.Core/Plugins/Modules/Module.cs
@@ -42,7 +42,7 @@ namespace Artemis.Core.Modules
///
public virtual DataModelPropertyAttribute GetDataModelDescription()
{
- return new DataModelPropertyAttribute {Name = Plugin.Info.Name, Description = Plugin.Info.Description};
+ return new() {Name = Plugin.Info.Name, Description = Plugin.Info.Description};
}
internal override void InternalEnable()
@@ -98,7 +98,7 @@ namespace Artemis.Core.Modules
/// A list of activation requirements
/// Note: if empty the module is always activated
///
- public List ActivationRequirements { get; } = new List();
+ public List ActivationRequirements { get; } = new();
///
/// Gets or sets the activation requirement mode, defaults to
diff --git a/src/Artemis.Core/Plugins/Modules/ProfileModule.cs b/src/Artemis.Core/Plugins/Modules/ProfileModule.cs
index 945521491..6571d4c89 100644
--- a/src/Artemis.Core/Plugins/Modules/ProfileModule.cs
+++ b/src/Artemis.Core/Plugins/Modules/ProfileModule.cs
@@ -46,7 +46,7 @@ namespace Artemis.Core.Modules
///
public virtual DataModelPropertyAttribute GetDataModelDescription()
{
- return new DataModelPropertyAttribute {Name = Plugin.Info.Name, Description = Plugin.Info.Description};
+ return new() {Name = Plugin.Info.Name, Description = Plugin.Info.Description};
}
///
@@ -94,8 +94,8 @@ namespace Artemis.Core.Modules
///
/// Gets a list of all properties ignored at runtime using IgnoreProperty(x => x.y)
///
- protected internal readonly List HiddenPropertiesList = new List();
- private readonly object _lock = new object();
+ protected internal readonly List HiddenPropertiesList = new();
+ private readonly object _lock = new();
///
/// Creates a new instance of the class
diff --git a/src/Artemis.Core/Plugins/Settings/PluginSettings.cs b/src/Artemis.Core/Plugins/Settings/PluginSettings.cs
index df940d21c..03ee46316 100644
--- a/src/Artemis.Core/Plugins/Settings/PluginSettings.cs
+++ b/src/Artemis.Core/Plugins/Settings/PluginSettings.cs
@@ -54,7 +54,7 @@ namespace Artemis.Core
_pluginRepository.AddSetting(settingEntity);
}
- PluginSetting pluginSetting = new PluginSetting(Plugin, _pluginRepository, settingEntity);
+ PluginSetting pluginSetting = new(Plugin, _pluginRepository, settingEntity);
// This overrides null with the default value, I'm not sure if that's desirable because you
// might expect something to go null and you might not
diff --git a/src/Artemis.Core/Plugins/TimedUpdateRegistration.cs b/src/Artemis.Core/Plugins/TimedUpdateRegistration.cs
index 1297f6a71..0131f8a58 100644
--- a/src/Artemis.Core/Plugins/TimedUpdateRegistration.cs
+++ b/src/Artemis.Core/Plugins/TimedUpdateRegistration.cs
@@ -13,7 +13,7 @@ namespace Artemis.Core
private DateTime _lastEvent;
private Timer? _timer;
private bool _disposed;
- private readonly object _lock = new object();
+ private readonly object _lock = new();
internal TimedUpdateRegistration(PluginFeature feature, TimeSpan interval, Action action)
{
diff --git a/src/Artemis.Core/RGB.NET/BitmapBrush.cs b/src/Artemis.Core/RGB.NET/BitmapBrush.cs
index 9508e8c97..59814336e 100644
--- a/src/Artemis.Core/RGB.NET/BitmapBrush.cs
+++ b/src/Artemis.Core/RGB.NET/BitmapBrush.cs
@@ -45,7 +45,7 @@ namespace Artemis.Core
public Rectangle RenderedRectangle { get; private set; }
///
- public Dictionary RenderedTargets { get; } = new Dictionary();
+ public Dictionary RenderedTargets { get; } = new();
///
/// Gets or sets the desired scale of the bitmap brush
@@ -155,7 +155,7 @@ namespace Artemis.Core
}
}
- Color pixel = new Color(a / sampleSize, r / sampleSize, g / sampleSize, b / sampleSize);
+ Color pixel = new(a / sampleSize, r / sampleSize, g / sampleSize, b / sampleSize);
ArtemisDevice? artemisDevice = Surface?.GetArtemisLed(renderTarget.Led)?.Device;
if (artemisDevice is not null)
diff --git a/src/Artemis.Core/Services/ColorQuantizer/ColorQuantizerService.cs b/src/Artemis.Core/Services/ColorQuantizer/ColorQuantizerService.cs
index 394811006..4fe7d22c4 100644
--- a/src/Artemis.Core/Services/ColorQuantizer/ColorQuantizerService.cs
+++ b/src/Artemis.Core/Services/ColorQuantizer/ColorQuantizerService.cs
@@ -29,7 +29,7 @@ namespace Artemis.Core.Services
if ((amount & (amount - 1)) != 0)
throw new ArgumentException("Must be power of two", nameof(amount));
- Queue cubes = new Queue(amount);
+ Queue cubes = new(amount);
cubes.Enqueue(new ColorCube(colors));
while (cubes.Count < amount)
diff --git a/src/Artemis.Core/Services/CoreService.cs b/src/Artemis.Core/Services/CoreService.cs
index 1f5ff5f18..bede4f4b6 100644
--- a/src/Artemis.Core/Services/CoreService.cs
+++ b/src/Artemis.Core/Services/CoreService.cs
@@ -32,10 +32,10 @@ namespace Artemis.Core.Services
private readonly PluginSetting _renderScale;
private readonly IRgbService _rgbService;
private readonly ISurfaceService _surfaceService;
- private readonly List _updateExceptions = new List();
- private List _dataModelExpansions = new List();
+ private readonly List _updateExceptions = new();
+ private List _dataModelExpansions = new();
private DateTime _lastExceptionLog;
- private List _modules = new List();
+ private List _modules = new();
// ReSharper disable UnusedParameter.Local - Storage migration and module service are injected early to ensure it runs before anything else
public CoreService(IKernel kernel, ILogger logger, StorageMigrationService _, ISettingsService settingsService, IPluginManagementService pluginManagementService,
@@ -112,7 +112,7 @@ namespace Artemis.Core.Services
public void PlayIntroAnimation()
{
- IntroAnimation intro = new IntroAnimation(_logger, _profileService, _surfaceService);
+ IntroAnimation intro = new(_logger, _profileService, _surfaceService);
// Draw a white overlay over the device
void DrawOverlay(object? sender, FrameRenderingEventArgs args)
@@ -183,7 +183,7 @@ namespace Artemis.Core.Services
return;
// Render all active modules
- using SKCanvas canvas = new SKCanvas(_rgbService.BitmapBrush.Bitmap);
+ using SKCanvas canvas = new(_rgbService.BitmapBrush.Bitmap);
canvas.Scale((float) _renderScale.Value);
canvas.Clear(new SKColor(0, 0, 0));
if (!ModuleRenderingDisabled)
diff --git a/src/Artemis.Core/Services/DeviceService.cs b/src/Artemis.Core/Services/DeviceService.cs
index 9952212a7..48c64a50f 100644
--- a/src/Artemis.Core/Services/DeviceService.cs
+++ b/src/Artemis.Core/Services/DeviceService.cs
@@ -16,7 +16,7 @@ namespace Artemis.Core.Services
private void BlinkDevice(ArtemisDevice device, int blinkCount)
{
// Create a LED group way at the top
- ListLedGroup ledGroup = new ListLedGroup(device.Leds.Select(l => l.RgbLed))
+ ListLedGroup ledGroup = new(device.Leds.Select(l => l.RgbLed))
{
Brush = new SolidColorBrush(new Color(255, 255, 255)),
ZIndex = 999
diff --git a/src/Artemis.Core/Services/Input/InputKeyLedIdMap.cs b/src/Artemis.Core/Services/Input/InputKeyLedIdMap.cs
index dc485e69c..ad67b1a92 100644
--- a/src/Artemis.Core/Services/Input/InputKeyLedIdMap.cs
+++ b/src/Artemis.Core/Services/Input/InputKeyLedIdMap.cs
@@ -5,7 +5,7 @@ namespace Artemis.Core.Services
{
internal static class InputKeyUtilities
{
- internal static readonly Dictionary KeyboardKeyLedIdMap = new Dictionary
+ internal static readonly Dictionary KeyboardKeyLedIdMap = new()
{
{KeyboardKey.None, LedId.Keyboard_Custom1},
{KeyboardKey.Cancel, LedId.Keyboard_Custom2},
@@ -182,7 +182,7 @@ namespace Artemis.Core.Services
{KeyboardKey.NumPadEnter, LedId.Keyboard_NumEnter}
};
- internal static readonly Dictionary MouseButtonLedIdMap = new Dictionary
+ internal static readonly Dictionary MouseButtonLedIdMap = new()
{
{MouseButton.Left, LedId.Mouse1},
{MouseButton.Middle, LedId.Mouse2},
diff --git a/src/Artemis.Core/Services/Input/InputService.cs b/src/Artemis.Core/Services/Input/InputService.cs
index 88112ea9a..fa280e4a3 100644
--- a/src/Artemis.Core/Services/Input/InputService.cs
+++ b/src/Artemis.Core/Services/Input/InputService.cs
@@ -34,7 +34,7 @@ namespace Artemis.Core.Services
#region Providers
- private readonly List _inputProviders = new List();
+ private readonly List _inputProviders = new();
public void AddInputProvider(InputProvider inputProvider)
{
@@ -63,8 +63,8 @@ namespace Artemis.Core.Services
#region Identification
- private readonly Dictionary, ArtemisDevice> _deviceCache = new Dictionary, ArtemisDevice>();
- private List _devices = new List();
+ private readonly Dictionary, ArtemisDevice> _deviceCache = new();
+ private List _devices = new();
private ArtemisDevice? _cachedFallbackKeyboard;
private ArtemisDevice? _cachedFallbackMouse;
private ArtemisDevice? _identifyingDevice;
@@ -180,8 +180,8 @@ namespace Artemis.Core.Services
#region Keyboard
- private readonly Dictionary> _pressedKeys = new Dictionary>();
- private readonly Dictionary _keyboardModifier = new Dictionary();
+ private readonly Dictionary> _pressedKeys = new();
+ private readonly Dictionary _keyboardModifier = new();
private KeyboardModifierKey _globalModifiers;
private void InputProviderOnKeyboardDataReceived(object? sender, InputProviderKeyboardEventArgs e)
@@ -199,7 +199,7 @@ namespace Artemis.Core.Services
led = e.Device.GetLed(ledId);
// Create the UpDown event args because it can be used for every event
- ArtemisKeyboardKeyUpDownEventArgs eventArgs = new ArtemisKeyboardKeyUpDownEventArgs(e.Device, led, e.Key, keyboardModifierKey, e.IsDown);
+ ArtemisKeyboardKeyUpDownEventArgs eventArgs = new(e.Device, led, e.Key, keyboardModifierKey, e.IsDown);
OnKeyboardKeyUpDown(eventArgs);
if (e.IsDown)
OnKeyboardKeyDown(eventArgs);
@@ -289,7 +289,7 @@ namespace Artemis.Core.Services
led = e.Device.Leds.FirstOrDefault(l => l.RgbLed.Id == ledId);
// Create the UpDown event args because it can be used for every event
- ArtemisMouseButtonUpDownEventArgs eventArgs = new ArtemisMouseButtonUpDownEventArgs(e.Device, led, e.Button, e.IsDown);
+ ArtemisMouseButtonUpDownEventArgs eventArgs = new(e.Device, led, e.Button, e.IsDown);
OnMouseButtonUpDown(eventArgs);
if (e.IsDown)
OnMouseButtonDown(eventArgs);
diff --git a/src/Artemis.Core/Services/ModuleService.cs b/src/Artemis.Core/Services/ModuleService.cs
index 96983eda7..6d44ecb53 100644
--- a/src/Artemis.Core/Services/ModuleService.cs
+++ b/src/Artemis.Core/Services/ModuleService.cs
@@ -14,7 +14,7 @@ namespace Artemis.Core.Services
{
internal class ModuleService : IModuleService
{
- private static readonly SemaphoreSlim ActiveModuleSemaphore = new SemaphoreSlim(1, 1);
+ private static readonly SemaphoreSlim ActiveModuleSemaphore = new(1, 1);
private readonly ILogger _logger;
private readonly IModuleRepository _moduleRepository;
private readonly IPluginManagementService _pluginManagementService;
@@ -28,7 +28,7 @@ namespace Artemis.Core.Services
_profileService = profileService;
_pluginManagementService.PluginFeatureEnabled += OnPluginFeatureEnabled;
- Timer activationUpdateTimer = new Timer(2000);
+ Timer activationUpdateTimer = new(2000);
activationUpdateTimer.Start();
activationUpdateTimer.Elapsed += ActivationUpdateTimerOnElapsed;
@@ -204,11 +204,11 @@ namespace Artemis.Core.Services
return;
}
- Stopwatch stopwatch = new Stopwatch();
+ Stopwatch stopwatch = new();
stopwatch.Start();
List modules = _pluginManagementService.GetFeaturesOfType().ToList();
- List tasks = new List();
+ List tasks = new();
foreach (Module module in modules)
lock (module)
{
diff --git a/src/Artemis.Core/Services/PluginManagementService.cs b/src/Artemis.Core/Services/PluginManagementService.cs
index 0b2e15cac..cdf0f41df 100644
--- a/src/Artemis.Core/Services/PluginManagementService.cs
+++ b/src/Artemis.Core/Services/PluginManagementService.cs
@@ -38,7 +38,7 @@ namespace Artemis.Core.Services
private void CopyBuiltInPlugin(FileInfo zipFileInfo, ZipArchive zipArchive)
{
- DirectoryInfo pluginDirectory = new DirectoryInfo(Path.Combine(Constants.DataFolder, "plugins", Path.GetFileNameWithoutExtension(zipFileInfo.Name)));
+ DirectoryInfo pluginDirectory = new(Path.Combine(Constants.DataFolder, "plugins", Path.GetFileNameWithoutExtension(zipFileInfo.Name)));
bool createLockFile = File.Exists(Path.Combine(pluginDirectory.FullName, "artemis.lock"));
// Remove the old directory if it exists
@@ -58,10 +58,10 @@ namespace Artemis.Core.Services
public void CopyBuiltInPlugins()
{
OnCopyingBuildInPlugins();
- DirectoryInfo pluginDirectory = new DirectoryInfo(Path.Combine(Constants.DataFolder, "plugins"));
+ DirectoryInfo pluginDirectory = new(Path.Combine(Constants.DataFolder, "plugins"));
// Iterate built-in plugins
- DirectoryInfo builtInPluginDirectory = new DirectoryInfo(Path.Combine(Directory.GetCurrentDirectory(), "Plugins"));
+ DirectoryInfo builtInPluginDirectory = new(Path.Combine(Directory.GetCurrentDirectory(), "Plugins"));
if (!builtInPluginDirectory.Exists)
{
_logger.Warning("No built-in plugins found at {pluginDir}, skipping CopyBuiltInPlugins", builtInPluginDirectory.FullName);
@@ -76,7 +76,7 @@ namespace Artemis.Core.Services
if (metaDataFileEntry == null)
throw new ArtemisPluginException("Couldn't find a plugin.json in " + zipFile.FullName);
- using StreamReader reader = new StreamReader(metaDataFileEntry.Open());
+ using StreamReader reader = new(metaDataFileEntry.Open());
PluginInfo builtInPluginInfo = CoreJson.DeserializeObject(reader.ReadToEnd())!;
// Find the matching plugin in the plugin folder
@@ -151,7 +151,7 @@ namespace Artemis.Core.Services
public Plugin? GetCallingPlugin()
{
- StackTrace stackTrace = new StackTrace(); // get call stack
+ StackTrace stackTrace = new(); // get call stack
StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
foreach (StackFrame stackFrame in stackFrames)
@@ -183,7 +183,7 @@ namespace Artemis.Core.Services
UnloadPlugins();
// Load the plugin assemblies into the plugin context
- DirectoryInfo pluginDirectory = new DirectoryInfo(Path.Combine(Constants.DataFolder, "plugins"));
+ DirectoryInfo pluginDirectory = new(Path.Combine(Constants.DataFolder, "plugins"));
foreach (DirectoryInfo subDirectory in pluginDirectory.EnumerateDirectories())
{
try
@@ -238,7 +238,7 @@ namespace Artemis.Core.Services
}
// Load the entity and fall back on creating a new one
- Plugin plugin = new Plugin(pluginInfo, directory, _pluginRepository.GetPluginByGuid(pluginInfo.Guid));
+ Plugin plugin = new(pluginInfo, directory, _pluginRepository.GetPluginByGuid(pluginInfo.Guid));
OnPluginLoading(new PluginEventArgs(plugin));
// Locate the main assembly entry
diff --git a/src/Artemis.Core/Services/Storage/Models/SurfaceArrangement.cs b/src/Artemis.Core/Services/Storage/Models/SurfaceArrangement.cs
index f7e25c093..a2bfd0b49 100644
--- a/src/Artemis.Core/Services/Storage/Models/SurfaceArrangement.cs
+++ b/src/Artemis.Core/Services/Storage/Models/SurfaceArrangement.cs
@@ -17,7 +17,7 @@ namespace Artemis.Core.Services.Models
internal static SurfaceArrangement GetDefaultArrangement()
{
- SurfaceArrangement arrangement = new SurfaceArrangement();
+ SurfaceArrangement arrangement = new();
SurfaceArrangementType keypad = arrangement.AddType(RGBDeviceType.Keypad, 1);
keypad.AddConfiguration(new SurfaceArrangementConfiguration(null, HorizontalArrangementPosition.Equal, VerticalArrangementPosition.Equal, 20));
@@ -71,7 +71,7 @@ namespace Artemis.Core.Services.Models
private SurfaceArrangementType AddType(RGBDeviceType type, int zIndex)
{
- SurfaceArrangementType surfaceArrangementType = new SurfaceArrangementType(this, type, zIndex);
+ SurfaceArrangementType surfaceArrangementType = new(this, type, zIndex);
Types.Add(surfaceArrangementType);
return surfaceArrangementType;
}
diff --git a/src/Artemis.Core/Services/Storage/Models/SurfaceArrangementType.cs b/src/Artemis.Core/Services/Storage/Models/SurfaceArrangementType.cs
index d93949ca6..2166f34df 100644
--- a/src/Artemis.Core/Services/Storage/Models/SurfaceArrangementType.cs
+++ b/src/Artemis.Core/Services/Storage/Models/SurfaceArrangementType.cs
@@ -46,7 +46,7 @@ namespace Artemis.Core.Services.Models
}
// If nothing applied fall back to just basing on whatever is the furthers to the right
- SurfaceArrangementConfiguration fallback = new SurfaceArrangementConfiguration(
+ SurfaceArrangementConfiguration fallback = new(
null,
HorizontalArrangementPosition.Right,
VerticalArrangementPosition.Equal,
diff --git a/src/Artemis.Core/Services/Storage/ProfileService.cs b/src/Artemis.Core/Services/Storage/ProfileService.cs
index 904a6a3a1..1e5b825e9 100644
--- a/src/Artemis.Core/Services/Storage/ProfileService.cs
+++ b/src/Artemis.Core/Services/Storage/ProfileService.cs
@@ -33,8 +33,8 @@ namespace Artemis.Core.Services
_surfaceService.SurfaceConfigurationUpdated += OnSurfaceConfigurationUpdated;
}
- public JsonSerializerSettings MementoSettings { get; set; } = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All};
- public JsonSerializerSettings ExportSettings { get; set; } = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All, Formatting = Formatting.Indented};
+ public JsonSerializerSettings MementoSettings { get; set; } = new() {TypeNameHandling = TypeNameHandling.All};
+ public JsonSerializerSettings ExportSettings { get; set; } = new() {TypeNameHandling = TypeNameHandling.All, Formatting = Formatting.Indented};
public ProfileDescriptor? GetLastActiveProfile(ProfileModule module)
{
@@ -78,7 +78,7 @@ namespace Artemis.Core.Services
public ProfileDescriptor CreateProfileDescriptor(ProfileModule module, string name)
{
- ProfileEntity profileEntity = new ProfileEntity {Id = Guid.NewGuid(), Name = name, ModuleId = module.Id};
+ ProfileEntity profileEntity = new() {Id = Guid.NewGuid(), Name = name, ModuleId = module.Id};
_profileRepository.Add(profileEntity);
return new ProfileDescriptor(module, profileEntity);
@@ -107,7 +107,7 @@ namespace Artemis.Core.Services
if (profileEntity == null)
throw new ArtemisCoreException($"Cannot find profile named: {profileDescriptor.Name} ID: {profileDescriptor.Id}");
- Profile profile = new Profile(profileDescriptor.ProfileModule, profileEntity);
+ Profile profile = new(profileDescriptor.ProfileModule, profileEntity);
InstantiateProfile(profile);
profileDescriptor.ProfileModule.ChangeActiveProfile(profile, _surfaceService.ActiveSurface);
@@ -122,7 +122,7 @@ namespace Artemis.Core.Services
return;
ProfileEntity entity = _profileRepository.Get(module.ActiveProfile.EntityId);
- Profile profile = new Profile(module, entity);
+ Profile profile = new(module, entity);
InstantiateProfile(profile);
module.ChangeActiveProfile(null, _surfaceService.ActiveSurface);
@@ -138,7 +138,7 @@ namespace Artemis.Core.Services
if (profileEntity == null)
throw new ArtemisCoreException($"Cannot find profile named: {profileDescriptor.Name} ID: {profileDescriptor.Id}");
- Profile profile = new Profile(profileDescriptor.ProfileModule, profileEntity);
+ Profile profile = new(profileDescriptor.ProfileModule, profileEntity);
InstantiateProfile(profile);
void ActivatingProfileSurfaceUpdate(object? sender, SurfaceConfigurationEventArgs e)
diff --git a/src/Artemis.Core/Services/Storage/SurfaceService.cs b/src/Artemis.Core/Services/Storage/SurfaceService.cs
index f36b0c2e6..ed8aed266 100644
--- a/src/Artemis.Core/Services/Storage/SurfaceService.cs
+++ b/src/Artemis.Core/Services/Storage/SurfaceService.cs
@@ -40,7 +40,7 @@ namespace Artemis.Core.Services
public ArtemisSurface CreateSurfaceConfiguration(string name)
{
// Create a blank config
- ArtemisSurface configuration = new ArtemisSurface(_rgbService.Surface, name);
+ ArtemisSurface configuration = new(_rgbService.Surface, name);
// Add all current devices
foreach (IRGBDevice rgbDevice in _rgbService.LoadedDevices)
@@ -134,7 +134,7 @@ namespace Artemis.Core.Services
foreach (SurfaceEntity surfaceEntity in configs)
{
// Create the surface entity
- ArtemisSurface surfaceConfiguration = new ArtemisSurface(_rgbService.Surface, surfaceEntity);
+ ArtemisSurface surfaceConfiguration = new(_rgbService.Surface, surfaceEntity);
foreach (DeviceEntity position in surfaceEntity.DeviceEntities)
{
IRGBDevice? device = _rgbService.Surface.Devices.FirstOrDefault(d => d.GetDeviceIdentifier() == position.DeviceIdentifier);
diff --git a/src/Artemis.Core/Stores/ConditionOperatorStore.cs b/src/Artemis.Core/Stores/ConditionOperatorStore.cs
index ae1437079..8fe8d7e6e 100644
--- a/src/Artemis.Core/Stores/ConditionOperatorStore.cs
+++ b/src/Artemis.Core/Stores/ConditionOperatorStore.cs
@@ -6,7 +6,7 @@ namespace Artemis.Core
{
internal class ConditionOperatorStore
{
- private static readonly List Registrations = new List();
+ private static readonly List Registrations = new();
public static ConditionOperatorRegistration Add(BaseConditionOperator conditionOperator)
{
diff --git a/src/Artemis.Core/Stores/DataBindingModifierTypeStore.cs b/src/Artemis.Core/Stores/DataBindingModifierTypeStore.cs
index e860777f3..86708450f 100644
--- a/src/Artemis.Core/Stores/DataBindingModifierTypeStore.cs
+++ b/src/Artemis.Core/Stores/DataBindingModifierTypeStore.cs
@@ -6,7 +6,7 @@ namespace Artemis.Core
{
internal class DataBindingModifierTypeStore
{
- private static readonly List Registrations = new List();
+ private static readonly List Registrations = new();
public static DataBindingModifierTypeRegistration Add(BaseDataBindingModifierType modifierType)
{
diff --git a/src/Artemis.Core/Stores/DataModelStore.cs b/src/Artemis.Core/Stores/DataModelStore.cs
index 7a6e14d03..e44598908 100644
--- a/src/Artemis.Core/Stores/DataModelStore.cs
+++ b/src/Artemis.Core/Stores/DataModelStore.cs
@@ -7,7 +7,7 @@ namespace Artemis.Core
{
internal class DataModelStore
{
- private static readonly List Registrations = new List();
+ private static readonly List Registrations = new();
public static DataModelRegistration Add(DataModel dataModel)
{
diff --git a/src/Artemis.Core/Stores/LayerBrushStore.cs b/src/Artemis.Core/Stores/LayerBrushStore.cs
index b0897fdd8..a102fd71d 100644
--- a/src/Artemis.Core/Stores/LayerBrushStore.cs
+++ b/src/Artemis.Core/Stores/LayerBrushStore.cs
@@ -7,7 +7,7 @@ namespace Artemis.Core
{
internal class LayerBrushStore
{
- private static readonly List Registrations = new List();
+ private static readonly List Registrations = new();
public static LayerBrushRegistration Add(LayerBrushDescriptor descriptor)
{
diff --git a/src/Artemis.Core/Stores/LayerEffectStore.cs b/src/Artemis.Core/Stores/LayerEffectStore.cs
index 65f2b1289..9793e2021 100644
--- a/src/Artemis.Core/Stores/LayerEffectStore.cs
+++ b/src/Artemis.Core/Stores/LayerEffectStore.cs
@@ -7,7 +7,7 @@ namespace Artemis.Core
{
internal class LayerEffectStore
{
- private static readonly List Registrations = new List();
+ private static readonly List Registrations = new();
public static LayerEffectRegistration Add(LayerEffectDescriptor descriptor)
{
diff --git a/src/Artemis.Core/Utilities/CurrentProcessUtilities.cs b/src/Artemis.Core/Utilities/CurrentProcessUtilities.cs
index 06cd37ef8..39cfc9339 100644
--- a/src/Artemis.Core/Utilities/CurrentProcessUtilities.cs
+++ b/src/Artemis.Core/Utilities/CurrentProcessUtilities.cs
@@ -37,7 +37,7 @@ namespace Artemis.Core
if (restart)
arguments = "-Command \"& {Start-Sleep -s " + delay + "; (Get-Process 'Artemis.UI').kill(); Start-Process -FilePath '" + Process.GetCurrentProcess().MainModule!.FileName + "'}\"";
- ProcessStartInfo info = new ProcessStartInfo
+ ProcessStartInfo info = new()
{
Arguments = arguments,
WindowStyle = ProcessWindowStyle.Hidden,
@@ -59,7 +59,7 @@ namespace Artemis.Core
/// The process created to open the URL
public static Process? OpenUrl(string url)
{
- ProcessStartInfo processInfo = new ProcessStartInfo
+ ProcessStartInfo processInfo = new()
{
FileName = url,
UseShellExecute = true
@@ -87,7 +87,7 @@ namespace Artemis.Core
// On Windows, ensure everyone has permission (important when running as admin)
DirectorySecurity security = dataDirectory.GetAccessControl();
- SecurityIdentifier everyone = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
+ SecurityIdentifier everyone = new(WellKnownSidType.WorldSid, null);
security.AddAccessRule(new FileSystemAccessRule(
everyone,
FileSystemRights.Modify | FileSystemRights.Synchronize,
diff --git a/src/Artemis.Core/Utilities/IntroAnimation.cs b/src/Artemis.Core/Utilities/IntroAnimation.cs
index 128b6a864..56b92f1f5 100644
--- a/src/Artemis.Core/Utilities/IntroAnimation.cs
+++ b/src/Artemis.Core/Utilities/IntroAnimation.cs
@@ -47,7 +47,7 @@ namespace Artemis.Core
LedName = l.RgbLed.Id.ToString()
}));
- Profile profile = new Profile(new DummyModule(), profileEntity);
+ Profile profile = new(new DummyModule(), profileEntity);
profile.Activate(_surfaceService.ActiveSurface);
_profileService.InstantiateProfile(profile);
diff --git a/src/Artemis.Storage/Migrations/M8PluginFeatures.cs b/src/Artemis.Storage/Migrations/M8PluginFeatures.cs
index aaad14c7b..d782ff2bd 100644
--- a/src/Artemis.Storage/Migrations/M8PluginFeatures.cs
+++ b/src/Artemis.Storage/Migrations/M8PluginFeatures.cs
@@ -50,7 +50,7 @@ namespace Artemis.Storage.Migrations
public void Apply(LiteRepository repository)
{
- Dictionary pluginMap = new Dictionary
+ Dictionary pluginMap = new()
{
{"ffffffff-ffff-ffff-ffff-ffffffffffff", "Artemis.Core.CorePluginFeature-ffffffff"},
{"ab41d601-35e0-4a73-bf0b-94509b006ab0", "Artemis.Plugins.DataModelExpansions.TestData.PluginDataModelExpansion-ab41d601"},
diff --git a/src/Artemis.UI.Shared/Behaviors/ScrollParentWhenAtMax.cs b/src/Artemis.UI.Shared/Behaviors/ScrollParentWhenAtMax.cs
index b0493fc20..aa91b1beb 100644
--- a/src/Artemis.UI.Shared/Behaviors/ScrollParentWhenAtMax.cs
+++ b/src/Artemis.UI.Shared/Behaviors/ScrollParentWhenAtMax.cs
@@ -35,7 +35,7 @@ namespace Artemis.UI.Shared
if (scrollPos == scrollViewer.ScrollableHeight && e.Delta < 0 || scrollPos == 0 && e.Delta > 0)
{
e.Handled = true;
- MouseWheelEventArgs e2 = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
+ MouseWheelEventArgs e2 = new(e.MouseDevice, e.Timestamp, e.Delta);
e2.RoutedEvent = UIElement.MouseWheelEvent;
AssociatedObject.RaiseEvent(e2);
}
diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
index 2628c84fb..6021653ba 100644
--- a/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
+++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizer.cs
@@ -106,7 +106,7 @@ namespace Artemis.UI.Shared
// Determine the scale required to fit the desired size of the control
Size measureSize = MeasureDevice();
double scale = Math.Min(DesiredSize.Width / measureSize.Width, DesiredSize.Height / measureSize.Height);
- Rect scaledRect = new Rect(0, 0, measureSize.Width * scale, measureSize.Height * scale);
+ Rect scaledRect = new(0, 0, measureSize.Width * scale, measureSize.Height * scale);
// Center and scale the visualization in the desired bounding box
if (DesiredSize.Width > 0 && DesiredSize.Height > 0)
@@ -116,7 +116,7 @@ namespace Artemis.UI.Shared
}
// Determine the offset required to rotate within bounds
- Rect rotationRect = new Rect(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height);
+ Rect rotationRect = new(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height);
rotationRect.Transform(new RotateTransform(Device.Rotation).Value);
// Apply device rotation
@@ -169,7 +169,7 @@ namespace Artemis.UI.Shared
if (Device == null)
return Size.Empty;
- Rect rotationRect = new Rect(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height);
+ Rect rotationRect = new(0, 0, Device.RgbDevice.ActualSize.Width, Device.RgbDevice.ActualSize.Height);
rotationRect.Transform(new RotateTransform(Device.Rotation).Value);
return rotationRect.Size;
@@ -249,16 +249,16 @@ namespace Artemis.UI.Shared
}
// Create the opacity drawing group
- DrawingGroup opacityDrawingGroup = new DrawingGroup();
+ DrawingGroup opacityDrawingGroup = new();
DrawingContext drawingContext = opacityDrawingGroup.Open();
foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds)
deviceVisualizerLed.RenderOpacityMask(drawingContext);
drawingContext.Close();
// Render the store as a bitmap
- DrawingImage drawingImage = new DrawingImage(opacityDrawingGroup);
- Image image = new Image {Source = drawingImage};
- RenderTargetBitmap bitmap = new RenderTargetBitmap(
+ DrawingImage drawingImage = new(opacityDrawingGroup);
+ Image image = new() {Source = drawingImage};
+ RenderTargetBitmap bitmap = new(
Math.Max(1, (int) (opacityDrawingGroup.Bounds.Width * 2.5)),
Math.Max(1, (int) (opacityDrawingGroup.Bounds.Height * 2.5)),
96,
@@ -270,7 +270,7 @@ namespace Artemis.UI.Shared
bitmap.Freeze();
// Set the bitmap as the opacity mask for the colors backing store
- ImageBrush bitmapBrush = new ImageBrush(bitmap);
+ ImageBrush bitmapBrush = new(bitmap);
bitmapBrush.Freeze();
_backingStore.OpacityMask = bitmapBrush;
diff --git a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs
index 88e5eb884..b271c9c29 100644
--- a/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs
+++ b/src/Artemis.UI.Shared/Controls/DeviceVisualizerLed.cs
@@ -61,9 +61,9 @@ namespace Artemis.UI.Shared
if (DisplayGeometry == null)
return;
- SolidColorBrush fillBrush = new SolidColorBrush(Color.FromArgb(100, 255, 255, 255));
+ SolidColorBrush fillBrush = new(Color.FromArgb(100, 255, 255, 255));
fillBrush.Freeze();
- SolidColorBrush penBrush = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
+ SolidColorBrush penBrush = new(Color.FromArgb(255, 255, 255, 255));
penBrush.Freeze();
// Create transparent pixels covering the entire LedRect so the image size matched the LedRect size
diff --git a/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml.cs b/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml.cs
index 5d080039a..cbc59f4f8 100644
--- a/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml.cs
+++ b/src/Artemis.UI.Shared/Controls/DraggableFloat.xaml.cs
@@ -44,7 +44,7 @@ namespace Artemis.UI.Shared
typeof(RoutedPropertyChangedEventHandler),
typeof(DraggableFloat));
- private readonly Regex _inputRegex = new Regex("^[.][-|0-9]+$|^-?[0-9]*[.]{0,1}[0-9]*$");
+ private readonly Regex _inputRegex = new("^[.][-|0-9]+$|^-?[0-9]*[.]{0,1}[0-9]*$");
private bool _calledDragStarted;
@@ -196,10 +196,10 @@ namespace Artemis.UI.Shared
}
// Use decimals for everything to avoid floating point errors
- decimal startValue = new decimal(_startValue);
- decimal startX = new decimal(_mouseDragStartPoint.X);
- decimal x = new decimal(e.GetPosition((IInputElement) sender).X);
- decimal stepSize = new decimal(StepSize);
+ decimal startValue = new(_startValue);
+ decimal startX = new(_mouseDragStartPoint.X);
+ decimal x = new(e.GetPosition((IInputElement) sender).X);
+ decimal stepSize = new(StepSize);
if (stepSize == 0)
stepSize = 0.1m;
diff --git a/src/Artemis.UI.Shared/Converters/ColorGradientToGradientStopsConverter.cs b/src/Artemis.UI.Shared/Converters/ColorGradientToGradientStopsConverter.cs
index 22d9b951c..ad4138311 100644
--- a/src/Artemis.UI.Shared/Converters/ColorGradientToGradientStopsConverter.cs
+++ b/src/Artemis.UI.Shared/Converters/ColorGradientToGradientStopsConverter.cs
@@ -21,7 +21,7 @@ namespace Artemis.UI.Shared
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
List colorGradients = (List) value;
- GradientStopCollection collection = new GradientStopCollection();
+ GradientStopCollection collection = new();
if (colorGradients == null)
return collection;
@@ -34,7 +34,7 @@ namespace Artemis.UI.Shared
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
GradientStopCollection collection = (GradientStopCollection) value;
- List colorGradients = new List();
+ List colorGradients = new();
if (collection == null)
return colorGradients;
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs
index c9f198ebe..16edde678 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/DataModelDisplayViewModel.cs
@@ -27,7 +27,7 @@ namespace Artemis.UI.Shared
}
}
- internal override object InternalGuard => new object();
+ internal override object InternalGuard => new();
///
public override void UpdateValue(object? model)
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
index 171e2a4c6..1c147ac43 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/DataModelInputViewModel.cs
@@ -45,7 +45,7 @@ namespace Artemis.UI.Shared
///
public DataModelPropertyAttribute TargetDescription { get; }
- internal override object InternalGuard { get; } = new object();
+ internal override object InternalGuard { get; } = new();
///
public sealed override void Submit()
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs
index dbd206a22..55ac8e376 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelDynamicViewModel.cs
@@ -21,7 +21,7 @@ namespace Artemis.UI.Shared.Input
private readonly IDataModelUIService _dataModelUIService;
private readonly Module _module;
private readonly Timer _updateTimer;
- private SolidColorBrush _buttonBrush = new SolidColorBrush(Color.FromRgb(171, 71, 188));
+ private SolidColorBrush _buttonBrush = new(Color.FromRgb(171, 71, 188));
private DataModelPath? _dataModelPath;
private DataModelPropertiesViewModel? _dataModelViewModel;
private bool _displaySwitchButton;
@@ -59,7 +59,7 @@ namespace Artemis.UI.Shared.Input
///
/// Gets the brush to use for the switch button
///
- public SolidColorBrush SwitchButtonBrush => new SolidColorBrush(ButtonBrush.Color.Darken());
+ public SolidColorBrush SwitchButtonBrush => new(ButtonBrush.Color.Darken());
///
/// Gets or sets the placeholder text when no value is entered
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelStaticViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelStaticViewModel.cs
index e1db98f22..d909eb9ba 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelStaticViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Input/DataModelStaticViewModel.cs
@@ -19,7 +19,7 @@ namespace Artemis.UI.Shared.Input
{
private readonly IDataModelUIService _dataModelUIService;
private readonly Window? _rootView;
- private SolidColorBrush _buttonBrush = new SolidColorBrush(Color.FromRgb(171, 71, 188));
+ private SolidColorBrush _buttonBrush = new(Color.FromRgb(171, 71, 188));
private bool _displaySwitchButton;
private DataModelDisplayViewModel? _displayViewModel;
private DataModelInputViewModel? _inputViewModel;
@@ -62,7 +62,7 @@ namespace Artemis.UI.Shared.Input
///
/// Gets the brush to use for the switch button
///
- public SolidColorBrush SwitchButtonBrush => new SolidColorBrush(ButtonBrush.Color.Darken());
+ public SolidColorBrush SwitchButtonBrush => new(ButtonBrush.Color.Darken());
///
/// Gets the view model used to display the value
diff --git a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
index 55fa3d730..56bbbf5e7 100644
--- a/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
+++ b/src/Artemis.UI.Shared/DataModelVisualization/Shared/DataModelVisualizationViewModel.cs
@@ -263,7 +263,7 @@ namespace Artemis.UI.Shared
if (depth > MaxDepth)
return null;
- DataModelPath dataModelPath = new DataModelPath(DataModel, path);
+ DataModelPath dataModelPath = new(DataModel, path);
if (!dataModelPath.IsValid)
return null;
diff --git a/src/Artemis.UI.Shared/Extensions/DataModelWrapperExtensions.cs b/src/Artemis.UI.Shared/Extensions/DataModelWrapperExtensions.cs
index b007beafa..d21024543 100644
--- a/src/Artemis.UI.Shared/Extensions/DataModelWrapperExtensions.cs
+++ b/src/Artemis.UI.Shared/Extensions/DataModelWrapperExtensions.cs
@@ -18,7 +18,7 @@ namespace Artemis.UI.Shared
/// The created view model
public static DataModelPropertiesViewModel CreateViewModel(this EventPredicateWrapperDataModel wrapper, IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration)
{
- DataModelPropertiesViewModel viewModel = new DataModelPropertiesViewModel(wrapper, null, new DataModelPath(wrapper));
+ DataModelPropertiesViewModel viewModel = new(wrapper, null, new DataModelPath(wrapper));
viewModel.Update(dataModelUIService, configuration);
viewModel.UpdateRequested += (sender, args) => viewModel.Update(dataModelUIService, configuration);
viewModel.Children.First().IsVisualizationExpanded = true;
@@ -35,7 +35,7 @@ namespace Artemis.UI.Shared
/// The created view model
public static DataModelPropertiesViewModel CreateViewModel(this ListPredicateWrapperDataModel wrapper, IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration)
{
- DataModelPropertiesViewModel viewModel = new DataModelPropertiesViewModel(wrapper, null, new DataModelPath(wrapper));
+ DataModelPropertiesViewModel viewModel = new(wrapper, null, new DataModelPath(wrapper));
viewModel.Update(dataModelUIService, configuration);
viewModel.UpdateRequested += (sender, args) => viewModel.Update(dataModelUIService, configuration);
viewModel.Children.First().IsVisualizationExpanded = true;
diff --git a/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs b/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs
index b15993d85..3b9e10223 100644
--- a/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs
+++ b/src/Artemis.UI.Shared/PropertyInput/PropertyInputViewModel.cs
@@ -85,7 +85,7 @@ namespace Artemis.UI.Shared
}
}
- internal override object InternalGuard { get; } = new object();
+ internal override object InternalGuard { get; } = new();
#region IDisposable
diff --git a/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorViewModel.cs b/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorViewModel.cs
index d95ee175d..8b905c56a 100644
--- a/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorViewModel.cs
+++ b/src/Artemis.UI.Shared/Screens/GradientEditor/GradientEditorViewModel.cs
@@ -52,12 +52,12 @@ namespace Artemis.UI.Shared.Screens.GradientEditor
{
Canvas? child = VisualTreeUtilities.FindChild
public static class JsonClipboard
{
- private static readonly JsonSerializerSettings JsonSettings = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All};
+ private static readonly JsonSerializerSettings JsonSettings = new() {TypeNameHandling = TypeNameHandling.All};
///
/// Sets the provided object on the clipboard
diff --git a/src/Artemis.UI.Shared/Utilities/TriggerTracing.cs b/src/Artemis.UI.Shared/Utilities/TriggerTracing.cs
index 7d2acf3cd..e2f7dfb1b 100644
--- a/src/Artemis.UI.Shared/Utilities/TriggerTracing.cs
+++ b/src/Artemis.UI.Shared/Utilities/TriggerTracing.cs
@@ -174,7 +174,7 @@ namespace Artemis.UI.Shared
{
// insert dummy story-boards which can later be traced using WPF animation tracing
- TriggerTraceStoryboard storyboard = new TriggerTraceStoryboard(triggerBase, TriggerTraceStoryboardType.Enter);
+ TriggerTraceStoryboard storyboard = new(triggerBase, TriggerTraceStoryboardType.Enter);
triggerBase.EnterActions.Insert(0, new BeginStoryboard {Storyboard = storyboard});
storyboard = new TriggerTraceStoryboard(triggerBase, TriggerTraceStoryboardType.Exit);
diff --git a/src/Artemis.UI/Behaviors/InputBindingBehavior.cs b/src/Artemis.UI/Behaviors/InputBindingBehavior.cs
index 6cc384fd6..d8762ea59 100644
--- a/src/Artemis.UI/Behaviors/InputBindingBehavior.cs
+++ b/src/Artemis.UI/Behaviors/InputBindingBehavior.cs
@@ -8,7 +8,7 @@ namespace Artemis.UI.Behaviors
{
public class InputBindingBehavior
{
- private static List> _movedInputBindings = new List>();
+ private static List> _movedInputBindings = new();
public static readonly DependencyProperty PropagateInputBindingsToWindowProperty =
DependencyProperty.RegisterAttached("PropagateInputBindingsToWindow", typeof(bool), typeof(InputBindingBehavior),
diff --git a/src/Artemis.UI/DefaultTypes/DataModel/Input/DoubleDataModelInputViewModel.cs b/src/Artemis.UI/DefaultTypes/DataModel/Input/DoubleDataModelInputViewModel.cs
index df9507368..b939a7380 100644
--- a/src/Artemis.UI/DefaultTypes/DataModel/Input/DoubleDataModelInputViewModel.cs
+++ b/src/Artemis.UI/DefaultTypes/DataModel/Input/DoubleDataModelInputViewModel.cs
@@ -15,7 +15,7 @@ namespace Artemis.UI.DefaultTypes.DataModel.Input
public void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
{
string seperator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
- Regex regex = new Regex("^[" + seperator + "][0-9]+$|^[0-9]*[" + seperator + "]{0,1}[0-9]*$");
+ Regex regex = new("^[" + seperator + "][0-9]+$|^[0-9]*[" + seperator + "]{0,1}[0-9]*$");
e.Handled = !regex.IsMatch(e.Text);
}
}
diff --git a/src/Artemis.UI/DefaultTypes/DataModel/Input/IntDataModelInputViewModel.cs b/src/Artemis.UI/DefaultTypes/DataModel/Input/IntDataModelInputViewModel.cs
index f00c4addc..4a9ba6487 100644
--- a/src/Artemis.UI/DefaultTypes/DataModel/Input/IntDataModelInputViewModel.cs
+++ b/src/Artemis.UI/DefaultTypes/DataModel/Input/IntDataModelInputViewModel.cs
@@ -13,7 +13,7 @@ namespace Artemis.UI.DefaultTypes.DataModel.Input
public void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
{
- Regex regex = new Regex("[^0-9]+");
+ Regex regex = new("[^0-9]+");
e.Handled = regex.IsMatch(e.Text);
}
}
diff --git a/src/Artemis.UI/Extensions/RgbRectangleExtensions.cs b/src/Artemis.UI/Extensions/RgbRectangleExtensions.cs
index a85cefb63..1f727ca80 100644
--- a/src/Artemis.UI/Extensions/RgbRectangleExtensions.cs
+++ b/src/Artemis.UI/Extensions/RgbRectangleExtensions.cs
@@ -7,7 +7,7 @@ namespace Artemis.UI.Extensions
{
public static Rect ToWindowsRect(this Rectangle rectangle, double scale)
{
- return new Rect(
+ return new(
(int) (rectangle.Location.X * scale),
(int) (rectangle.Location.Y * scale),
(int) (rectangle.Size.Width * scale),
diff --git a/src/Artemis.UI/InputProviders/NativeWindowInputProvider.cs b/src/Artemis.UI/InputProviders/NativeWindowInputProvider.cs
index 56f822d6e..804a6c3b4 100644
--- a/src/Artemis.UI/InputProviders/NativeWindowInputProvider.cs
+++ b/src/Artemis.UI/InputProviders/NativeWindowInputProvider.cs
@@ -231,7 +231,7 @@ namespace Artemis.UI.InputProviders
private static Win32Point GetCursorPosition()
{
- Win32Point w32Mouse = new Win32Point();
+ Win32Point w32Mouse = new();
GetCursorPos(ref w32Mouse);
return w32Mouse;
diff --git a/src/Artemis.UI/Screens/Modules/ModuleRootViewModel.cs b/src/Artemis.UI/Screens/Modules/ModuleRootViewModel.cs
index 90b7e1330..fba336e81 100644
--- a/src/Artemis.UI/Screens/Modules/ModuleRootViewModel.cs
+++ b/src/Artemis.UI/Screens/Modules/ModuleRootViewModel.cs
@@ -40,11 +40,11 @@ namespace Artemis.UI.Screens.Modules
if (Module.ModuleTabs != null)
{
- List moduleTabs = new List(Module.ModuleTabs);
+ List moduleTabs = new(Module.ModuleTabs);
foreach (ModuleTab moduleTab in moduleTabs.Where(m => m != null))
{
- ConstructorArgument module = new ConstructorArgument("module", Module);
- ConstructorArgument displayName = new ConstructorArgument("displayName", DisplayName);
+ ConstructorArgument module = new("module", Module);
+ ConstructorArgument displayName = new("displayName", DisplayName);
ModuleViewModel viewModel = (ModuleViewModel) Module.Plugin.Kernel.Get(moduleTab.Type, module, displayName);
Items.Add(viewModel);
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionEventViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionEventViewModel.cs
index 514440a33..b22a5fe17 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionEventViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionEventViewModel.cs
@@ -35,7 +35,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
LeftSideSelectionViewModel.LoadEventChildren = false;
IReadOnlyCollection editors = _dataModelUIService.RegisteredDataModelEditors;
- List supportedInputTypes = new List {typeof(DataModelEvent), typeof(DataModelEvent<>)};
+ List supportedInputTypes = new() {typeof(DataModelEvent), typeof(DataModelEvent<>)};
LeftSideSelectionViewModel.FilterTypes = supportedInputTypes.ToArray();
LeftSideSelectionViewModel.ButtonBrush = new SolidColorBrush(Color.FromRgb(185, 164, 10));
@@ -54,7 +54,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
if (DataModelConditionEvent.EventPath == null || !DataModelConditionEvent.EventPath.IsValid)
return;
- List viewModels = new List();
+ List viewModels = new();
foreach (DataModelConditionPart childModel in Model.Children)
{
if (Items.Any(c => c.Model == childModel))
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionGroupViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionGroupViewModel.cs
index 0af34024f..adc568df4 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionGroupViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionGroupViewModel.cs
@@ -181,7 +181,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
DataModelConditionGroup.RemoveChild(predicateViewModel.Model);
// Insert a list in the same position
- DataModelConditionList list = new DataModelConditionList(DataModelConditionGroup);
+ DataModelConditionList list = new(DataModelConditionGroup);
list.UpdateList(predicateViewModel.LeftSideSelectionViewModel.DataModelPath);
DataModelConditionGroup.AddChild(list, index);
@@ -196,7 +196,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
DataModelConditionGroup.RemoveChild(listViewModel.Model);
// Insert a list in the same position
- DataModelConditionGeneralPredicate predicate = new DataModelConditionGeneralPredicate(DataModelConditionGroup, ProfileRightSideType.Dynamic);
+ DataModelConditionGeneralPredicate predicate = new(DataModelConditionGroup, ProfileRightSideType.Dynamic);
predicate.UpdateLeftSide(listViewModel.LeftSideSelectionViewModel.DataModelPath);
DataModelConditionGroup.AddChild(predicate, index);
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionListViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionListViewModel.cs
index 90e4694d0..ef1b68d2d 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionListViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Conditions/DataModelConditionListViewModel.cs
@@ -104,7 +104,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
if (DataModelConditionList.ListPath == null || !DataModelConditionList.ListPath.IsValid)
return;
- List viewModels = new List();
+ List viewModels = new();
foreach (DataModelConditionPart childModel in Model.Children)
{
if (Items.Any(c => c.Model == childModel))
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingView.xaml b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingView.xaml
index ef13d8f80..770262e39 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingView.xaml
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DataBindingView.xaml
@@ -84,8 +84,8 @@
-
-
+
+
@@ -95,7 +95,12 @@
Data binding result
-
+
Other data bindings not updating?
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DirectDataBinding/DataBindingModifierViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DirectDataBinding/DataBindingModifierViewModel.cs
index 839619fa1..ee01ad3f4 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DirectDataBinding/DataBindingModifierViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/DataBindings/DirectDataBinding/DataBindingModifierViewModel.cs
@@ -122,7 +122,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings.DirectDa
}
// Modifier type
- ModifierTypeCategoryViewModel root = new ModifierTypeCategoryViewModel(null, null);
+ ModifierTypeCategoryViewModel root = new(null, null);
IEnumerable> modifierTypes = _dataBindingService.GetCompatibleModifierTypes(sourceType, ModifierTypePart.Value).GroupBy(t => t.Category);
foreach (IGrouping dataBindingModifierTypes in modifierTypes)
{
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertyGroupViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertyGroupViewModel.cs
index d2476c19f..318c3eb17 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertyGroupViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/LayerPropertyGroupViewModel.cs
@@ -75,7 +75,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
public List GetAllKeyframeViewModels(bool expandedOnly)
{
- List result = new List();
+ List result = new();
if (expandedOnly && !IsExpanded)
return result;
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Controls/PropertyTimelineHeader.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Controls/PropertyTimelineHeader.cs
index 903f8eb34..8c2204420 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Controls/PropertyTimelineHeader.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Controls/PropertyTimelineHeader.cs
@@ -71,7 +71,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Controls
base.OnRender(drawingContext);
UpdateTimeScale();
- Pen linePen = new Pen(Fill, 1);
+ Pen linePen = new(Fill, 1);
double width = HorizontalOffset + VisibleWidth;
int frameStart = 0;
@@ -126,8 +126,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Controls
private void RenderLabel(DrawingContext drawingContext, string text, double x)
{
- Typeface typeFace = new Typeface(FontFamily, new FontStyle(), new FontWeight(), new FontStretch());
- FormattedText formattedText = new FormattedText(text, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, typeFace, 9, Fill, null, VisualTreeHelper.GetDpi(this).PixelsPerDip);
+ Typeface typeFace = new(FontFamily, new FontStyle(), new FontWeight(), new FontStretch());
+ FormattedText formattedText = new(text, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, typeFace, 9, Fill, null, VisualTreeHelper.GetDpi(this).PixelsPerDip);
if (x == 0 && OffsetFirstValue)
drawingContext.DrawText(formattedText, new Point(2, 5));
else
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Dialogs/TimelineSegmentDialogViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Dialogs/TimelineSegmentDialogViewModel.cs
index fb4959405..c873ee6b5 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Dialogs/TimelineSegmentDialogViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Dialogs/TimelineSegmentDialogViewModel.cs
@@ -42,7 +42,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Dialogs
public class TimelineSegmentDialogViewModelValidator : AbstractValidator
{
- private readonly Regex _inputRegex = new Regex("^[.][-|0-9]+$|^-?[0-9]*[.]{0,1}[0-9]*$");
+ private readonly Regex _inputRegex = new("^[.][-|0-9]+$|^-?[0-9]*[.]{0,1}[0-9]*$");
public TimelineSegmentDialogViewModelValidator()
{
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Models/KeyframeClipboardModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Models/KeyframeClipboardModel.cs
index 821729f2b..c05e3f26b 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Models/KeyframeClipboardModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/Models/KeyframeClipboardModel.cs
@@ -31,7 +31,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Models
if (HasBeenPasted)
throw new ArtemisUIException("Clipboard model can only be pasted once");
- List results = new List();
+ List results = new();
if (!ClipboardModels.Any())
return results;
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineViewModel.cs
index 6294d0d7a..8fd0acb09 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Timeline/TimelineViewModel.cs
@@ -249,7 +249,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
private void CopyKeyframes(List keyframes)
{
- KeyframesClipboardModel clipboardModel = new KeyframesClipboardModel(keyframes);
+ KeyframesClipboardModel clipboardModel = new(keyframes);
JsonClipboard.SetObject(clipboardModel);
}
@@ -261,7 +261,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
private List PasteClipboardData(KeyframesClipboardModel clipboardModel, TimeSpan pastePosition)
{
- List pasted = new List();
+ List pasted = new();
if (clipboardModel == null)
return pasted;
RenderProfileElement target = _profileEditorService.SelectedProfileElement;
@@ -368,7 +368,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
return;
Point position = e.GetPosition((IInputElement) sender);
- Rect selectedRect = new Rect(_mouseDragStartPoint, position);
+ Rect selectedRect = new(_mouseDragStartPoint, position);
SelectionRectangle.Rect = selectedRect;
List keyframeViewModels = GetAllKeyframeViewModels();
@@ -386,7 +386,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
if (_mouseDragging && e.LeftButton == MouseButtonState.Pressed)
{
Point position = e.GetPosition((IInputElement) sender);
- Rect selectedRect = new Rect(_mouseDragStartPoint, position);
+ Rect selectedRect = new(_mouseDragStartPoint, position);
SelectionRectangle.Rect = selectedRect;
e.Handled = true;
}
@@ -432,7 +432,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
private List GetAllKeyframeViewModels()
{
- List viewModels = new List();
+ List viewModels = new();
foreach (LayerPropertyGroupViewModel layerPropertyGroupViewModel in LayerPropertyGroups)
viewModels.AddRange(layerPropertyGroupViewModel.GetAllKeyframeViewModels(false));
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupViewModel.cs
index a78c57aae..9b1629eb0 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeGroupViewModel.cs
@@ -79,7 +79,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
// Find the BaseLayerBrush parameter, it is required by the base constructor so its there for sure
ParameterInfo brushParameter = constructors.First().GetParameters().First(p => typeof(BaseLayerBrush).IsAssignableFrom(p.ParameterType));
- ConstructorArgument argument = new ConstructorArgument(brushParameter.Name, layerBrush);
+ ConstructorArgument argument = new(brushParameter.Name, layerBrush);
BrushConfigurationViewModel viewModel = (BrushConfigurationViewModel) layerBrush.Descriptor.Provider.Plugin.Kernel.Get(configurationViewModel.Type, argument);
_windowManager.ShowDialog(new LayerBrushSettingsWindowViewModel(viewModel));
@@ -105,7 +105,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
throw new ArtemisUIException("Effect configuration dialogs must have exactly one constructor");
ParameterInfo effectParameter = constructors.First().GetParameters().First(p => typeof(BaseLayerEffect).IsAssignableFrom(p.ParameterType));
- ConstructorArgument argument = new ConstructorArgument(effectParameter.Name, layerEffect);
+ ConstructorArgument argument = new(effectParameter.Name, layerEffect);
EffectConfigurationViewModel viewModel = (EffectConfigurationViewModel) layerEffect.Descriptor.Provider.Plugin.Kernel.Get(configurationViewModel.Type, argument);
_windowManager.ShowDialog(new LayerEffectSettingsWindowViewModel(viewModel));
}
diff --git a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeViewModel.cs
index 0b0bf6235..658226339 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/LayerProperties/Tree/TreeViewModel.cs
@@ -24,7 +24,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
return;
e.Handled = true;
- MouseWheelEventArgs eventArg = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta)
+ MouseWheelEventArgs eventArg = new(e.MouseDevice, e.Timestamp, e.Delta)
{
RoutedEvent = UIElement.MouseWheelEvent,
Source = sender
diff --git a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
index c742e36fb..a0086373f 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/ProfileTree/TreeItem/TreeItemViewModel.cs
@@ -54,7 +54,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
public List GetAllChildren()
{
- List children = new List();
+ List children = new();
foreach (TreeItemViewModel childFolder in Items)
{
// Add all children in this element
@@ -128,7 +128,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
if (!SupportsChildren)
throw new ArtemisUIException("Cannot add a folder to a profile element of type " + ProfileElement.GetType().Name);
- Folder _ = new Folder(ProfileElement, "New folder");
+ Folder _ = new(ProfileElement, "New folder");
_profileEditorService.UpdateSelectedProfile();
}
@@ -137,7 +137,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
if (!SupportsChildren)
throw new ArtemisUIException("Cannot add a layer to a profile element of type " + ProfileElement.GetType().Name);
- Layer layer = new Layer(ProfileElement, "New layer");
+ Layer layer = new(ProfileElement, "New layer");
// Could be null if the default brush got disabled
LayerBrushDescriptor brush = _layerBrushService.GetDefaultLayerBrush();
@@ -217,7 +217,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
Items.Remove(treeItemViewModel);
// Add missing children
- List newChildren = new List();
+ List newChildren = new();
foreach (ProfileElement profileElement in ProfileElement.Children.OrderBy(c => c.Order))
if (profileElement is Folder folder)
{
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileLayerViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileLayerViewModel.cs
index 977051f10..7af191dec 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileLayerViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileLayerViewModel.cs
@@ -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
{
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileViewModel.cs
index c2f4f935c..25958a2c2 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Visualization/ProfileViewModel.cs
@@ -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();
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/EditToolViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/EditToolViewModel.cs
index 38db11c66..f9a3234b1 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/EditToolViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/EditToolViewModel.cs
@@ -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)
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/SelectionRemoveToolViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/SelectionRemoveToolViewModel.cs
index 81f575d49..bcb18e5eb 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/SelectionRemoveToolViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/SelectionRemoveToolViewModel.cs
@@ -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 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 selectedLeds = ProfileViewModel.GetLedsInRectangle(selectedRect);
// Unless shift is held down, clear the current selection
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/SelectionToolViewModel.cs b/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/SelectionToolViewModel.cs
index cf09e35ec..7a3edccd6 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/SelectionToolViewModel.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Visualization/Tools/SelectionToolViewModel.cs
@@ -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 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 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 selectedLeds)
{
- Layer newLayer = new Layer(folder, "New layer");
+ Layer newLayer = new(folder, "New layer");
LayerBrushDescriptor brush = _layerBrushService.GetDefaultLayerBrush();
if (brush != null)
diff --git a/src/Artemis.UI/Screens/ProfileEditor/Visualization/UserControls/LayerShapeControl.xaml.cs b/src/Artemis.UI/Screens/ProfileEditor/Visualization/UserControls/LayerShapeControl.xaml.cs
index 4036ec376..c2e87cdd5 100644
--- a/src/Artemis.UI/Screens/ProfileEditor/Visualization/UserControls/LayerShapeControl.xaml.cs
+++ b/src/Artemis.UI/Screens/ProfileEditor/Visualization/UserControls/LayerShapeControl.xaml.cs
@@ -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);
}
diff --git a/src/Artemis.UI/Screens/RootViewModel.cs b/src/Artemis.UI/Screens/RootViewModel.cs
index a510aa954..2ced26ce7 100644
--- a/src/Artemis.UI/Screens/RootViewModel.cs
+++ b/src/Artemis.UI/Screens/RootViewModel.cs
@@ -215,12 +215,12 @@ namespace Artemis.UI.Screens
private void ChangeMaterialColors(ApplicationColorScheme colorScheme)
{
- PaletteHelper paletteHelper = new PaletteHelper();
+ PaletteHelper paletteHelper = new();
ITheme theme = paletteHelper.GetTheme();
theme.SetBaseTheme(colorScheme == ApplicationColorScheme.Dark ? Theme.Dark : Theme.Light);
paletteHelper.SetTheme(theme);
- MaterialDesignExtensions.Themes.PaletteHelper extensionsPaletteHelper = new MaterialDesignExtensions.Themes.PaletteHelper();
+ MaterialDesignExtensions.Themes.PaletteHelper extensionsPaletteHelper = new();
extensionsPaletteHelper.SetLightDark(colorScheme == ApplicationColorScheme.Dark);
}
diff --git a/src/Artemis.UI/Screens/Settings/Debug/Tabs/RenderDebugViewModel.cs b/src/Artemis.UI/Screens/Settings/Debug/Tabs/RenderDebugViewModel.cs
index 5aad0a376..437284ed4 100644
--- a/src/Artemis.UI/Screens/Settings/Debug/Tabs/RenderDebugViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/Debug/Tabs/RenderDebugViewModel.cs
@@ -69,9 +69,9 @@ namespace Artemis.UI.Screens.Settings.Debug.Tabs
{
using (SKImage skiaImage = SKImage.FromPixels(e.BitmapBrush.Bitmap.PeekPixels()))
{
- SKImageInfo info = new SKImageInfo(skiaImage.Width, skiaImage.Height);
+ SKImageInfo info = new(skiaImage.Width, skiaImage.Height);
writeableBitmap.Lock();
- using (SKPixmap pixmap = new SKPixmap(info, writeableBitmap.BackBuffer, writeableBitmap.BackBufferStride))
+ using (SKPixmap pixmap = new(info, writeableBitmap.BackBuffer, writeableBitmap.BackBufferStride))
{
skiaImage.ReadPixels(pixmap, 0, 0);
}
diff --git a/src/Artemis.UI/Screens/Settings/Tabs/General/GeneralSettingsTabViewModel.cs b/src/Artemis.UI/Screens/Settings/Tabs/General/GeneralSettingsTabViewModel.cs
index ef5fff9c2..02bf14207 100644
--- a/src/Artemis.UI/Screens/Settings/Tabs/General/GeneralSettingsTabViewModel.cs
+++ b/src/Artemis.UI/Screens/Settings/Tabs/General/GeneralSettingsTabViewModel.cs
@@ -47,7 +47,7 @@ namespace Artemis.UI.Screens.Settings.Tabs.General
LogLevels = new BindableCollection(EnumUtilities.GetAllValuesAndDescriptions(typeof(LogEventLevel)));
ColorSchemes = new BindableCollection(EnumUtilities.GetAllValuesAndDescriptions(typeof(ApplicationColorScheme)));
- RenderScales = new List> {new Tuple("10%", 0.1)};
+ RenderScales = new List> {new("10%", 0.1)};
for (int i = 25; i <= 100; i += 25)
RenderScales.Add(new Tuple(i + "%", i / 100.0));
diff --git a/src/Artemis.UI/Screens/Shared/PanZoomViewModel.cs b/src/Artemis.UI/Screens/Shared/PanZoomViewModel.cs
index f6773cf1e..45638755c 100644
--- a/src/Artemis.UI/Screens/Shared/PanZoomViewModel.cs
+++ b/src/Artemis.UI/Screens/Shared/PanZoomViewModel.cs
@@ -80,7 +80,7 @@ namespace Artemis.UI.Screens.Shared
set => SetAndNotify(ref _limitToZero, value);
}
- public Rect BackgroundViewport => new Rect(PanX, PanY, 20, 20);
+ public Rect BackgroundViewport => new(PanX, PanY, 20, 20);
public void ProcessMouseScroll(object sender, MouseWheelEventArgs e)
{
@@ -152,7 +152,7 @@ namespace Artemis.UI.Screens.Shared
public Rect TransformContainingRect(Rect rect)
{
// Create the same transform group the view is using
- TransformGroup transformGroup = new TransformGroup();
+ TransformGroup transformGroup = new();
transformGroup.Children.Add(new ScaleTransform(Zoom, Zoom));
transformGroup.Children.Add(new TranslateTransform(PanX, PanY));
diff --git a/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs b/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs
index 7e854e4f5..70d14ed5d 100644
--- a/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs
+++ b/src/Artemis.UI/Screens/Sidebar/SidebarViewModel.cs
@@ -152,7 +152,7 @@ namespace Artemis.UI.Screens.Sidebar
if (SidebarModules.Any(io => io.Value == module))
return;
- FirstLevelNavigationItem sidebarItem = new FirstLevelNavigationItem
+ FirstLevelNavigationItem sidebarItem = new()
{
Icon = PluginUtilities.GetPluginIcon(module.Plugin, module.DisplayIcon),
Label = module.DisplayName
diff --git a/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs b/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs
index cd8e93da5..8d96c2147 100644
--- a/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs
+++ b/src/Artemis.UI/Screens/SurfaceEditor/Dialogs/SurfaceDeviceConfigViewModel.cs
@@ -49,7 +49,7 @@ namespace Artemis.UI.Screens.SurfaceEditor.Dialogs
if (!_displayOnDevices)
return;
- using SKPaint overlayPaint = new SKPaint
+ using SKPaint overlayPaint = new()
{
Color = CurrentColor
};
diff --git a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs
index 1486e6248..b0b89984a 100644
--- a/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs
+++ b/src/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorViewModel.cs
@@ -173,7 +173,7 @@ namespace Artemis.UI.Screens.SurfaceEditor
lock (Devices)
{
List existing = Devices.ToList();
- List deviceViewModels = new List();
+ List deviceViewModels = new();
// Add missing/update existing
foreach (ArtemisDevice surfaceDeviceConfiguration in SelectedSurface.Devices.OrderBy(d => d.ZIndex).ToList())
@@ -367,7 +367,7 @@ namespace Artemis.UI.Screens.SurfaceEditor
private void StartMouseDrag(object sender, Point position, Point relative)
{
// If drag started on top of a device, initialise dragging
- RectangleGeometry selectedRect = new RectangleGeometry(new Rect(position, new Size(1, 1)));
+ RectangleGeometry selectedRect = new(new Rect(position, new Size(1, 1)));
SurfaceDeviceViewModel device = HitTestUtilities.GetHitViewModels((Visual) sender, selectedRect).FirstOrDefault();
if (device != null)
{
@@ -401,7 +401,7 @@ namespace Artemis.UI.Screens.SurfaceEditor
{
if (_mouseDragStatus != MouseDragStatus.Dragging)
{
- RectangleGeometry selectedRect = new RectangleGeometry(new Rect(_mouseDragStartPoint, position));
+ RectangleGeometry selectedRect = new(new Rect(_mouseDragStartPoint, position));
List devices = HitTestUtilities.GetHitViewModels((Visual) sender, selectedRect);
foreach (SurfaceDeviceViewModel device in Devices)
if (devices.Contains(device))
@@ -421,7 +421,7 @@ namespace Artemis.UI.Screens.SurfaceEditor
if (IsPanKeyDown())
return;
- Rect selectedRect = new Rect(_mouseDragStartPoint, position);
+ Rect selectedRect = new(_mouseDragStartPoint, position);
SelectionRectangle.Rect = selectedRect;
List devices = HitTestUtilities.GetHitViewModels((Visual) sender, SelectionRectangle);
diff --git a/src/Artemis.UI/Services/LayerEditorService.cs b/src/Artemis.UI/Services/LayerEditorService.cs
index 7fad79c3d..fcaa1143d 100644
--- a/src/Artemis.UI/Services/LayerEditorService.cs
+++ b/src/Artemis.UI/Services/LayerEditorService.cs
@@ -2,7 +2,6 @@
using System.Windows;
using System.Windows.Media;
using Artemis.Core;
-using Artemis.Core.Services;
using Artemis.UI.Services.Interfaces;
using SkiaSharp;
using SkiaSharp.Views.WPF;
@@ -11,18 +10,11 @@ namespace Artemis.UI.Services
{
public class LayerEditorService : ILayerEditorService
{
- private readonly ISettingsService _settingsService;
-
- public LayerEditorService(ISettingsService settingsService)
- {
- _settingsService = settingsService;
- }
-
///
public Rect GetLayerBounds(Layer layer)
{
// Adjust the render rectangle for the difference in render scale
- return new Rect(
+ return new(
layer.Bounds.Left,
layer.Bounds.Top,
Math.Max(0, layer.Bounds.Width),
@@ -39,7 +31,7 @@ namespace Artemis.UI.Services
positionProperty = positionOverride.Value;
// Start at the center of the shape
- Point position = new Point(layerBounds.MidX, layerBounds.MidY);
+ Point position = new(layerBounds.MidX, layerBounds.MidY);
// Apply translation
position.X += positionProperty.X * layerBounds.Width;
@@ -64,7 +56,7 @@ namespace Artemis.UI.Services
double x = anchorPosition.X - layerBounds.MidX - anchorProperty.X * layerBounds.Width;
double y = anchorPosition.Y - layerBounds.MidY - anchorProperty.Y * layerBounds.Height;
- TransformGroup transformGroup = new TransformGroup();
+ TransformGroup transformGroup = new();
transformGroup.Children.Add(new TranslateTransform(x, y));
transformGroup.Children.Add(new ScaleTransform(layer.Transform.Scale.CurrentValue.Width / 100f, layer.Transform.Scale.CurrentValue.Height / 100f, anchorPosition.X, anchorPosition.Y));
transformGroup.Children.Add(new RotateTransform(layer.Transform.Rotation.CurrentValue, anchorPosition.X, anchorPosition.Y));
@@ -88,7 +80,7 @@ namespace Artemis.UI.Services
float x = anchorPosition.X - layerBounds.MidX - anchorProperty.X * layerBounds.Width;
float y = anchorPosition.Y - layerBounds.MidY - anchorProperty.Y * layerBounds.Height;
- SKPath path = new SKPath();
+ SKPath path = new();
path.AddRect(layerBounds);
if (includeTranslation)
path.Transform(SKMatrix.CreateTranslation(x, y));
diff --git a/src/Artemis.UI/Stylet/NinjectBootstrapper.cs b/src/Artemis.UI/Stylet/NinjectBootstrapper.cs
index 40103e939..1d96cbd20 100644
--- a/src/Artemis.UI/Stylet/NinjectBootstrapper.cs
+++ b/src/Artemis.UI/Stylet/NinjectBootstrapper.cs
@@ -39,7 +39,7 @@ namespace Artemis.UI.Stylet
///
protected virtual void DefaultConfigureIoC(IKernel kernel)
{
- ViewManagerConfig viewManagerConfig = new ViewManagerConfig
+ ViewManagerConfig viewManagerConfig = new()
{
ViewFactory = GetInstance,
ViewAssemblies = new List {GetType().Assembly}
diff --git a/src/Artemis.UI/Utilities/ThemeWatcher.cs b/src/Artemis.UI/Utilities/ThemeWatcher.cs
index 175dd7a42..29e577079 100644
--- a/src/Artemis.UI/Utilities/ThemeWatcher.cs
+++ b/src/Artemis.UI/Utilities/ThemeWatcher.cs
@@ -30,7 +30,7 @@ namespace Artemis.UI.Utilities
try
{
- ManagementEventWatcher watcher = new ManagementEventWatcher(query);
+ ManagementEventWatcher watcher = new(query);
watcher.EventArrived += (sender, args) =>
{
WindowsTheme newWindowsTheme = GetWindowsTheme();
diff --git a/src/Artemis.sln.DotSettings b/src/Artemis.sln.DotSettings
index 8578a1102..46df82de4 100644
--- a/src/Artemis.sln.DotSettings
+++ b/src/Artemis.sln.DotSettings
@@ -1,6 +1,8 @@
True
+ ERROR
Built-in: Full Cleanup
+ True
NEVER
200
200