mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Code style - Omit the type in a new expressions
This commit is contained in:
parent
099f56f4fe
commit
10e6cdc54b
@ -35,7 +35,7 @@ namespace Artemis.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The plugin info used by core components of Artemis
|
/// The plugin info used by core components of Artemis
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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)
|
Guid = Guid.Parse("ffffffff-ffff-ffff-ffff-ffffffffffff"), Name = "Artemis Core", Version = new Version(2, 0)
|
||||||
};
|
};
|
||||||
@ -43,16 +43,16 @@ namespace Artemis.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The plugin used by core components of Artemis
|
/// The plugin used by core components of Artemis
|
||||||
/// </summary>
|
/// </summary>
|
||||||
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 CorePluginFeature CorePluginFeature = new() {Plugin = CorePlugin};
|
||||||
internal static readonly EffectPlaceholderPlugin EffectPlaceholderPlugin = new EffectPlaceholderPlugin {Plugin = CorePlugin};
|
internal static readonly EffectPlaceholderPlugin EffectPlaceholderPlugin = new() {Plugin = CorePlugin};
|
||||||
|
|
||||||
internal static JsonSerializerSettings JsonConvertSettings = new JsonSerializerSettings
|
internal static JsonSerializerSettings JsonConvertSettings = new()
|
||||||
{
|
{
|
||||||
Converters = new List<JsonConverter> {new SKColorConverter(), new ForgivingIntConverter()}
|
Converters = new List<JsonConverter> {new SKColorConverter(), new ForgivingIntConverter()}
|
||||||
};
|
};
|
||||||
internal static JsonSerializerSettings JsonConvertTypedSettings = new JsonSerializerSettings
|
internal static JsonSerializerSettings JsonConvertTypedSettings = new()
|
||||||
{
|
{
|
||||||
TypeNameHandling = TypeNameHandling.All,
|
TypeNameHandling = TypeNameHandling.All,
|
||||||
Converters = new List<JsonConverter> { new SKColorConverter(), new ForgivingIntConverter() }
|
Converters = new List<JsonConverter> { new SKColorConverter(), new ForgivingIntConverter() }
|
||||||
|
|||||||
@ -84,7 +84,7 @@ namespace Artemis.Core
|
|||||||
|
|
||||||
IEnumerable<TSource> _()
|
IEnumerable<TSource> _()
|
||||||
{
|
{
|
||||||
HashSet<TKey> knownKeys = new HashSet<TKey>(comparer);
|
HashSet<TKey> knownKeys = new(comparer);
|
||||||
foreach (TSource element in source)
|
foreach (TSource element in source)
|
||||||
{
|
{
|
||||||
if (knownKeys.Add(keySelector(element)))
|
if (knownKeys.Add(keySelector(element)))
|
||||||
|
|||||||
@ -19,7 +19,7 @@ namespace Artemis.Core
|
|||||||
public static string GetProcessFilename(this Process p)
|
public static string GetProcessFilename(this Process p)
|
||||||
{
|
{
|
||||||
int capacity = 2000;
|
int capacity = 2000;
|
||||||
StringBuilder builder = new StringBuilder(capacity);
|
StringBuilder builder = new(capacity);
|
||||||
IntPtr ptr = OpenProcess(ProcessAccessFlags.QueryLimitedInformation, false, p.Id);
|
IntPtr ptr = OpenProcess(ProcessAccessFlags.QueryLimitedInformation, false, p.Id);
|
||||||
if (!QueryFullProcessImageName(ptr, 0, builder, ref capacity)) return string.Empty;
|
if (!QueryFullProcessImageName(ptr, 0, builder, ref capacity)) return string.Empty;
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
public static string GetDeviceIdentifier(this IRGBDevice rgbDevice)
|
public static string GetDeviceIdentifier(this IRGBDevice rgbDevice)
|
||||||
{
|
{
|
||||||
StringBuilder builder = new StringBuilder();
|
StringBuilder builder = new();
|
||||||
builder.Append(rgbDevice.DeviceInfo.DeviceName);
|
builder.Append(rgbDevice.DeviceInfo.DeviceName);
|
||||||
builder.Append('-');
|
builder.Append('-');
|
||||||
builder.Append(rgbDevice.DeviceInfo.Manufacturer);
|
builder.Append(rgbDevice.DeviceInfo.Manufacturer);
|
||||||
|
|||||||
@ -16,7 +16,7 @@ namespace Artemis.Core
|
|||||||
/// <returns>The RGB.NET color</returns>
|
/// <returns>The RGB.NET color</returns>
|
||||||
public static Color ToRgbColor(this SKColor 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -49,7 +49,7 @@ namespace Artemis.Core
|
|||||||
/// <returns>The sum of the two colors</returns>
|
/// <returns>The sum of the two colors</returns>
|
||||||
public static SKColor Sum(this SKColor a, SKColor b)
|
public static SKColor Sum(this SKColor a, SKColor b)
|
||||||
{
|
{
|
||||||
return new SKColor(
|
return new(
|
||||||
ClampToByte(a.Red + b.Red),
|
ClampToByte(a.Red + b.Red),
|
||||||
ClampToByte(a.Green + b.Green),
|
ClampToByte(a.Green + b.Green),
|
||||||
ClampToByte(a.Blue + b.Blue),
|
ClampToByte(a.Blue + b.Blue),
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Artemis.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class TypeExtensions
|
public static class TypeExtensions
|
||||||
{
|
{
|
||||||
private static readonly Dictionary<Type, List<Type>> PrimitiveTypeConversions = new Dictionary<Type, List<Type>>
|
private static readonly Dictionary<Type, List<Type>> PrimitiveTypeConversions = new()
|
||||||
{
|
{
|
||||||
{typeof(decimal), new List<Type> {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char)}},
|
{typeof(decimal), new List<Type> {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char)}},
|
||||||
{typeof(double), new List<Type> {typeof(sbyte), typeof(byte), typeof(short), typeof(ushort), typeof(int), typeof(uint), typeof(long), typeof(ulong), typeof(char), typeof(float)}},
|
{typeof(double), new List<Type> {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<Type> {typeof(byte)}}
|
{typeof(short), new List<Type> {typeof(byte)}}
|
||||||
};
|
};
|
||||||
|
|
||||||
private static readonly Dictionary<Type, string> TypeKeywords = new Dictionary<Type, string>
|
private static readonly Dictionary<Type, string> TypeKeywords = new()
|
||||||
{
|
{
|
||||||
{typeof(bool), "bool"},
|
{typeof(bool), "bool"},
|
||||||
{typeof(byte), "byte"},
|
{typeof(byte), "byte"},
|
||||||
|
|||||||
@ -34,7 +34,7 @@ namespace Artemis.Core
|
|||||||
return Stops.OrderBy(c => c.Position).Select(c => c.Color).ToArray();
|
return Stops.OrderBy(c => c.Position).Select(c => c.Color).ToArray();
|
||||||
|
|
||||||
List<SKColor> colors = Stops.OrderBy(c => c.Position).Select(c => c.Color).ToList();
|
List<SKColor> colors = Stops.OrderBy(c => c.Position).Select(c => c.Color).ToList();
|
||||||
List<SKColor> result = new List<SKColor>();
|
List<SKColor> result = new();
|
||||||
|
|
||||||
for (int i = 0; i <= timesToRepeat; i++)
|
for (int i = 0; i <= timesToRepeat; i++)
|
||||||
result.AddRange(colors);
|
result.AddRange(colors);
|
||||||
@ -57,7 +57,7 @@ namespace Artemis.Core
|
|||||||
|
|
||||||
// Create stops and a list of divided stops
|
// Create stops and a list of divided stops
|
||||||
List<float> stops = Stops.OrderBy(c => c.Position).Select(c => c.Position / (timesToRepeat + 1)).ToList();
|
List<float> stops = Stops.OrderBy(c => c.Position).Select(c => c.Position / (timesToRepeat + 1)).ToList();
|
||||||
List<float> result = new List<float>();
|
List<float> result = new();
|
||||||
|
|
||||||
// For each repeat cycle, add the base stops to the end result
|
// For each repeat cycle, add the base stops to the end result
|
||||||
for (int i = 0; i <= timesToRepeat; i++)
|
for (int i = 0; i <= timesToRepeat; i++)
|
||||||
@ -120,7 +120,7 @@ namespace Artemis.Core
|
|||||||
public static ColorGradient GetUnicornBarf()
|
public static ColorGradient GetUnicornBarf()
|
||||||
{
|
{
|
||||||
const int amount = 8;
|
const int amount = 8;
|
||||||
ColorGradient gradient = new ColorGradient();
|
ColorGradient gradient = new();
|
||||||
|
|
||||||
for (int i = 0; i <= amount; i++)
|
for (int i = 0; i <= amount; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Artemis.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class DataModelConditionPart : IDisposable
|
public abstract class DataModelConditionPart : IDisposable
|
||||||
{
|
{
|
||||||
private readonly List<DataModelConditionPart> _children = new List<DataModelConditionPart>();
|
private readonly List<DataModelConditionPart> _children = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the parent of this part
|
/// Gets the parent of this part
|
||||||
|
|||||||
@ -153,7 +153,7 @@ namespace Artemis.Core
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Ensure the list path is valid and points to a list
|
// 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
|
// Can't check this on an invalid list, if it becomes valid later lets hope for the best
|
||||||
if (eventPath.IsValid && !PointsToEvent(eventPath))
|
if (eventPath.IsValid && !PointsToEvent(eventPath))
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -177,7 +177,7 @@ namespace Artemis.Core
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Ensure the list path is valid and points to a list
|
// 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()!;
|
Type listType = listPath.GetPropertyType()!;
|
||||||
// Can't check this on an invalid list, if it becomes valid later lets hope for the best
|
// Can't check this on an invalid list, if it becomes valid later lets hope for the best
|
||||||
if (listPath.IsValid && !PointsToList(listPath))
|
if (listPath.IsValid && !PointsToList(listPath))
|
||||||
|
|||||||
@ -11,7 +11,7 @@ namespace Artemis.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ConditionalDataBinding<TLayerProperty, TProperty> : IDataBindingMode<TLayerProperty, TProperty>
|
public class ConditionalDataBinding<TLayerProperty, TProperty> : IDataBindingMode<TLayerProperty, TProperty>
|
||||||
{
|
{
|
||||||
private readonly List<DataBindingCondition<TLayerProperty, TProperty>> _conditions = new List<DataBindingCondition<TLayerProperty, TProperty>>();
|
private readonly List<DataBindingCondition<TLayerProperty, TProperty>> _conditions = new();
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
internal ConditionalDataBinding(DataBinding<TLayerProperty, TProperty> dataBinding, ConditionalDataBindingEntity entity)
|
internal ConditionalDataBinding(DataBinding<TLayerProperty, TProperty> dataBinding, ConditionalDataBindingEntity entity)
|
||||||
@ -81,7 +81,7 @@ namespace Artemis.Core
|
|||||||
if (_disposed)
|
if (_disposed)
|
||||||
throw new ObjectDisposedException("ConditionalDataBinding");
|
throw new ObjectDisposedException("ConditionalDataBinding");
|
||||||
|
|
||||||
DataBindingCondition<TLayerProperty, TProperty> condition = new DataBindingCondition<TLayerProperty, TProperty>(this);
|
DataBindingCondition<TLayerProperty, TProperty> condition = new(this);
|
||||||
_conditions.Add(condition);
|
_conditions.Add(condition);
|
||||||
|
|
||||||
ApplyOrder();
|
ApplyOrder();
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace Artemis.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class DirectDataBinding<TLayerProperty, TProperty> : IDataBindingMode<TLayerProperty, TProperty>
|
public class DirectDataBinding<TLayerProperty, TProperty> : IDataBindingMode<TLayerProperty, TProperty>
|
||||||
{
|
{
|
||||||
private readonly List<DataBindingModifier<TLayerProperty, TProperty>> _modifiers = new List<DataBindingModifier<TLayerProperty, TProperty>>();
|
private readonly List<DataBindingModifier<TLayerProperty, TProperty>> _modifiers = new();
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
|
|
||||||
internal DirectDataBinding(DataBinding<TLayerProperty, TProperty> dataBinding, DirectDataBindingEntity entity)
|
internal DirectDataBinding(DataBinding<TLayerProperty, TProperty> dataBinding, DirectDataBindingEntity entity)
|
||||||
@ -156,7 +156,7 @@ namespace Artemis.Core
|
|||||||
if (_disposed)
|
if (_disposed)
|
||||||
throw new ObjectDisposedException("DirectDataBinding");
|
throw new ObjectDisposedException("DirectDataBinding");
|
||||||
|
|
||||||
DataBindingModifier<TLayerProperty, TProperty> modifier = new DataBindingModifier<TLayerProperty, TProperty>(this, type);
|
DataBindingModifier<TLayerProperty, TProperty> modifier = new(this, type);
|
||||||
_modifiers.Add(modifier);
|
_modifiers.Add(modifier);
|
||||||
|
|
||||||
ApplyOrder();
|
ApplyOrder();
|
||||||
|
|||||||
@ -47,7 +47,7 @@ namespace Artemis.Core
|
|||||||
/// <para>Always empty if <see cref="TrackHistory" /> is <see langword="false" /></para>
|
/// <para>Always empty if <see cref="TrackHistory" /> is <see langword="false" /></para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataModelProperty(Description = "The arguments of the last time this event triggered")]
|
[DataModelProperty(Description = "The arguments of the last time this event triggered")]
|
||||||
public Queue<T> EventArgumentsHistory { get; } = new Queue<T>(20);
|
public Queue<T> EventArgumentsHistory { get; } = new(20);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Trigger the event with the given <paramref name="eventArgs" />
|
/// Trigger the event with the given <paramref name="eventArgs" />
|
||||||
@ -157,14 +157,14 @@ namespace Artemis.Core
|
|||||||
/// <para>Always empty if <see cref="TrackHistory" /> is <see langword="false" /></para>
|
/// <para>Always empty if <see cref="TrackHistory" /> is <see langword="false" /></para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataModelProperty(Description = "The arguments of the last time this event triggered")]
|
[DataModelProperty(Description = "The arguments of the last time this event triggered")]
|
||||||
public Queue<DataModelEventArgs> EventArgumentsHistory { get; } = new Queue<DataModelEventArgs>(20);
|
public Queue<DataModelEventArgs> EventArgumentsHistory { get; } = new(20);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Trigger the event
|
/// Trigger the event
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Trigger()
|
public void Trigger()
|
||||||
{
|
{
|
||||||
DataModelEventArgs eventArgs = new DataModelEventArgs {TriggerTime = DateTime.Now};
|
DataModelEventArgs eventArgs = new() {TriggerTime = DateTime.Now};
|
||||||
|
|
||||||
LastEventArguments = eventArgs;
|
LastEventArguments = eventArgs;
|
||||||
LastTrigger = DateTime.Now;
|
LastTrigger = DateTime.Now;
|
||||||
|
|||||||
@ -192,7 +192,7 @@ namespace Artemis.Core
|
|||||||
if (Target == null)
|
if (Target == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
DataModelPathSegment startSegment = new DataModelPathSegment(this, "target", "target");
|
DataModelPathSegment startSegment = new(this, "target", "target");
|
||||||
startSegment.Node = _segments.AddFirst(startSegment);
|
startSegment.Node = _segments.AddFirst(startSegment);
|
||||||
|
|
||||||
// On an empty path don't bother processing segments
|
// On an empty path don't bother processing segments
|
||||||
|
|||||||
@ -68,7 +68,7 @@ namespace Artemis.Core
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override List<ILayerProperty> GetAllLayerProperties()
|
public override List<ILayerProperty> GetAllLayerProperties()
|
||||||
{
|
{
|
||||||
List<ILayerProperty> result = new List<ILayerProperty>();
|
List<ILayerProperty> result = new();
|
||||||
foreach (BaseLayerEffect layerEffect in LayerEffects)
|
foreach (BaseLayerEffect layerEffect in LayerEffects)
|
||||||
if (layerEffect.BaseProperties != null)
|
if (layerEffect.BaseProperties != null)
|
||||||
result.AddRange(layerEffect.BaseProperties.GetAllLayerProperties());
|
result.AddRange(layerEffect.BaseProperties.GetAllLayerProperties());
|
||||||
@ -151,7 +151,7 @@ namespace Artemis.Core
|
|||||||
if (Disposed)
|
if (Disposed)
|
||||||
throw new ObjectDisposedException("Folder");
|
throw new ObjectDisposedException("Folder");
|
||||||
|
|
||||||
SKPath path = new SKPath {FillType = SKPathFillType.Winding};
|
SKPath path = new() {FillType = SKPathFillType.Winding};
|
||||||
foreach (ProfileElement child in Children)
|
foreach (ProfileElement child in Children)
|
||||||
if (child is RenderProfileElement effectChild && effectChild.Path != null)
|
if (child is RenderProfileElement effectChild && effectChild.Path != null)
|
||||||
path.AddPath(effectChild.Path);
|
path.AddPath(effectChild.Path);
|
||||||
|
|||||||
@ -125,7 +125,7 @@ namespace Artemis.Core
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override List<ILayerProperty> GetAllLayerProperties()
|
public override List<ILayerProperty> GetAllLayerProperties()
|
||||||
{
|
{
|
||||||
List<ILayerProperty> result = new List<ILayerProperty>();
|
List<ILayerProperty> result = new();
|
||||||
result.AddRange(General.GetAllLayerProperties());
|
result.AddRange(General.GetAllLayerProperties());
|
||||||
result.AddRange(Transform.GetAllLayerProperties());
|
result.AddRange(Transform.GetAllLayerProperties());
|
||||||
if (LayerBrush?.BaseProperties != null)
|
if (LayerBrush?.BaseProperties != null)
|
||||||
@ -221,7 +221,7 @@ namespace Artemis.Core
|
|||||||
LayerEntity.Leds.Clear();
|
LayerEntity.Leds.Clear();
|
||||||
foreach (ArtemisLed artemisLed in Leds)
|
foreach (ArtemisLed artemisLed in Leds)
|
||||||
{
|
{
|
||||||
LedEntity ledEntity = new LedEntity
|
LedEntity ledEntity = new()
|
||||||
{
|
{
|
||||||
DeviceIdentifier = artemisLed.Device.RgbDevice.GetDeviceIdentifier(),
|
DeviceIdentifier = artemisLed.Device.RgbDevice.GetDeviceIdentifier(),
|
||||||
LedName = artemisLed.RgbLed.Id.ToString()
|
LedName = artemisLed.RgbLed.Id.ToString()
|
||||||
@ -336,7 +336,7 @@ namespace Artemis.Core
|
|||||||
Renderer.Paint.BlendMode = General.BlendMode.CurrentValue;
|
Renderer.Paint.BlendMode = General.BlendMode.CurrentValue;
|
||||||
Renderer.Paint.Color = new SKColor(0, 0, 0, (byte) (Transform.Opacity.CurrentValue * 2.55f));
|
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)
|
if (General.ShapeType.CurrentValue == LayerShapeType.Rectangle)
|
||||||
renderPath.AddRect(Renderer.Path.Bounds);
|
renderPath.AddRect(Renderer.Path.Bounds);
|
||||||
else
|
else
|
||||||
@ -415,7 +415,7 @@ namespace Artemis.Core
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SKPath path = new SKPath {FillType = SKPathFillType.Winding};
|
SKPath path = new() {FillType = SKPathFillType.Winding};
|
||||||
foreach (ArtemisLed artemisLed in Leds)
|
foreach (ArtemisLed artemisLed in Leds)
|
||||||
path.AddRect(artemisLed.AbsoluteRectangle);
|
path.AddRect(artemisLed.AbsoluteRectangle);
|
||||||
|
|
||||||
@ -569,7 +569,7 @@ namespace Artemis.Core
|
|||||||
if (Disposed)
|
if (Disposed)
|
||||||
throw new ObjectDisposedException("Layer");
|
throw new ObjectDisposedException("Layer");
|
||||||
|
|
||||||
List<ArtemisLed> leds = new List<ArtemisLed>();
|
List<ArtemisLed> leds = new();
|
||||||
|
|
||||||
// Get the surface LEDs for this layer
|
// Get the surface LEDs for this layer
|
||||||
List<ArtemisLed> availableLeds = surface.Devices.SelectMany(d => d.Leds).ToList();
|
List<ArtemisLed> availableLeds = surface.Devices.SelectMany(d => d.Leds).ToList();
|
||||||
|
|||||||
@ -292,7 +292,7 @@ namespace Artemis.Core
|
|||||||
if (value == null)
|
if (value == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
LayerPropertyKeyframe<T> keyframe = new LayerPropertyKeyframe<T>(
|
LayerPropertyKeyframe<T> keyframe = new(
|
||||||
CoreJson.DeserializeObject<T>(keyframeEntity.Value)!, keyframeEntity.Position, (Easings.Functions) keyframeEntity.EasingFunction, this
|
CoreJson.DeserializeObject<T>(keyframeEntity.Value)!, keyframeEntity.Position, (Easings.Functions) keyframeEntity.EasingFunction, this
|
||||||
);
|
);
|
||||||
AddKeyframe(keyframe);
|
AddKeyframe(keyframe);
|
||||||
@ -366,9 +366,9 @@ namespace Artemis.Core
|
|||||||
#region Data bindings
|
#region Data bindings
|
||||||
|
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
internal readonly List<IDataBindingRegistration> _dataBindingRegistrations = new List<IDataBindingRegistration>();
|
internal readonly List<IDataBindingRegistration> _dataBindingRegistrations = new();
|
||||||
|
|
||||||
internal readonly List<IDataBinding> _dataBindings = new List<IDataBinding>();
|
internal readonly List<IDataBinding> _dataBindings = new();
|
||||||
// ReSharper restore InconsistentNaming
|
// ReSharper restore InconsistentNaming
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -444,7 +444,7 @@ namespace Artemis.Core
|
|||||||
if (dataBindingRegistration.DataBinding != null)
|
if (dataBindingRegistration.DataBinding != null)
|
||||||
throw new ArtemisCoreException("Provided data binding registration already has an enabled data binding");
|
throw new ArtemisCoreException("Provided data binding registration already has an enabled data binding");
|
||||||
|
|
||||||
DataBinding<T, TProperty> dataBinding = new DataBinding<T, TProperty>(dataBindingRegistration);
|
DataBinding<T, TProperty> dataBinding = new(dataBindingRegistration);
|
||||||
_dataBindings.Add(dataBinding);
|
_dataBindings.Add(dataBinding);
|
||||||
|
|
||||||
OnDataBindingEnabled(new LayerPropertyEventArgs<T>(dataBinding.LayerProperty));
|
OnDataBindingEnabled(new LayerPropertyEventArgs<T>(dataBinding.LayerProperty));
|
||||||
|
|||||||
@ -66,7 +66,7 @@ namespace Artemis.Core
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public KeyframeEntity GetKeyframeEntity()
|
public KeyframeEntity GetKeyframeEntity()
|
||||||
{
|
{
|
||||||
return new KeyframeEntity
|
return new()
|
||||||
{
|
{
|
||||||
Value = CoreJson.SerializeObject(Value),
|
Value = CoreJson.SerializeObject(Value),
|
||||||
Position = Position,
|
Position = Position,
|
||||||
|
|||||||
@ -113,7 +113,7 @@ namespace Artemis.Core
|
|||||||
if (!PropertiesInitialized)
|
if (!PropertiesInitialized)
|
||||||
return new List<ILayerProperty>();
|
return new List<ILayerProperty>();
|
||||||
|
|
||||||
List<ILayerProperty> result = new List<ILayerProperty>(LayerProperties);
|
List<ILayerProperty> result = new(LayerProperties);
|
||||||
foreach (LayerPropertyGroup layerPropertyGroup in LayerPropertyGroups)
|
foreach (LayerPropertyGroup layerPropertyGroup in LayerPropertyGroups)
|
||||||
result.AddRange(layerPropertyGroup.GetAllLayerProperties());
|
result.AddRange(layerPropertyGroup.GetAllLayerProperties());
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace Artemis.Core
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void CalculateRenderProperties()
|
public override void CalculateRenderProperties()
|
||||||
{
|
{
|
||||||
SKPath path = new SKPath();
|
SKPath path = new();
|
||||||
path.AddOval(SKRect.Create(Layer.Bounds.Width, Layer.Bounds.Height));
|
path.AddOval(SKRect.Create(Layer.Bounds.Width, Layer.Bounds.Height));
|
||||||
Path = path;
|
Path = path;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace Artemis.Core
|
|||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void CalculateRenderProperties()
|
public override void CalculateRenderProperties()
|
||||||
{
|
{
|
||||||
SKPath path = new SKPath();
|
SKPath path = new();
|
||||||
path.AddRect(SKRect.Create(Layer.Bounds.Width, Layer.Bounds.Height));
|
path.AddRect(SKRect.Create(Layer.Bounds.Width, Layer.Bounds.Height));
|
||||||
Path = path;
|
Path = path;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace Artemis.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class Profile : ProfileElement
|
public sealed class Profile : ProfileElement
|
||||||
{
|
{
|
||||||
private readonly object _lock = new object();
|
private readonly object _lock = new();
|
||||||
private bool _isActivated;
|
private bool _isActivated;
|
||||||
|
|
||||||
internal Profile(ProfileModule module, string name) : base(null!)
|
internal Profile(ProfileModule module, string name) : base(null!)
|
||||||
@ -26,7 +26,7 @@ namespace Artemis.Core
|
|||||||
UndoStack = new Stack<string>();
|
UndoStack = new Stack<string>();
|
||||||
RedoStack = new Stack<string>();
|
RedoStack = new Stack<string>();
|
||||||
|
|
||||||
Folder _ = new Folder(this, "Root folder");
|
Folder _ = new(this, "Root folder");
|
||||||
Save();
|
Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ namespace Artemis.Core
|
|||||||
FolderEntity? rootFolder = ProfileEntity.Folders.FirstOrDefault(f => f.ParentId == EntityId);
|
FolderEntity? rootFolder = ProfileEntity.Folders.FirstOrDefault(f => f.ParentId == EntityId);
|
||||||
if (rootFolder == null)
|
if (rootFolder == null)
|
||||||
{
|
{
|
||||||
Folder _ = new Folder(this, "Root folder");
|
Folder _ = new(this, "Root folder");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -189,7 +189,7 @@ namespace Artemis.Core
|
|||||||
if (Disposed)
|
if (Disposed)
|
||||||
throw new ObjectDisposedException(GetType().Name);
|
throw new ObjectDisposedException(GetType().Name);
|
||||||
|
|
||||||
List<Folder> folders = new List<Folder>();
|
List<Folder> folders = new();
|
||||||
foreach (Folder childFolder in Children.Where(c => c is Folder).Cast<Folder>())
|
foreach (Folder childFolder in Children.Where(c => c is Folder).Cast<Folder>())
|
||||||
{
|
{
|
||||||
// Add all folders in this element
|
// Add all folders in this element
|
||||||
@ -210,7 +210,7 @@ namespace Artemis.Core
|
|||||||
if (Disposed)
|
if (Disposed)
|
||||||
throw new ObjectDisposedException(GetType().Name);
|
throw new ObjectDisposedException(GetType().Name);
|
||||||
|
|
||||||
List<Layer> layers = new List<Layer>();
|
List<Layer> layers = new();
|
||||||
|
|
||||||
// Add all layers in this element
|
// Add all layers in this element
|
||||||
layers.AddRange(Children.Where(c => c is Layer).Cast<Layer>());
|
layers.AddRange(Children.Where(c => c is Layer).Cast<Layer>());
|
||||||
|
|||||||
@ -67,7 +67,7 @@ namespace Artemis.Core
|
|||||||
RenderElementEntity.LayerEffects.Clear();
|
RenderElementEntity.LayerEffects.Clear();
|
||||||
foreach (BaseLayerEffect layerEffect in LayerEffects)
|
foreach (BaseLayerEffect layerEffect in LayerEffects)
|
||||||
{
|
{
|
||||||
LayerEffectEntity layerEffectEntity = new LayerEffectEntity
|
LayerEffectEntity layerEffectEntity = new()
|
||||||
{
|
{
|
||||||
Id = layerEffect.EntityId,
|
Id = layerEffect.EntityId,
|
||||||
ProviderId = layerEffect.Descriptor?.PlaceholderFor ?? layerEffect.ProviderId,
|
ProviderId = layerEffect.Descriptor?.PlaceholderFor ?? layerEffect.ProviderId,
|
||||||
@ -208,7 +208,7 @@ namespace Artemis.Core
|
|||||||
if (descriptor == null)
|
if (descriptor == null)
|
||||||
throw new ArgumentNullException(nameof(descriptor));
|
throw new ArgumentNullException(nameof(descriptor));
|
||||||
|
|
||||||
LayerEffectEntity entity = new LayerEffectEntity
|
LayerEffectEntity entity = new()
|
||||||
{
|
{
|
||||||
Id = Guid.NewGuid(),
|
Id = Guid.NewGuid(),
|
||||||
Enabled = true,
|
Enabled = true,
|
||||||
|
|||||||
@ -12,7 +12,7 @@ namespace Artemis.Core
|
|||||||
public class Timeline : CorePropertyChanged, IStorageModel
|
public class Timeline : CorePropertyChanged, IStorageModel
|
||||||
{
|
{
|
||||||
private const int MaxExtraTimelines = 15;
|
private const int MaxExtraTimelines = 15;
|
||||||
private readonly object _lock = new object();
|
private readonly object _lock = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of the <see cref="Timeline" /> class
|
/// Creates a new instance of the <see cref="Timeline" /> class
|
||||||
|
|||||||
@ -288,7 +288,7 @@ namespace Artemis.Core
|
|||||||
foreach (ArtemisLed led in Leds)
|
foreach (ArtemisLed led in Leds)
|
||||||
led.CalculateRectangles();
|
led.CalculateRectangles();
|
||||||
|
|
||||||
SKPath path = new SKPath {FillType = SKPathFillType.Winding};
|
SKPath path = new() {FillType = SKPathFillType.Winding};
|
||||||
foreach (ArtemisLed artemisLed in Leds)
|
foreach (ArtemisLed artemisLed in Leds)
|
||||||
path.AddRect(artemisLed.AbsoluteRectangle);
|
path.AddRect(artemisLed.AbsoluteRectangle);
|
||||||
|
|
||||||
|
|||||||
@ -12,8 +12,8 @@ namespace Artemis.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class ArtemisSurface : CorePropertyChanged
|
public class ArtemisSurface : CorePropertyChanged
|
||||||
{
|
{
|
||||||
private List<ArtemisDevice> _devices = new List<ArtemisDevice>();
|
private List<ArtemisDevice> _devices = new();
|
||||||
private ReadOnlyDictionary<Led, ArtemisLed> _ledMap = new ReadOnlyDictionary<Led, ArtemisLed>(new Dictionary<Led, ArtemisLed>());
|
private ReadOnlyDictionary<Led, ArtemisLed> _ledMap = new(new Dictionary<Led, ArtemisLed>());
|
||||||
private bool _isActive;
|
private bool _isActive;
|
||||||
private string _name;
|
private string _name;
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace Artemis.Core.Ninject
|
|||||||
{
|
{
|
||||||
internal class LoggerProvider : Provider<ILogger>
|
internal class LoggerProvider : Provider<ILogger>
|
||||||
{
|
{
|
||||||
internal static readonly LoggingLevelSwitch LoggingLevelSwitch = new LoggingLevelSwitch(LogEventLevel.Verbose);
|
internal static readonly LoggingLevelSwitch LoggingLevelSwitch = new(LogEventLevel.Verbose);
|
||||||
|
|
||||||
private static readonly ILogger Logger = new LoggerConfiguration()
|
private static readonly ILogger Logger = new LoggerConfiguration()
|
||||||
.Enrich.FromLogContext()
|
.Enrich.FromLogContext()
|
||||||
|
|||||||
@ -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
|
// TODO: Investigate if this can't just be set as a constant on the plugin child kernel
|
||||||
internal class PluginSettingsProvider : Provider<PluginSettings>
|
internal class PluginSettingsProvider : Provider<PluginSettings>
|
||||||
{
|
{
|
||||||
private static readonly List<PluginSettings> PluginSettings = new List<PluginSettings>();
|
private static readonly List<PluginSettings> PluginSettings = new();
|
||||||
private readonly IPluginRepository _pluginRepository;
|
private readonly IPluginRepository _pluginRepository;
|
||||||
private readonly IPluginManagementService _pluginManagementService;
|
private readonly IPluginManagementService _pluginManagementService;
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ namespace Artemis.Core.Ninject
|
|||||||
if (existingSettings != null)
|
if (existingSettings != null)
|
||||||
return existingSettings;
|
return existingSettings;
|
||||||
|
|
||||||
PluginSettings? settings = new PluginSettings(plugin, _pluginRepository);
|
PluginSettings? settings = new(plugin, _pluginRepository);
|
||||||
PluginSettings.Add(settings);
|
PluginSettings.Add(settings);
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ namespace Artemis.Core.DataModelExpansions
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class DataModel
|
public abstract class DataModel
|
||||||
{
|
{
|
||||||
private readonly Dictionary<string, DataModel> _dynamicDataModels = new Dictionary<string, DataModel>();
|
private readonly Dictionary<string, DataModel> _dynamicDataModels = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of the <see cref="DataModel" /> class
|
/// Creates a new instance of the <see cref="DataModel" /> class
|
||||||
@ -47,7 +47,7 @@ namespace Artemis.Core.DataModelExpansions
|
|||||||
/// Gets an read-only dictionary of all dynamic data models
|
/// Gets an read-only dictionary of all dynamic data models
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataModelIgnore]
|
[DataModelIgnore]
|
||||||
public ReadOnlyDictionary<string, DataModel> DynamicDataModels => new ReadOnlyDictionary<string, DataModel>(_dynamicDataModels);
|
public ReadOnlyDictionary<string, DataModel> DynamicDataModels => new(_dynamicDataModels);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns a read-only collection of all properties in this datamodel that are to be ignored
|
/// Returns a read-only collection of all properties in this datamodel that are to be ignored
|
||||||
|
|||||||
@ -13,7 +13,7 @@ namespace Artemis.Core.DataModelExpansions
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
|
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal readonly List<PropertyInfo> HiddenPropertiesList = new List<PropertyInfo>();
|
protected internal readonly List<PropertyInfo> HiddenPropertiesList = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
|
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
|
||||||
@ -41,7 +41,7 @@ namespace Artemis.Core.DataModelExpansions
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual DataModelPropertyAttribute GetDataModelDescription()
|
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};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ namespace Artemis.Core.DeviceProviders
|
|||||||
[Inject]
|
[Inject]
|
||||||
public ILogger? Logger { get; set; }
|
public ILogger? Logger { get; set; }
|
||||||
|
|
||||||
internal Dictionary<IRGBDevice, string> DeviceLayoutPaths { get; set; } = new Dictionary<IRGBDevice, string>();
|
internal Dictionary<IRGBDevice, string> DeviceLayoutPaths { get; set; } = new();
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void Disable()
|
public override void Disable()
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace Artemis.Core.LayerBrushes
|
|||||||
if (!IsEnabled)
|
if (!IsEnabled)
|
||||||
throw new ArtemisPluginException(Plugin, "Can only add a layer brush descriptor when the plugin is enabled");
|
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);
|
_layerBrushDescriptors.Add(descriptor);
|
||||||
LayerBrushStore.Add(descriptor);
|
LayerBrushStore.Add(descriptor);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,8 +34,8 @@ namespace Artemis.Core.LayerBrushes
|
|||||||
if (Layer.General.TransformMode.CurrentValue == LayerTransformMode.Normal && SupportsTransformation)
|
if (Layer.General.TransformMode.CurrentValue == LayerTransformMode.Normal && SupportsTransformation)
|
||||||
canvas.SetMatrix(canvas.TotalMatrix.PreConcat(Layer.GetTransformMatrix(true, false, false, true).Invert()));
|
canvas.SetMatrix(canvas.TotalMatrix.PreConcat(Layer.GetTransformMatrix(true, false, false, true).Invert()));
|
||||||
|
|
||||||
using SKPath pointsPath = new SKPath();
|
using SKPath pointsPath = new();
|
||||||
using SKPaint ledPaint = new SKPaint();
|
using SKPaint ledPaint = new();
|
||||||
foreach (ArtemisLed artemisLed in Layer.Leds)
|
foreach (ArtemisLed artemisLed in Layer.Leds)
|
||||||
{
|
{
|
||||||
pointsPath.AddPoly(new[]
|
pointsPath.AddPoly(new[]
|
||||||
|
|||||||
@ -87,7 +87,7 @@ namespace Artemis.Core.LayerEffects
|
|||||||
{
|
{
|
||||||
if (PlaceholderFor == null)
|
if (PlaceholderFor == null)
|
||||||
throw new ArtemisCoreException("Cannot create a placeholder instance using a layer effect descriptor that is not a placeholder for anything");
|
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,
|
ProfileElement = renderElement,
|
||||||
Descriptor = this
|
Descriptor = this
|
||||||
|
|||||||
@ -41,7 +41,7 @@ namespace Artemis.Core.LayerEffects
|
|||||||
if (!IsEnabled)
|
if (!IsEnabled)
|
||||||
throw new ArtemisPluginFeatureException(this, "Can only add a layer effect descriptor when the plugin is enabled");
|
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);
|
_layerEffectDescriptors.Add(descriptor);
|
||||||
LayerEffectStore.Add(descriptor);
|
LayerEffectStore.Add(descriptor);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
{
|
{
|
||||||
public static LayerEffectDescriptor Create(string missingProviderId)
|
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
|
PlaceholderFor = missingProviderId
|
||||||
};
|
};
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace Artemis.Core.Modules
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual DataModelPropertyAttribute GetDataModelDescription()
|
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()
|
internal override void InternalEnable()
|
||||||
@ -98,7 +98,7 @@ namespace Artemis.Core.Modules
|
|||||||
/// A list of activation requirements
|
/// A list of activation requirements
|
||||||
/// <para>Note: if empty the module is always activated</para>
|
/// <para>Note: if empty the module is always activated</para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<IModuleActivationRequirement> ActivationRequirements { get; } = new List<IModuleActivationRequirement>();
|
public List<IModuleActivationRequirement> ActivationRequirements { get; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the activation requirement mode, defaults to <see cref="ActivationRequirementType.Any" />
|
/// Gets or sets the activation requirement mode, defaults to <see cref="ActivationRequirementType.Any" />
|
||||||
|
|||||||
@ -46,7 +46,7 @@ namespace Artemis.Core.Modules
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public virtual DataModelPropertyAttribute GetDataModelDescription()
|
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};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -94,8 +94,8 @@ namespace Artemis.Core.Modules
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
|
/// Gets a list of all properties ignored at runtime using <c>IgnoreProperty(x => x.y)</c>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected internal readonly List<PropertyInfo> HiddenPropertiesList = new List<PropertyInfo>();
|
protected internal readonly List<PropertyInfo> HiddenPropertiesList = new();
|
||||||
private readonly object _lock = new object();
|
private readonly object _lock = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new instance of the <see cref="ProfileModule" /> class
|
/// Creates a new instance of the <see cref="ProfileModule" /> class
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace Artemis.Core
|
|||||||
_pluginRepository.AddSetting(settingEntity);
|
_pluginRepository.AddSetting(settingEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
PluginSetting<T> pluginSetting = new PluginSetting<T>(Plugin, _pluginRepository, settingEntity);
|
PluginSetting<T> pluginSetting = new(Plugin, _pluginRepository, settingEntity);
|
||||||
|
|
||||||
// This overrides null with the default value, I'm not sure if that's desirable because you
|
// 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
|
// might expect something to go null and you might not
|
||||||
|
|||||||
@ -13,7 +13,7 @@ namespace Artemis.Core
|
|||||||
private DateTime _lastEvent;
|
private DateTime _lastEvent;
|
||||||
private Timer? _timer;
|
private Timer? _timer;
|
||||||
private bool _disposed;
|
private bool _disposed;
|
||||||
private readonly object _lock = new object();
|
private readonly object _lock = new();
|
||||||
|
|
||||||
internal TimedUpdateRegistration(PluginFeature feature, TimeSpan interval, Action<double> action)
|
internal TimedUpdateRegistration(PluginFeature feature, TimeSpan interval, Action<double> action)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -45,7 +45,7 @@ namespace Artemis.Core
|
|||||||
public Rectangle RenderedRectangle { get; private set; }
|
public Rectangle RenderedRectangle { get; private set; }
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public Dictionary<BrushRenderTarget, Color> RenderedTargets { get; } = new Dictionary<BrushRenderTarget, Color>();
|
public Dictionary<BrushRenderTarget, Color> RenderedTargets { get; } = new();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the desired scale of the bitmap brush
|
/// 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;
|
ArtemisDevice? artemisDevice = Surface?.GetArtemisLed(renderTarget.Led)?.Device;
|
||||||
if (artemisDevice is not null)
|
if (artemisDevice is not null)
|
||||||
|
|||||||
@ -29,7 +29,7 @@ namespace Artemis.Core.Services
|
|||||||
if ((amount & (amount - 1)) != 0)
|
if ((amount & (amount - 1)) != 0)
|
||||||
throw new ArgumentException("Must be power of two", nameof(amount));
|
throw new ArgumentException("Must be power of two", nameof(amount));
|
||||||
|
|
||||||
Queue<ColorCube> cubes = new Queue<ColorCube>(amount);
|
Queue<ColorCube> cubes = new(amount);
|
||||||
cubes.Enqueue(new ColorCube(colors));
|
cubes.Enqueue(new ColorCube(colors));
|
||||||
|
|
||||||
while (cubes.Count < amount)
|
while (cubes.Count < amount)
|
||||||
|
|||||||
@ -32,10 +32,10 @@ namespace Artemis.Core.Services
|
|||||||
private readonly PluginSetting<double> _renderScale;
|
private readonly PluginSetting<double> _renderScale;
|
||||||
private readonly IRgbService _rgbService;
|
private readonly IRgbService _rgbService;
|
||||||
private readonly ISurfaceService _surfaceService;
|
private readonly ISurfaceService _surfaceService;
|
||||||
private readonly List<Exception> _updateExceptions = new List<Exception>();
|
private readonly List<Exception> _updateExceptions = new();
|
||||||
private List<BaseDataModelExpansion> _dataModelExpansions = new List<BaseDataModelExpansion>();
|
private List<BaseDataModelExpansion> _dataModelExpansions = new();
|
||||||
private DateTime _lastExceptionLog;
|
private DateTime _lastExceptionLog;
|
||||||
private List<Module> _modules = new List<Module>();
|
private List<Module> _modules = new();
|
||||||
|
|
||||||
// ReSharper disable UnusedParameter.Local - Storage migration and module service are injected early to ensure it runs before anything else
|
// 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,
|
public CoreService(IKernel kernel, ILogger logger, StorageMigrationService _, ISettingsService settingsService, IPluginManagementService pluginManagementService,
|
||||||
@ -112,7 +112,7 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
public void PlayIntroAnimation()
|
public void PlayIntroAnimation()
|
||||||
{
|
{
|
||||||
IntroAnimation intro = new IntroAnimation(_logger, _profileService, _surfaceService);
|
IntroAnimation intro = new(_logger, _profileService, _surfaceService);
|
||||||
|
|
||||||
// Draw a white overlay over the device
|
// Draw a white overlay over the device
|
||||||
void DrawOverlay(object? sender, FrameRenderingEventArgs args)
|
void DrawOverlay(object? sender, FrameRenderingEventArgs args)
|
||||||
@ -183,7 +183,7 @@ namespace Artemis.Core.Services
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Render all active modules
|
// 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.Scale((float) _renderScale.Value);
|
||||||
canvas.Clear(new SKColor(0, 0, 0));
|
canvas.Clear(new SKColor(0, 0, 0));
|
||||||
if (!ModuleRenderingDisabled)
|
if (!ModuleRenderingDisabled)
|
||||||
|
|||||||
@ -16,7 +16,7 @@ namespace Artemis.Core.Services
|
|||||||
private void BlinkDevice(ArtemisDevice device, int blinkCount)
|
private void BlinkDevice(ArtemisDevice device, int blinkCount)
|
||||||
{
|
{
|
||||||
// Create a LED group way at the top
|
// 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)),
|
Brush = new SolidColorBrush(new Color(255, 255, 255)),
|
||||||
ZIndex = 999
|
ZIndex = 999
|
||||||
|
|||||||
@ -5,7 +5,7 @@ namespace Artemis.Core.Services
|
|||||||
{
|
{
|
||||||
internal static class InputKeyUtilities
|
internal static class InputKeyUtilities
|
||||||
{
|
{
|
||||||
internal static readonly Dictionary<KeyboardKey, LedId> KeyboardKeyLedIdMap = new Dictionary<KeyboardKey, LedId>
|
internal static readonly Dictionary<KeyboardKey, LedId> KeyboardKeyLedIdMap = new()
|
||||||
{
|
{
|
||||||
{KeyboardKey.None, LedId.Keyboard_Custom1},
|
{KeyboardKey.None, LedId.Keyboard_Custom1},
|
||||||
{KeyboardKey.Cancel, LedId.Keyboard_Custom2},
|
{KeyboardKey.Cancel, LedId.Keyboard_Custom2},
|
||||||
@ -182,7 +182,7 @@ namespace Artemis.Core.Services
|
|||||||
{KeyboardKey.NumPadEnter, LedId.Keyboard_NumEnter}
|
{KeyboardKey.NumPadEnter, LedId.Keyboard_NumEnter}
|
||||||
};
|
};
|
||||||
|
|
||||||
internal static readonly Dictionary<MouseButton, LedId> MouseButtonLedIdMap = new Dictionary<MouseButton, LedId>
|
internal static readonly Dictionary<MouseButton, LedId> MouseButtonLedIdMap = new()
|
||||||
{
|
{
|
||||||
{MouseButton.Left, LedId.Mouse1},
|
{MouseButton.Left, LedId.Mouse1},
|
||||||
{MouseButton.Middle, LedId.Mouse2},
|
{MouseButton.Middle, LedId.Mouse2},
|
||||||
|
|||||||
@ -34,7 +34,7 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
#region Providers
|
#region Providers
|
||||||
|
|
||||||
private readonly List<InputProvider> _inputProviders = new List<InputProvider>();
|
private readonly List<InputProvider> _inputProviders = new();
|
||||||
|
|
||||||
public void AddInputProvider(InputProvider inputProvider)
|
public void AddInputProvider(InputProvider inputProvider)
|
||||||
{
|
{
|
||||||
@ -63,8 +63,8 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
#region Identification
|
#region Identification
|
||||||
|
|
||||||
private readonly Dictionary<Tuple<InputProvider, object>, ArtemisDevice> _deviceCache = new Dictionary<Tuple<InputProvider, object>, ArtemisDevice>();
|
private readonly Dictionary<Tuple<InputProvider, object>, ArtemisDevice> _deviceCache = new();
|
||||||
private List<ArtemisDevice> _devices = new List<ArtemisDevice>();
|
private List<ArtemisDevice> _devices = new();
|
||||||
private ArtemisDevice? _cachedFallbackKeyboard;
|
private ArtemisDevice? _cachedFallbackKeyboard;
|
||||||
private ArtemisDevice? _cachedFallbackMouse;
|
private ArtemisDevice? _cachedFallbackMouse;
|
||||||
private ArtemisDevice? _identifyingDevice;
|
private ArtemisDevice? _identifyingDevice;
|
||||||
@ -180,8 +180,8 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
#region Keyboard
|
#region Keyboard
|
||||||
|
|
||||||
private readonly Dictionary<ArtemisDevice, HashSet<KeyboardKey>> _pressedKeys = new Dictionary<ArtemisDevice, HashSet<KeyboardKey>>();
|
private readonly Dictionary<ArtemisDevice, HashSet<KeyboardKey>> _pressedKeys = new();
|
||||||
private readonly Dictionary<ArtemisDevice, KeyboardModifierKey> _keyboardModifier = new Dictionary<ArtemisDevice, KeyboardModifierKey>();
|
private readonly Dictionary<ArtemisDevice, KeyboardModifierKey> _keyboardModifier = new();
|
||||||
private KeyboardModifierKey _globalModifiers;
|
private KeyboardModifierKey _globalModifiers;
|
||||||
|
|
||||||
private void InputProviderOnKeyboardDataReceived(object? sender, InputProviderKeyboardEventArgs e)
|
private void InputProviderOnKeyboardDataReceived(object? sender, InputProviderKeyboardEventArgs e)
|
||||||
@ -199,7 +199,7 @@ namespace Artemis.Core.Services
|
|||||||
led = e.Device.GetLed(ledId);
|
led = e.Device.GetLed(ledId);
|
||||||
|
|
||||||
// Create the UpDown event args because it can be used for every event
|
// 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);
|
OnKeyboardKeyUpDown(eventArgs);
|
||||||
if (e.IsDown)
|
if (e.IsDown)
|
||||||
OnKeyboardKeyDown(eventArgs);
|
OnKeyboardKeyDown(eventArgs);
|
||||||
@ -289,7 +289,7 @@ namespace Artemis.Core.Services
|
|||||||
led = e.Device.Leds.FirstOrDefault(l => l.RgbLed.Id == ledId);
|
led = e.Device.Leds.FirstOrDefault(l => l.RgbLed.Id == ledId);
|
||||||
|
|
||||||
// Create the UpDown event args because it can be used for every event
|
// 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);
|
OnMouseButtonUpDown(eventArgs);
|
||||||
if (e.IsDown)
|
if (e.IsDown)
|
||||||
OnMouseButtonDown(eventArgs);
|
OnMouseButtonDown(eventArgs);
|
||||||
|
|||||||
@ -14,7 +14,7 @@ namespace Artemis.Core.Services
|
|||||||
{
|
{
|
||||||
internal class ModuleService : IModuleService
|
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 ILogger _logger;
|
||||||
private readonly IModuleRepository _moduleRepository;
|
private readonly IModuleRepository _moduleRepository;
|
||||||
private readonly IPluginManagementService _pluginManagementService;
|
private readonly IPluginManagementService _pluginManagementService;
|
||||||
@ -28,7 +28,7 @@ namespace Artemis.Core.Services
|
|||||||
_profileService = profileService;
|
_profileService = profileService;
|
||||||
_pluginManagementService.PluginFeatureEnabled += OnPluginFeatureEnabled;
|
_pluginManagementService.PluginFeatureEnabled += OnPluginFeatureEnabled;
|
||||||
|
|
||||||
Timer activationUpdateTimer = new Timer(2000);
|
Timer activationUpdateTimer = new(2000);
|
||||||
activationUpdateTimer.Start();
|
activationUpdateTimer.Start();
|
||||||
activationUpdateTimer.Elapsed += ActivationUpdateTimerOnElapsed;
|
activationUpdateTimer.Elapsed += ActivationUpdateTimerOnElapsed;
|
||||||
|
|
||||||
@ -204,11 +204,11 @@ namespace Artemis.Core.Services
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Stopwatch stopwatch = new Stopwatch();
|
Stopwatch stopwatch = new();
|
||||||
stopwatch.Start();
|
stopwatch.Start();
|
||||||
|
|
||||||
List<Module> modules = _pluginManagementService.GetFeaturesOfType<Module>().ToList();
|
List<Module> modules = _pluginManagementService.GetFeaturesOfType<Module>().ToList();
|
||||||
List<Task> tasks = new List<Task>();
|
List<Task> tasks = new();
|
||||||
foreach (Module module in modules)
|
foreach (Module module in modules)
|
||||||
lock (module)
|
lock (module)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -38,7 +38,7 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
private void CopyBuiltInPlugin(FileInfo zipFileInfo, ZipArchive zipArchive)
|
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"));
|
bool createLockFile = File.Exists(Path.Combine(pluginDirectory.FullName, "artemis.lock"));
|
||||||
|
|
||||||
// Remove the old directory if it exists
|
// Remove the old directory if it exists
|
||||||
@ -58,10 +58,10 @@ namespace Artemis.Core.Services
|
|||||||
public void CopyBuiltInPlugins()
|
public void CopyBuiltInPlugins()
|
||||||
{
|
{
|
||||||
OnCopyingBuildInPlugins();
|
OnCopyingBuildInPlugins();
|
||||||
DirectoryInfo pluginDirectory = new DirectoryInfo(Path.Combine(Constants.DataFolder, "plugins"));
|
DirectoryInfo pluginDirectory = new(Path.Combine(Constants.DataFolder, "plugins"));
|
||||||
|
|
||||||
// Iterate built-in 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)
|
if (!builtInPluginDirectory.Exists)
|
||||||
{
|
{
|
||||||
_logger.Warning("No built-in plugins found at {pluginDir}, skipping CopyBuiltInPlugins", builtInPluginDirectory.FullName);
|
_logger.Warning("No built-in plugins found at {pluginDir}, skipping CopyBuiltInPlugins", builtInPluginDirectory.FullName);
|
||||||
@ -76,7 +76,7 @@ namespace Artemis.Core.Services
|
|||||||
if (metaDataFileEntry == null)
|
if (metaDataFileEntry == null)
|
||||||
throw new ArtemisPluginException("Couldn't find a plugin.json in " + zipFile.FullName);
|
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<PluginInfo>(reader.ReadToEnd())!;
|
PluginInfo builtInPluginInfo = CoreJson.DeserializeObject<PluginInfo>(reader.ReadToEnd())!;
|
||||||
|
|
||||||
// Find the matching plugin in the plugin folder
|
// Find the matching plugin in the plugin folder
|
||||||
@ -151,7 +151,7 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
public Plugin? GetCallingPlugin()
|
public Plugin? GetCallingPlugin()
|
||||||
{
|
{
|
||||||
StackTrace stackTrace = new StackTrace(); // get call stack
|
StackTrace stackTrace = new(); // get call stack
|
||||||
StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
|
StackFrame[] stackFrames = stackTrace.GetFrames(); // get method calls (frames)
|
||||||
|
|
||||||
foreach (StackFrame stackFrame in stackFrames)
|
foreach (StackFrame stackFrame in stackFrames)
|
||||||
@ -183,7 +183,7 @@ namespace Artemis.Core.Services
|
|||||||
UnloadPlugins();
|
UnloadPlugins();
|
||||||
|
|
||||||
// Load the plugin assemblies into the plugin context
|
// 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())
|
foreach (DirectoryInfo subDirectory in pluginDirectory.EnumerateDirectories())
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@ -238,7 +238,7 @@ namespace Artemis.Core.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Load the entity and fall back on creating a new one
|
// 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));
|
OnPluginLoading(new PluginEventArgs(plugin));
|
||||||
|
|
||||||
// Locate the main assembly entry
|
// Locate the main assembly entry
|
||||||
|
|||||||
@ -17,7 +17,7 @@ namespace Artemis.Core.Services.Models
|
|||||||
|
|
||||||
internal static SurfaceArrangement GetDefaultArrangement()
|
internal static SurfaceArrangement GetDefaultArrangement()
|
||||||
{
|
{
|
||||||
SurfaceArrangement arrangement = new SurfaceArrangement();
|
SurfaceArrangement arrangement = new();
|
||||||
|
|
||||||
SurfaceArrangementType keypad = arrangement.AddType(RGBDeviceType.Keypad, 1);
|
SurfaceArrangementType keypad = arrangement.AddType(RGBDeviceType.Keypad, 1);
|
||||||
keypad.AddConfiguration(new SurfaceArrangementConfiguration(null, HorizontalArrangementPosition.Equal, VerticalArrangementPosition.Equal, 20));
|
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)
|
private SurfaceArrangementType AddType(RGBDeviceType type, int zIndex)
|
||||||
{
|
{
|
||||||
SurfaceArrangementType surfaceArrangementType = new SurfaceArrangementType(this, type, zIndex);
|
SurfaceArrangementType surfaceArrangementType = new(this, type, zIndex);
|
||||||
Types.Add(surfaceArrangementType);
|
Types.Add(surfaceArrangementType);
|
||||||
return surfaceArrangementType;
|
return surfaceArrangementType;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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
|
// If nothing applied fall back to just basing on whatever is the furthers to the right
|
||||||
SurfaceArrangementConfiguration fallback = new SurfaceArrangementConfiguration(
|
SurfaceArrangementConfiguration fallback = new(
|
||||||
null,
|
null,
|
||||||
HorizontalArrangementPosition.Right,
|
HorizontalArrangementPosition.Right,
|
||||||
VerticalArrangementPosition.Equal,
|
VerticalArrangementPosition.Equal,
|
||||||
|
|||||||
@ -33,8 +33,8 @@ namespace Artemis.Core.Services
|
|||||||
_surfaceService.SurfaceConfigurationUpdated += OnSurfaceConfigurationUpdated;
|
_surfaceService.SurfaceConfigurationUpdated += OnSurfaceConfigurationUpdated;
|
||||||
}
|
}
|
||||||
|
|
||||||
public JsonSerializerSettings MementoSettings { get; set; } = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All};
|
public JsonSerializerSettings MementoSettings { get; set; } = new() {TypeNameHandling = TypeNameHandling.All};
|
||||||
public JsonSerializerSettings ExportSettings { get; set; } = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All, Formatting = Formatting.Indented};
|
public JsonSerializerSettings ExportSettings { get; set; } = new() {TypeNameHandling = TypeNameHandling.All, Formatting = Formatting.Indented};
|
||||||
|
|
||||||
public ProfileDescriptor? GetLastActiveProfile(ProfileModule module)
|
public ProfileDescriptor? GetLastActiveProfile(ProfileModule module)
|
||||||
{
|
{
|
||||||
@ -78,7 +78,7 @@ namespace Artemis.Core.Services
|
|||||||
|
|
||||||
public ProfileDescriptor CreateProfileDescriptor(ProfileModule module, string name)
|
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);
|
_profileRepository.Add(profileEntity);
|
||||||
|
|
||||||
return new ProfileDescriptor(module, profileEntity);
|
return new ProfileDescriptor(module, profileEntity);
|
||||||
@ -107,7 +107,7 @@ namespace Artemis.Core.Services
|
|||||||
if (profileEntity == null)
|
if (profileEntity == null)
|
||||||
throw new ArtemisCoreException($"Cannot find profile named: {profileDescriptor.Name} ID: {profileDescriptor.Id}");
|
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);
|
InstantiateProfile(profile);
|
||||||
|
|
||||||
profileDescriptor.ProfileModule.ChangeActiveProfile(profile, _surfaceService.ActiveSurface);
|
profileDescriptor.ProfileModule.ChangeActiveProfile(profile, _surfaceService.ActiveSurface);
|
||||||
@ -122,7 +122,7 @@ namespace Artemis.Core.Services
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ProfileEntity entity = _profileRepository.Get(module.ActiveProfile.EntityId);
|
ProfileEntity entity = _profileRepository.Get(module.ActiveProfile.EntityId);
|
||||||
Profile profile = new Profile(module, entity);
|
Profile profile = new(module, entity);
|
||||||
InstantiateProfile(profile);
|
InstantiateProfile(profile);
|
||||||
|
|
||||||
module.ChangeActiveProfile(null, _surfaceService.ActiveSurface);
|
module.ChangeActiveProfile(null, _surfaceService.ActiveSurface);
|
||||||
@ -138,7 +138,7 @@ namespace Artemis.Core.Services
|
|||||||
if (profileEntity == null)
|
if (profileEntity == null)
|
||||||
throw new ArtemisCoreException($"Cannot find profile named: {profileDescriptor.Name} ID: {profileDescriptor.Id}");
|
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);
|
InstantiateProfile(profile);
|
||||||
|
|
||||||
void ActivatingProfileSurfaceUpdate(object? sender, SurfaceConfigurationEventArgs e)
|
void ActivatingProfileSurfaceUpdate(object? sender, SurfaceConfigurationEventArgs e)
|
||||||
|
|||||||
@ -40,7 +40,7 @@ namespace Artemis.Core.Services
|
|||||||
public ArtemisSurface CreateSurfaceConfiguration(string name)
|
public ArtemisSurface CreateSurfaceConfiguration(string name)
|
||||||
{
|
{
|
||||||
// Create a blank config
|
// Create a blank config
|
||||||
ArtemisSurface configuration = new ArtemisSurface(_rgbService.Surface, name);
|
ArtemisSurface configuration = new(_rgbService.Surface, name);
|
||||||
|
|
||||||
// Add all current devices
|
// Add all current devices
|
||||||
foreach (IRGBDevice rgbDevice in _rgbService.LoadedDevices)
|
foreach (IRGBDevice rgbDevice in _rgbService.LoadedDevices)
|
||||||
@ -134,7 +134,7 @@ namespace Artemis.Core.Services
|
|||||||
foreach (SurfaceEntity surfaceEntity in configs)
|
foreach (SurfaceEntity surfaceEntity in configs)
|
||||||
{
|
{
|
||||||
// Create the surface entity
|
// Create the surface entity
|
||||||
ArtemisSurface surfaceConfiguration = new ArtemisSurface(_rgbService.Surface, surfaceEntity);
|
ArtemisSurface surfaceConfiguration = new(_rgbService.Surface, surfaceEntity);
|
||||||
foreach (DeviceEntity position in surfaceEntity.DeviceEntities)
|
foreach (DeviceEntity position in surfaceEntity.DeviceEntities)
|
||||||
{
|
{
|
||||||
IRGBDevice? device = _rgbService.Surface.Devices.FirstOrDefault(d => d.GetDeviceIdentifier() == position.DeviceIdentifier);
|
IRGBDevice? device = _rgbService.Surface.Devices.FirstOrDefault(d => d.GetDeviceIdentifier() == position.DeviceIdentifier);
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
internal class ConditionOperatorStore
|
internal class ConditionOperatorStore
|
||||||
{
|
{
|
||||||
private static readonly List<ConditionOperatorRegistration> Registrations = new List<ConditionOperatorRegistration>();
|
private static readonly List<ConditionOperatorRegistration> Registrations = new();
|
||||||
|
|
||||||
public static ConditionOperatorRegistration Add(BaseConditionOperator conditionOperator)
|
public static ConditionOperatorRegistration Add(BaseConditionOperator conditionOperator)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
internal class DataBindingModifierTypeStore
|
internal class DataBindingModifierTypeStore
|
||||||
{
|
{
|
||||||
private static readonly List<DataBindingModifierTypeRegistration> Registrations = new List<DataBindingModifierTypeRegistration>();
|
private static readonly List<DataBindingModifierTypeRegistration> Registrations = new();
|
||||||
|
|
||||||
public static DataBindingModifierTypeRegistration Add(BaseDataBindingModifierType modifierType)
|
public static DataBindingModifierTypeRegistration Add(BaseDataBindingModifierType modifierType)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
internal class DataModelStore
|
internal class DataModelStore
|
||||||
{
|
{
|
||||||
private static readonly List<DataModelRegistration> Registrations = new List<DataModelRegistration>();
|
private static readonly List<DataModelRegistration> Registrations = new();
|
||||||
|
|
||||||
public static DataModelRegistration Add(DataModel dataModel)
|
public static DataModelRegistration Add(DataModel dataModel)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
internal class LayerBrushStore
|
internal class LayerBrushStore
|
||||||
{
|
{
|
||||||
private static readonly List<LayerBrushRegistration> Registrations = new List<LayerBrushRegistration>();
|
private static readonly List<LayerBrushRegistration> Registrations = new();
|
||||||
|
|
||||||
public static LayerBrushRegistration Add(LayerBrushDescriptor descriptor)
|
public static LayerBrushRegistration Add(LayerBrushDescriptor descriptor)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace Artemis.Core
|
|||||||
{
|
{
|
||||||
internal class LayerEffectStore
|
internal class LayerEffectStore
|
||||||
{
|
{
|
||||||
private static readonly List<LayerEffectRegistration> Registrations = new List<LayerEffectRegistration>();
|
private static readonly List<LayerEffectRegistration> Registrations = new();
|
||||||
|
|
||||||
public static LayerEffectRegistration Add(LayerEffectDescriptor descriptor)
|
public static LayerEffectRegistration Add(LayerEffectDescriptor descriptor)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace Artemis.Core
|
|||||||
if (restart)
|
if (restart)
|
||||||
arguments = "-Command \"& {Start-Sleep -s " + delay + "; (Get-Process 'Artemis.UI').kill(); Start-Process -FilePath '" + Process.GetCurrentProcess().MainModule!.FileName + "'}\"";
|
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,
|
Arguments = arguments,
|
||||||
WindowStyle = ProcessWindowStyle.Hidden,
|
WindowStyle = ProcessWindowStyle.Hidden,
|
||||||
@ -59,7 +59,7 @@ namespace Artemis.Core
|
|||||||
/// <returns>The process created to open the URL</returns>
|
/// <returns>The process created to open the URL</returns>
|
||||||
public static Process? OpenUrl(string url)
|
public static Process? OpenUrl(string url)
|
||||||
{
|
{
|
||||||
ProcessStartInfo processInfo = new ProcessStartInfo
|
ProcessStartInfo processInfo = new()
|
||||||
{
|
{
|
||||||
FileName = url,
|
FileName = url,
|
||||||
UseShellExecute = true
|
UseShellExecute = true
|
||||||
@ -87,7 +87,7 @@ namespace Artemis.Core
|
|||||||
|
|
||||||
// On Windows, ensure everyone has permission (important when running as admin)
|
// On Windows, ensure everyone has permission (important when running as admin)
|
||||||
DirectorySecurity security = dataDirectory.GetAccessControl();
|
DirectorySecurity security = dataDirectory.GetAccessControl();
|
||||||
SecurityIdentifier everyone = new SecurityIdentifier(WellKnownSidType.WorldSid, null);
|
SecurityIdentifier everyone = new(WellKnownSidType.WorldSid, null);
|
||||||
security.AddAccessRule(new FileSystemAccessRule(
|
security.AddAccessRule(new FileSystemAccessRule(
|
||||||
everyone,
|
everyone,
|
||||||
FileSystemRights.Modify | FileSystemRights.Synchronize,
|
FileSystemRights.Modify | FileSystemRights.Synchronize,
|
||||||
|
|||||||
@ -47,7 +47,7 @@ namespace Artemis.Core
|
|||||||
LedName = l.RgbLed.Id.ToString()
|
LedName = l.RgbLed.Id.ToString()
|
||||||
}));
|
}));
|
||||||
|
|
||||||
Profile profile = new Profile(new DummyModule(), profileEntity);
|
Profile profile = new(new DummyModule(), profileEntity);
|
||||||
profile.Activate(_surfaceService.ActiveSurface);
|
profile.Activate(_surfaceService.ActiveSurface);
|
||||||
|
|
||||||
_profileService.InstantiateProfile(profile);
|
_profileService.InstantiateProfile(profile);
|
||||||
|
|||||||
@ -50,7 +50,7 @@ namespace Artemis.Storage.Migrations
|
|||||||
|
|
||||||
public void Apply(LiteRepository repository)
|
public void Apply(LiteRepository repository)
|
||||||
{
|
{
|
||||||
Dictionary<string, string> pluginMap = new Dictionary<string, string>
|
Dictionary<string, string> pluginMap = new()
|
||||||
{
|
{
|
||||||
{"ffffffff-ffff-ffff-ffff-ffffffffffff", "Artemis.Core.CorePluginFeature-ffffffff"},
|
{"ffffffff-ffff-ffff-ffff-ffffffffffff", "Artemis.Core.CorePluginFeature-ffffffff"},
|
||||||
{"ab41d601-35e0-4a73-bf0b-94509b006ab0", "Artemis.Plugins.DataModelExpansions.TestData.PluginDataModelExpansion-ab41d601"},
|
{"ab41d601-35e0-4a73-bf0b-94509b006ab0", "Artemis.Plugins.DataModelExpansions.TestData.PluginDataModelExpansion-ab41d601"},
|
||||||
|
|||||||
@ -35,7 +35,7 @@ namespace Artemis.UI.Shared
|
|||||||
if (scrollPos == scrollViewer.ScrollableHeight && e.Delta < 0 || scrollPos == 0 && e.Delta > 0)
|
if (scrollPos == scrollViewer.ScrollableHeight && e.Delta < 0 || scrollPos == 0 && e.Delta > 0)
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
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;
|
e2.RoutedEvent = UIElement.MouseWheelEvent;
|
||||||
AssociatedObject.RaiseEvent(e2);
|
AssociatedObject.RaiseEvent(e2);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -106,7 +106,7 @@ namespace Artemis.UI.Shared
|
|||||||
// Determine the scale required to fit the desired size of the control
|
// Determine the scale required to fit the desired size of the control
|
||||||
Size measureSize = MeasureDevice();
|
Size measureSize = MeasureDevice();
|
||||||
double scale = Math.Min(DesiredSize.Width / measureSize.Width, DesiredSize.Height / measureSize.Height);
|
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
|
// Center and scale the visualization in the desired bounding box
|
||||||
if (DesiredSize.Width > 0 && DesiredSize.Height > 0)
|
if (DesiredSize.Width > 0 && DesiredSize.Height > 0)
|
||||||
@ -116,7 +116,7 @@ namespace Artemis.UI.Shared
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Determine the offset required to rotate within bounds
|
// 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);
|
rotationRect.Transform(new RotateTransform(Device.Rotation).Value);
|
||||||
|
|
||||||
// Apply device rotation
|
// Apply device rotation
|
||||||
@ -169,7 +169,7 @@ namespace Artemis.UI.Shared
|
|||||||
if (Device == null)
|
if (Device == null)
|
||||||
return Size.Empty;
|
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);
|
rotationRect.Transform(new RotateTransform(Device.Rotation).Value);
|
||||||
|
|
||||||
return rotationRect.Size;
|
return rotationRect.Size;
|
||||||
@ -249,16 +249,16 @@ namespace Artemis.UI.Shared
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the opacity drawing group
|
// Create the opacity drawing group
|
||||||
DrawingGroup opacityDrawingGroup = new DrawingGroup();
|
DrawingGroup opacityDrawingGroup = new();
|
||||||
DrawingContext drawingContext = opacityDrawingGroup.Open();
|
DrawingContext drawingContext = opacityDrawingGroup.Open();
|
||||||
foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds)
|
foreach (DeviceVisualizerLed deviceVisualizerLed in _deviceVisualizerLeds)
|
||||||
deviceVisualizerLed.RenderOpacityMask(drawingContext);
|
deviceVisualizerLed.RenderOpacityMask(drawingContext);
|
||||||
drawingContext.Close();
|
drawingContext.Close();
|
||||||
|
|
||||||
// Render the store as a bitmap
|
// Render the store as a bitmap
|
||||||
DrawingImage drawingImage = new DrawingImage(opacityDrawingGroup);
|
DrawingImage drawingImage = new(opacityDrawingGroup);
|
||||||
Image image = new Image {Source = drawingImage};
|
Image image = new() {Source = drawingImage};
|
||||||
RenderTargetBitmap bitmap = new RenderTargetBitmap(
|
RenderTargetBitmap bitmap = new(
|
||||||
Math.Max(1, (int) (opacityDrawingGroup.Bounds.Width * 2.5)),
|
Math.Max(1, (int) (opacityDrawingGroup.Bounds.Width * 2.5)),
|
||||||
Math.Max(1, (int) (opacityDrawingGroup.Bounds.Height * 2.5)),
|
Math.Max(1, (int) (opacityDrawingGroup.Bounds.Height * 2.5)),
|
||||||
96,
|
96,
|
||||||
@ -270,7 +270,7 @@ namespace Artemis.UI.Shared
|
|||||||
bitmap.Freeze();
|
bitmap.Freeze();
|
||||||
|
|
||||||
// Set the bitmap as the opacity mask for the colors backing store
|
// Set the bitmap as the opacity mask for the colors backing store
|
||||||
ImageBrush bitmapBrush = new ImageBrush(bitmap);
|
ImageBrush bitmapBrush = new(bitmap);
|
||||||
bitmapBrush.Freeze();
|
bitmapBrush.Freeze();
|
||||||
_backingStore.OpacityMask = bitmapBrush;
|
_backingStore.OpacityMask = bitmapBrush;
|
||||||
|
|
||||||
|
|||||||
@ -61,9 +61,9 @@ namespace Artemis.UI.Shared
|
|||||||
if (DisplayGeometry == null)
|
if (DisplayGeometry == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SolidColorBrush fillBrush = new SolidColorBrush(Color.FromArgb(100, 255, 255, 255));
|
SolidColorBrush fillBrush = new(Color.FromArgb(100, 255, 255, 255));
|
||||||
fillBrush.Freeze();
|
fillBrush.Freeze();
|
||||||
SolidColorBrush penBrush = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
|
SolidColorBrush penBrush = new(Color.FromArgb(255, 255, 255, 255));
|
||||||
penBrush.Freeze();
|
penBrush.Freeze();
|
||||||
|
|
||||||
// Create transparent pixels covering the entire LedRect so the image size matched the LedRect size
|
// Create transparent pixels covering the entire LedRect so the image size matched the LedRect size
|
||||||
|
|||||||
@ -44,7 +44,7 @@ namespace Artemis.UI.Shared
|
|||||||
typeof(RoutedPropertyChangedEventHandler<float>),
|
typeof(RoutedPropertyChangedEventHandler<float>),
|
||||||
typeof(DraggableFloat));
|
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;
|
private bool _calledDragStarted;
|
||||||
|
|
||||||
@ -196,10 +196,10 @@ namespace Artemis.UI.Shared
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Use decimals for everything to avoid floating point errors
|
// Use decimals for everything to avoid floating point errors
|
||||||
decimal startValue = new decimal(_startValue);
|
decimal startValue = new(_startValue);
|
||||||
decimal startX = new decimal(_mouseDragStartPoint.X);
|
decimal startX = new(_mouseDragStartPoint.X);
|
||||||
decimal x = new decimal(e.GetPosition((IInputElement) sender).X);
|
decimal x = new(e.GetPosition((IInputElement) sender).X);
|
||||||
decimal stepSize = new decimal(StepSize);
|
decimal stepSize = new(StepSize);
|
||||||
if (stepSize == 0)
|
if (stepSize == 0)
|
||||||
stepSize = 0.1m;
|
stepSize = 0.1m;
|
||||||
|
|
||||||
|
|||||||
@ -21,7 +21,7 @@ namespace Artemis.UI.Shared
|
|||||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
List<ColorGradientStop> colorGradients = (List<ColorGradientStop>) value;
|
List<ColorGradientStop> colorGradients = (List<ColorGradientStop>) value;
|
||||||
GradientStopCollection collection = new GradientStopCollection();
|
GradientStopCollection collection = new();
|
||||||
if (colorGradients == null)
|
if (colorGradients == null)
|
||||||
return collection;
|
return collection;
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ namespace Artemis.UI.Shared
|
|||||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
GradientStopCollection collection = (GradientStopCollection) value;
|
GradientStopCollection collection = (GradientStopCollection) value;
|
||||||
List<ColorGradientStop> colorGradients = new List<ColorGradientStop>();
|
List<ColorGradientStop> colorGradients = new();
|
||||||
if (collection == null)
|
if (collection == null)
|
||||||
return colorGradients;
|
return colorGradients;
|
||||||
|
|
||||||
|
|||||||
@ -27,7 +27,7 @@ namespace Artemis.UI.Shared
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override object InternalGuard => new object();
|
internal override object InternalGuard => new();
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public override void UpdateValue(object? model)
|
public override void UpdateValue(object? model)
|
||||||
|
|||||||
@ -45,7 +45,7 @@ namespace Artemis.UI.Shared
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public DataModelPropertyAttribute TargetDescription { get; }
|
public DataModelPropertyAttribute TargetDescription { get; }
|
||||||
|
|
||||||
internal override object InternalGuard { get; } = new object();
|
internal override object InternalGuard { get; } = new();
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public sealed override void Submit()
|
public sealed override void Submit()
|
||||||
|
|||||||
@ -21,7 +21,7 @@ namespace Artemis.UI.Shared.Input
|
|||||||
private readonly IDataModelUIService _dataModelUIService;
|
private readonly IDataModelUIService _dataModelUIService;
|
||||||
private readonly Module _module;
|
private readonly Module _module;
|
||||||
private readonly Timer _updateTimer;
|
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 DataModelPath? _dataModelPath;
|
||||||
private DataModelPropertiesViewModel? _dataModelViewModel;
|
private DataModelPropertiesViewModel? _dataModelViewModel;
|
||||||
private bool _displaySwitchButton;
|
private bool _displaySwitchButton;
|
||||||
@ -59,7 +59,7 @@ namespace Artemis.UI.Shared.Input
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the brush to use for the switch button
|
/// Gets the brush to use for the switch button
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SolidColorBrush SwitchButtonBrush => new SolidColorBrush(ButtonBrush.Color.Darken());
|
public SolidColorBrush SwitchButtonBrush => new(ButtonBrush.Color.Darken());
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the placeholder text when no value is entered
|
/// Gets or sets the placeholder text when no value is entered
|
||||||
|
|||||||
@ -19,7 +19,7 @@ namespace Artemis.UI.Shared.Input
|
|||||||
{
|
{
|
||||||
private readonly IDataModelUIService _dataModelUIService;
|
private readonly IDataModelUIService _dataModelUIService;
|
||||||
private readonly Window? _rootView;
|
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 bool _displaySwitchButton;
|
||||||
private DataModelDisplayViewModel? _displayViewModel;
|
private DataModelDisplayViewModel? _displayViewModel;
|
||||||
private DataModelInputViewModel? _inputViewModel;
|
private DataModelInputViewModel? _inputViewModel;
|
||||||
@ -62,7 +62,7 @@ namespace Artemis.UI.Shared.Input
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the brush to use for the switch button
|
/// Gets the brush to use for the switch button
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SolidColorBrush SwitchButtonBrush => new SolidColorBrush(ButtonBrush.Color.Darken());
|
public SolidColorBrush SwitchButtonBrush => new(ButtonBrush.Color.Darken());
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the view model used to display the value
|
/// Gets the view model used to display the value
|
||||||
|
|||||||
@ -263,7 +263,7 @@ namespace Artemis.UI.Shared
|
|||||||
if (depth > MaxDepth)
|
if (depth > MaxDepth)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
DataModelPath dataModelPath = new DataModelPath(DataModel, path);
|
DataModelPath dataModelPath = new(DataModel, path);
|
||||||
if (!dataModelPath.IsValid)
|
if (!dataModelPath.IsValid)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ namespace Artemis.UI.Shared
|
|||||||
/// <returns>The created view model</returns>
|
/// <returns>The created view model</returns>
|
||||||
public static DataModelPropertiesViewModel CreateViewModel(this EventPredicateWrapperDataModel wrapper, IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration)
|
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.Update(dataModelUIService, configuration);
|
||||||
viewModel.UpdateRequested += (sender, args) => viewModel.Update(dataModelUIService, configuration);
|
viewModel.UpdateRequested += (sender, args) => viewModel.Update(dataModelUIService, configuration);
|
||||||
viewModel.Children.First().IsVisualizationExpanded = true;
|
viewModel.Children.First().IsVisualizationExpanded = true;
|
||||||
@ -35,7 +35,7 @@ namespace Artemis.UI.Shared
|
|||||||
/// <returns>The created view model</returns>
|
/// <returns>The created view model</returns>
|
||||||
public static DataModelPropertiesViewModel CreateViewModel(this ListPredicateWrapperDataModel wrapper, IDataModelUIService dataModelUIService, DataModelUpdateConfiguration configuration)
|
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.Update(dataModelUIService, configuration);
|
||||||
viewModel.UpdateRequested += (sender, args) => viewModel.Update(dataModelUIService, configuration);
|
viewModel.UpdateRequested += (sender, args) => viewModel.Update(dataModelUIService, configuration);
|
||||||
viewModel.Children.First().IsVisualizationExpanded = true;
|
viewModel.Children.First().IsVisualizationExpanded = true;
|
||||||
|
|||||||
@ -85,7 +85,7 @@ namespace Artemis.UI.Shared
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal override object InternalGuard { get; } = new object();
|
internal override object InternalGuard { get; } = new();
|
||||||
|
|
||||||
#region IDisposable
|
#region IDisposable
|
||||||
|
|
||||||
|
|||||||
@ -52,12 +52,12 @@ namespace Artemis.UI.Shared.Screens.GradientEditor
|
|||||||
{
|
{
|
||||||
Canvas? child = VisualTreeUtilities.FindChild<Canvas>((DependencyObject) sender, null);
|
Canvas? child = VisualTreeUtilities.FindChild<Canvas>((DependencyObject) sender, null);
|
||||||
float position = (float) (e.GetPosition(child).X / PreviewWidth);
|
float position = (float) (e.GetPosition(child).X / PreviewWidth);
|
||||||
ColorGradientStop stop = new ColorGradientStop(ColorGradient.GetColor(position), position);
|
ColorGradientStop stop = new(ColorGradient.GetColor(position), position);
|
||||||
ColorGradient.Stops.Add(stop);
|
ColorGradient.Stops.Add(stop);
|
||||||
ColorGradient.OnColorValuesUpdated();
|
ColorGradient.OnColorValuesUpdated();
|
||||||
|
|
||||||
int index = ColorGradient.Stops.OrderBy(s => s.Position).ToList().IndexOf(stop);
|
int index = ColorGradient.Stops.OrderBy(s => s.Position).ToList().IndexOf(stop);
|
||||||
ColorStopViewModel viewModel = new ColorStopViewModel(this, stop);
|
ColorStopViewModel viewModel = new(this, stop);
|
||||||
ColorStopViewModels.Insert(index, viewModel);
|
ColorStopViewModels.Insert(index, viewModel);
|
||||||
|
|
||||||
SelectColorStop(viewModel);
|
SelectColorStop(viewModel);
|
||||||
|
|||||||
@ -72,7 +72,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
if (_overlayOpacity > 1f)
|
if (_overlayOpacity > 1f)
|
||||||
_overlayOpacity = 1f;
|
_overlayOpacity = 1f;
|
||||||
|
|
||||||
using SKPaint overlayPaint = new SKPaint {Color = new SKColor(0, 0, 0, (byte) (255 * _overlayOpacity))};
|
using SKPaint overlayPaint = new() {Color = new SKColor(0, 0, 0, (byte) (255 * _overlayOpacity))};
|
||||||
overlayPaint.Color = _overlayColor.WithAlpha((byte) (_overlayColor.Alpha * _overlayOpacity));
|
overlayPaint.Color = _overlayColor.WithAlpha((byte) (_overlayColor.Alpha * _overlayOpacity));
|
||||||
e.Canvas.DrawRect(0, 0, e.Canvas.LocalClipBounds.Width, e.Canvas.LocalClipBounds.Height, overlayPaint);
|
e.Canvas.DrawRect(0, 0, e.Canvas.LocalClipBounds.Width, e.Canvas.LocalClipBounds.Height, overlayPaint);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,7 +34,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
|
|
||||||
public DataModelPropertiesViewModel GetMainDataModelVisualization()
|
public DataModelPropertiesViewModel GetMainDataModelVisualization()
|
||||||
{
|
{
|
||||||
DataModelPropertiesViewModel viewModel = new DataModelPropertiesViewModel(null, null, null);
|
DataModelPropertiesViewModel viewModel = new(null, null, null);
|
||||||
foreach (DataModel dataModelExpansion in _dataModelService.GetDataModels().OrderBy(d => d.DataModelDescription.Name))
|
foreach (DataModel dataModelExpansion in _dataModelService.GetDataModels().OrderBy(d => d.DataModelDescription.Name))
|
||||||
viewModel.Children.Add(new DataModelPropertiesViewModel(dataModelExpansion, viewModel, new DataModelPath(dataModelExpansion)));
|
viewModel.Children.Add(new DataModelPropertiesViewModel(dataModelExpansion, viewModel, new DataModelPath(dataModelExpansion)));
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
if (dataModel == null)
|
if (dataModel == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
DataModelPropertiesViewModel viewModel = new DataModelPropertiesViewModel(null, null, null);
|
DataModelPropertiesViewModel viewModel = new(null, null, null);
|
||||||
viewModel.Children.Add(new DataModelPropertiesViewModel(dataModel, viewModel, new DataModelPath(dataModel)));
|
viewModel.Children.Add(new DataModelPropertiesViewModel(dataModel, viewModel, new DataModelPath(dataModel)));
|
||||||
|
|
||||||
// Update to populate children
|
// Update to populate children
|
||||||
@ -114,7 +114,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
_kernel.Bind(viewModelType).ToSelf();
|
_kernel.Bind(viewModelType).ToSelf();
|
||||||
|
|
||||||
// Create the registration
|
// Create the registration
|
||||||
DataModelVisualizationRegistration registration = new DataModelVisualizationRegistration(this, RegistrationType.Input, plugin, supportedType, viewModelType)
|
DataModelVisualizationRegistration registration = new(this, RegistrationType.Input, plugin, supportedType, viewModelType)
|
||||||
{
|
{
|
||||||
// Apply the compatible conversion types to the registration
|
// Apply the compatible conversion types to the registration
|
||||||
CompatibleConversionTypes = compatibleConversionTypes
|
CompatibleConversionTypes = compatibleConversionTypes
|
||||||
@ -141,7 +141,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
_kernel.Bind(viewModelType).ToSelf();
|
_kernel.Bind(viewModelType).ToSelf();
|
||||||
DataModelVisualizationRegistration registration = new DataModelVisualizationRegistration(this, RegistrationType.Display, plugin, supportedType, viewModelType);
|
DataModelVisualizationRegistration registration = new(this, RegistrationType.Display, plugin, supportedType, viewModelType);
|
||||||
_registeredDataModelDisplays.Add(registration);
|
_registeredDataModelDisplays.Add(registration);
|
||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace Artemis.UI.Shared.Services.Models
|
|||||||
|
|
||||||
// Let the folder initialize and load as usual
|
// Let the folder initialize and load as usual
|
||||||
FolderEntity.Name += " - copy";
|
FolderEntity.Name += " - copy";
|
||||||
Folder folder = new Folder(profile, parent, FolderEntity);
|
Folder folder = new(profile, parent, FolderEntity);
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -23,8 +23,8 @@ namespace Artemis.UI.Shared.Services
|
|||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly IProfileService _profileService;
|
private readonly IProfileService _profileService;
|
||||||
private readonly List<PropertyInputRegistration> _registeredPropertyEditors;
|
private readonly List<PropertyInputRegistration> _registeredPropertyEditors;
|
||||||
private readonly object _selectedProfileElementLock = new object();
|
private readonly object _selectedProfileElementLock = new();
|
||||||
private readonly object _selectedProfileLock = new object();
|
private readonly object _selectedProfileLock = new();
|
||||||
private TimeSpan _currentTime;
|
private TimeSpan _currentTime;
|
||||||
private int _pixelsPerSecond;
|
private int _pixelsPerSecond;
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
_logger.Verbose("ChangeSelectedProfile {profile}", profile);
|
_logger.Verbose("ChangeSelectedProfile {profile}", profile);
|
||||||
ChangeSelectedProfileElement(null);
|
ChangeSelectedProfileElement(null);
|
||||||
|
|
||||||
ProfileEventArgs profileElementEvent = new ProfileEventArgs(profile, SelectedProfile);
|
ProfileEventArgs profileElementEvent = new(profile, SelectedProfile);
|
||||||
|
|
||||||
// Ensure there is never a deactivated profile as the selected profile
|
// Ensure there is never a deactivated profile as the selected profile
|
||||||
if (SelectedProfile != null)
|
if (SelectedProfile != null)
|
||||||
@ -149,7 +149,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
_logger.Verbose("ChangeSelectedProfileElement {profile}", profileElement);
|
_logger.Verbose("ChangeSelectedProfileElement {profile}", profileElement);
|
||||||
RenderProfileElementEventArgs profileElementEvent = new RenderProfileElementEventArgs(profileElement, SelectedProfileElement);
|
RenderProfileElementEventArgs profileElementEvent = new(profileElement, SelectedProfileElement);
|
||||||
SelectedProfileElement = profileElement;
|
SelectedProfileElement = profileElement;
|
||||||
OnSelectedProfileElementChanged(profileElementEvent);
|
OnSelectedProfileElementChanged(profileElementEvent);
|
||||||
|
|
||||||
@ -249,7 +249,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
}
|
}
|
||||||
|
|
||||||
_kernel.Bind(viewModelType).ToSelf();
|
_kernel.Bind(viewModelType).ToSelf();
|
||||||
PropertyInputRegistration registration = new PropertyInputRegistration(this, plugin, supportedType, viewModelType);
|
PropertyInputRegistration registration = new(this, plugin, supportedType, viewModelType);
|
||||||
_registeredPropertyEditors.Add(registration);
|
_registeredPropertyEditors.Add(registration);
|
||||||
return registration;
|
return registration;
|
||||||
}
|
}
|
||||||
@ -327,7 +327,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
if (viewModelType == null)
|
if (viewModelType == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
ConstructorArgument parameter = new ConstructorArgument("layerProperty", layerProperty);
|
ConstructorArgument parameter = new("layerProperty", layerProperty);
|
||||||
// ReSharper disable once InconsistentlySynchronizedField
|
// ReSharper disable once InconsistentlySynchronizedField
|
||||||
// When you've just spent the last 2 hours trying to figure out a deadlock and reach this line, I'm so, so sorry. I thought this would be fine.
|
// When you've just spent the last 2 hours trying to figure out a deadlock and reach this line, I'm so, so sorry. I thought this would be fine.
|
||||||
IKernel kernel = registration?.Plugin.Kernel ?? _kernel;
|
IKernel kernel = registration?.Plugin.Kernel ?? _kernel;
|
||||||
@ -368,7 +368,7 @@ namespace Artemis.UI.Shared.Services
|
|||||||
{
|
{
|
||||||
case Folder folder:
|
case Folder folder:
|
||||||
{
|
{
|
||||||
FolderClipboardModel clipboardModel = new FolderClipboardModel(folder);
|
FolderClipboardModel clipboardModel = new(folder);
|
||||||
JsonClipboard.SetObject(clipboardModel);
|
JsonClipboard.SetObject(clipboardModel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,8 +19,8 @@ namespace Artemis.UI.Shared
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static List<T> GetHitViewModels<T>(Visual container, RectangleGeometry rectangleGeometry)
|
public static List<T> GetHitViewModels<T>(Visual container, RectangleGeometry rectangleGeometry)
|
||||||
{
|
{
|
||||||
List<T> result = new List<T>();
|
List<T> result = new();
|
||||||
GeometryHitTestParameters hitTestParams = new GeometryHitTestParameters(rectangleGeometry);
|
GeometryHitTestParameters hitTestParams = new(rectangleGeometry);
|
||||||
|
|
||||||
HitTestResultBehavior ResultCallback(HitTestResult r) => HitTestResultBehavior.Continue;
|
HitTestResultBehavior ResultCallback(HitTestResult r) => HitTestResultBehavior.Continue;
|
||||||
HitTestFilterBehavior FilterCallback(DependencyObject e)
|
HitTestFilterBehavior FilterCallback(DependencyObject e)
|
||||||
|
|||||||
@ -9,7 +9,7 @@ namespace Artemis.UI.Shared
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class JsonClipboard
|
public static class JsonClipboard
|
||||||
{
|
{
|
||||||
private static readonly JsonSerializerSettings JsonSettings = new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All};
|
private static readonly JsonSerializerSettings JsonSettings = new() {TypeNameHandling = TypeNameHandling.All};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the provided object on the clipboard
|
/// Sets the provided object on the clipboard
|
||||||
|
|||||||
@ -174,7 +174,7 @@ namespace Artemis.UI.Shared
|
|||||||
{
|
{
|
||||||
// insert dummy story-boards which can later be traced using WPF animation tracing
|
// 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});
|
triggerBase.EnterActions.Insert(0, new BeginStoryboard {Storyboard = storyboard});
|
||||||
|
|
||||||
storyboard = new TriggerTraceStoryboard(triggerBase, TriggerTraceStoryboardType.Exit);
|
storyboard = new TriggerTraceStoryboard(triggerBase, TriggerTraceStoryboardType.Exit);
|
||||||
|
|||||||
@ -8,7 +8,7 @@ namespace Artemis.UI.Behaviors
|
|||||||
{
|
{
|
||||||
public class InputBindingBehavior
|
public class InputBindingBehavior
|
||||||
{
|
{
|
||||||
private static List<Tuple<FrameworkElement, Window, InputBinding>> _movedInputBindings = new List<Tuple<FrameworkElement, Window, InputBinding>>();
|
private static List<Tuple<FrameworkElement, Window, InputBinding>> _movedInputBindings = new();
|
||||||
|
|
||||||
public static readonly DependencyProperty PropagateInputBindingsToWindowProperty =
|
public static readonly DependencyProperty PropagateInputBindingsToWindowProperty =
|
||||||
DependencyProperty.RegisterAttached("PropagateInputBindingsToWindow", typeof(bool), typeof(InputBindingBehavior),
|
DependencyProperty.RegisterAttached("PropagateInputBindingsToWindow", typeof(bool), typeof(InputBindingBehavior),
|
||||||
|
|||||||
@ -15,7 +15,7 @@ namespace Artemis.UI.DefaultTypes.DataModel.Input
|
|||||||
public void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
|
public void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
|
||||||
{
|
{
|
||||||
string seperator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
|
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);
|
e.Handled = !regex.IsMatch(e.Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ namespace Artemis.UI.DefaultTypes.DataModel.Input
|
|||||||
|
|
||||||
public void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
|
public void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
|
||||||
{
|
{
|
||||||
Regex regex = new Regex("[^0-9]+");
|
Regex regex = new("[^0-9]+");
|
||||||
e.Handled = regex.IsMatch(e.Text);
|
e.Handled = regex.IsMatch(e.Text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,7 +7,7 @@ namespace Artemis.UI.Extensions
|
|||||||
{
|
{
|
||||||
public static Rect ToWindowsRect(this Rectangle rectangle, double scale)
|
public static Rect ToWindowsRect(this Rectangle rectangle, double scale)
|
||||||
{
|
{
|
||||||
return new Rect(
|
return new(
|
||||||
(int) (rectangle.Location.X * scale),
|
(int) (rectangle.Location.X * scale),
|
||||||
(int) (rectangle.Location.Y * scale),
|
(int) (rectangle.Location.Y * scale),
|
||||||
(int) (rectangle.Size.Width * scale),
|
(int) (rectangle.Size.Width * scale),
|
||||||
|
|||||||
@ -231,7 +231,7 @@ namespace Artemis.UI.InputProviders
|
|||||||
|
|
||||||
private static Win32Point GetCursorPosition()
|
private static Win32Point GetCursorPosition()
|
||||||
{
|
{
|
||||||
Win32Point w32Mouse = new Win32Point();
|
Win32Point w32Mouse = new();
|
||||||
GetCursorPos(ref w32Mouse);
|
GetCursorPos(ref w32Mouse);
|
||||||
|
|
||||||
return w32Mouse;
|
return w32Mouse;
|
||||||
|
|||||||
@ -40,11 +40,11 @@ namespace Artemis.UI.Screens.Modules
|
|||||||
|
|
||||||
if (Module.ModuleTabs != null)
|
if (Module.ModuleTabs != null)
|
||||||
{
|
{
|
||||||
List<ModuleTab> moduleTabs = new List<ModuleTab>(Module.ModuleTabs);
|
List<ModuleTab> moduleTabs = new(Module.ModuleTabs);
|
||||||
foreach (ModuleTab moduleTab in moduleTabs.Where(m => m != null))
|
foreach (ModuleTab moduleTab in moduleTabs.Where(m => m != null))
|
||||||
{
|
{
|
||||||
ConstructorArgument module = new ConstructorArgument("module", Module);
|
ConstructorArgument module = new("module", Module);
|
||||||
ConstructorArgument displayName = new ConstructorArgument("displayName", DisplayName);
|
ConstructorArgument displayName = new("displayName", DisplayName);
|
||||||
|
|
||||||
ModuleViewModel viewModel = (ModuleViewModel) Module.Plugin.Kernel.Get(moduleTab.Type, module, displayName);
|
ModuleViewModel viewModel = (ModuleViewModel) Module.Plugin.Kernel.Get(moduleTab.Type, module, displayName);
|
||||||
Items.Add(viewModel);
|
Items.Add(viewModel);
|
||||||
|
|||||||
@ -35,7 +35,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
LeftSideSelectionViewModel.LoadEventChildren = false;
|
LeftSideSelectionViewModel.LoadEventChildren = false;
|
||||||
|
|
||||||
IReadOnlyCollection<DataModelVisualizationRegistration> editors = _dataModelUIService.RegisteredDataModelEditors;
|
IReadOnlyCollection<DataModelVisualizationRegistration> editors = _dataModelUIService.RegisteredDataModelEditors;
|
||||||
List<Type> supportedInputTypes = new List<Type> {typeof(DataModelEvent), typeof(DataModelEvent<>)};
|
List<Type> supportedInputTypes = new() {typeof(DataModelEvent), typeof(DataModelEvent<>)};
|
||||||
|
|
||||||
LeftSideSelectionViewModel.FilterTypes = supportedInputTypes.ToArray();
|
LeftSideSelectionViewModel.FilterTypes = supportedInputTypes.ToArray();
|
||||||
LeftSideSelectionViewModel.ButtonBrush = new SolidColorBrush(Color.FromRgb(185, 164, 10));
|
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)
|
if (DataModelConditionEvent.EventPath == null || !DataModelConditionEvent.EventPath.IsValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<DataModelConditionViewModel> viewModels = new List<DataModelConditionViewModel>();
|
List<DataModelConditionViewModel> viewModels = new();
|
||||||
foreach (DataModelConditionPart childModel in Model.Children)
|
foreach (DataModelConditionPart childModel in Model.Children)
|
||||||
{
|
{
|
||||||
if (Items.Any(c => c.Model == childModel))
|
if (Items.Any(c => c.Model == childModel))
|
||||||
|
|||||||
@ -181,7 +181,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
DataModelConditionGroup.RemoveChild(predicateViewModel.Model);
|
DataModelConditionGroup.RemoveChild(predicateViewModel.Model);
|
||||||
|
|
||||||
// Insert a list in the same position
|
// Insert a list in the same position
|
||||||
DataModelConditionList list = new DataModelConditionList(DataModelConditionGroup);
|
DataModelConditionList list = new(DataModelConditionGroup);
|
||||||
list.UpdateList(predicateViewModel.LeftSideSelectionViewModel.DataModelPath);
|
list.UpdateList(predicateViewModel.LeftSideSelectionViewModel.DataModelPath);
|
||||||
DataModelConditionGroup.AddChild(list, index);
|
DataModelConditionGroup.AddChild(list, index);
|
||||||
|
|
||||||
@ -196,7 +196,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
DataModelConditionGroup.RemoveChild(listViewModel.Model);
|
DataModelConditionGroup.RemoveChild(listViewModel.Model);
|
||||||
|
|
||||||
// Insert a list in the same position
|
// 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);
|
predicate.UpdateLeftSide(listViewModel.LeftSideSelectionViewModel.DataModelPath);
|
||||||
DataModelConditionGroup.AddChild(predicate, index);
|
DataModelConditionGroup.AddChild(predicate, index);
|
||||||
|
|
||||||
|
|||||||
@ -104,7 +104,7 @@ namespace Artemis.UI.Screens.ProfileEditor.Conditions
|
|||||||
if (DataModelConditionList.ListPath == null || !DataModelConditionList.ListPath.IsValid)
|
if (DataModelConditionList.ListPath == null || !DataModelConditionList.ListPath.IsValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
List<DataModelConditionViewModel> viewModels = new List<DataModelConditionViewModel>();
|
List<DataModelConditionViewModel> viewModels = new();
|
||||||
foreach (DataModelConditionPart childModel in Model.Children)
|
foreach (DataModelConditionPart childModel in Model.Children)
|
||||||
{
|
{
|
||||||
if (Items.Any(c => c.Model == childModel))
|
if (Items.Any(c => c.Model == childModel))
|
||||||
|
|||||||
@ -84,8 +84,8 @@
|
|||||||
<materialDesign:Card Grid.Row="3" Grid.ColumnSpan="2" Margin="0 5 0 0">
|
<materialDesign:Card Grid.Row="3" Grid.ColumnSpan="2" Margin="0 5 0 0">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
|
||||||
<ColumnDefinition Width="*" />
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -95,7 +95,12 @@
|
|||||||
<TextBlock Grid.Row="0" Margin="10 10 0 0">
|
<TextBlock Grid.Row="0" Margin="10 10 0 0">
|
||||||
Data binding result
|
Data binding result
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<TextBlock Grid.Row="0" Grid.Column="1" Margin="0 10 10 0" TextAlignment="Right" ToolTip="Click Play to ensure all other data bindings update as well." Cursor="Help">
|
<TextBlock Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="0 10 10 0"
|
||||||
|
Visibility="{Binding AlwaysApplyDataBindings.Value, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}}"
|
||||||
|
ToolTip="Click Play to ensure all other data bindings update as well or enable 'Constantly apply data bindings in editor'"
|
||||||
|
Cursor="Help">
|
||||||
Other data bindings not updating?
|
Other data bindings not updating?
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignLightSeparator}" Margin="0" />
|
<Separator Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Style="{StaticResource MaterialDesignLightSeparator}" Margin="0" />
|
||||||
|
|||||||
@ -122,7 +122,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.DataBindings.DirectDa
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Modifier type
|
// Modifier type
|
||||||
ModifierTypeCategoryViewModel root = new ModifierTypeCategoryViewModel(null, null);
|
ModifierTypeCategoryViewModel root = new(null, null);
|
||||||
IEnumerable<IGrouping<string, BaseDataBindingModifierType>> modifierTypes = _dataBindingService.GetCompatibleModifierTypes(sourceType, ModifierTypePart.Value).GroupBy(t => t.Category);
|
IEnumerable<IGrouping<string, BaseDataBindingModifierType>> modifierTypes = _dataBindingService.GetCompatibleModifierTypes(sourceType, ModifierTypePart.Value).GroupBy(t => t.Category);
|
||||||
foreach (IGrouping<string, BaseDataBindingModifierType> dataBindingModifierTypes in modifierTypes)
|
foreach (IGrouping<string, BaseDataBindingModifierType> dataBindingModifierTypes in modifierTypes)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -75,7 +75,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties
|
|||||||
|
|
||||||
public List<ITimelineKeyframeViewModel> GetAllKeyframeViewModels(bool expandedOnly)
|
public List<ITimelineKeyframeViewModel> GetAllKeyframeViewModels(bool expandedOnly)
|
||||||
{
|
{
|
||||||
List<ITimelineKeyframeViewModel> result = new List<ITimelineKeyframeViewModel>();
|
List<ITimelineKeyframeViewModel> result = new();
|
||||||
if (expandedOnly && !IsExpanded)
|
if (expandedOnly && !IsExpanded)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
|||||||
@ -71,7 +71,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Controls
|
|||||||
base.OnRender(drawingContext);
|
base.OnRender(drawingContext);
|
||||||
UpdateTimeScale();
|
UpdateTimeScale();
|
||||||
|
|
||||||
Pen linePen = new Pen(Fill, 1);
|
Pen linePen = new(Fill, 1);
|
||||||
double width = HorizontalOffset + VisibleWidth;
|
double width = HorizontalOffset + VisibleWidth;
|
||||||
int frameStart = 0;
|
int frameStart = 0;
|
||||||
|
|
||||||
@ -126,8 +126,8 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Controls
|
|||||||
|
|
||||||
private void RenderLabel(DrawingContext drawingContext, string text, double x)
|
private void RenderLabel(DrawingContext drawingContext, string text, double x)
|
||||||
{
|
{
|
||||||
Typeface typeFace = new Typeface(FontFamily, new FontStyle(), new FontWeight(), new FontStretch());
|
Typeface typeFace = new(FontFamily, new FontStyle(), new FontWeight(), new FontStretch());
|
||||||
FormattedText formattedText = new FormattedText(text, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, typeFace, 9, Fill, null, VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
FormattedText formattedText = new(text, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, typeFace, 9, Fill, null, VisualTreeHelper.GetDpi(this).PixelsPerDip);
|
||||||
if (x == 0 && OffsetFirstValue)
|
if (x == 0 && OffsetFirstValue)
|
||||||
drawingContext.DrawText(formattedText, new Point(2, 5));
|
drawingContext.DrawText(formattedText, new Point(2, 5));
|
||||||
else
|
else
|
||||||
|
|||||||
@ -42,7 +42,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Dialogs
|
|||||||
|
|
||||||
public class TimelineSegmentDialogViewModelValidator : AbstractValidator<TimelineSegmentDialogViewModel>
|
public class TimelineSegmentDialogViewModelValidator : AbstractValidator<TimelineSegmentDialogViewModel>
|
||||||
{
|
{
|
||||||
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()
|
public TimelineSegmentDialogViewModelValidator()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -31,7 +31,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline.Models
|
|||||||
if (HasBeenPasted)
|
if (HasBeenPasted)
|
||||||
throw new ArtemisUIException("Clipboard model can only be pasted once");
|
throw new ArtemisUIException("Clipboard model can only be pasted once");
|
||||||
|
|
||||||
List<ILayerPropertyKeyframe> results = new List<ILayerPropertyKeyframe>();
|
List<ILayerPropertyKeyframe> results = new();
|
||||||
if (!ClipboardModels.Any())
|
if (!ClipboardModels.Any())
|
||||||
return results;
|
return results;
|
||||||
|
|
||||||
|
|||||||
@ -249,7 +249,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
|
|||||||
|
|
||||||
private void CopyKeyframes(List<ILayerPropertyKeyframe> keyframes)
|
private void CopyKeyframes(List<ILayerPropertyKeyframe> keyframes)
|
||||||
{
|
{
|
||||||
KeyframesClipboardModel clipboardModel = new KeyframesClipboardModel(keyframes);
|
KeyframesClipboardModel clipboardModel = new(keyframes);
|
||||||
JsonClipboard.SetObject(clipboardModel);
|
JsonClipboard.SetObject(clipboardModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,7 +261,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
|
|||||||
|
|
||||||
private List<ILayerPropertyKeyframe> PasteClipboardData(KeyframesClipboardModel clipboardModel, TimeSpan pastePosition)
|
private List<ILayerPropertyKeyframe> PasteClipboardData(KeyframesClipboardModel clipboardModel, TimeSpan pastePosition)
|
||||||
{
|
{
|
||||||
List<ILayerPropertyKeyframe> pasted = new List<ILayerPropertyKeyframe>();
|
List<ILayerPropertyKeyframe> pasted = new();
|
||||||
if (clipboardModel == null)
|
if (clipboardModel == null)
|
||||||
return pasted;
|
return pasted;
|
||||||
RenderProfileElement target = _profileEditorService.SelectedProfileElement;
|
RenderProfileElement target = _profileEditorService.SelectedProfileElement;
|
||||||
@ -368,7 +368,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
Point position = e.GetPosition((IInputElement) sender);
|
Point position = e.GetPosition((IInputElement) sender);
|
||||||
Rect selectedRect = new Rect(_mouseDragStartPoint, position);
|
Rect selectedRect = new(_mouseDragStartPoint, position);
|
||||||
SelectionRectangle.Rect = selectedRect;
|
SelectionRectangle.Rect = selectedRect;
|
||||||
|
|
||||||
List<ITimelineKeyframeViewModel> keyframeViewModels = GetAllKeyframeViewModels();
|
List<ITimelineKeyframeViewModel> keyframeViewModels = GetAllKeyframeViewModels();
|
||||||
@ -386,7 +386,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
|
|||||||
if (_mouseDragging && e.LeftButton == MouseButtonState.Pressed)
|
if (_mouseDragging && e.LeftButton == MouseButtonState.Pressed)
|
||||||
{
|
{
|
||||||
Point position = e.GetPosition((IInputElement) sender);
|
Point position = e.GetPosition((IInputElement) sender);
|
||||||
Rect selectedRect = new Rect(_mouseDragStartPoint, position);
|
Rect selectedRect = new(_mouseDragStartPoint, position);
|
||||||
SelectionRectangle.Rect = selectedRect;
|
SelectionRectangle.Rect = selectedRect;
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
@ -432,7 +432,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Timeline
|
|||||||
|
|
||||||
private List<ITimelineKeyframeViewModel> GetAllKeyframeViewModels()
|
private List<ITimelineKeyframeViewModel> GetAllKeyframeViewModels()
|
||||||
{
|
{
|
||||||
List<ITimelineKeyframeViewModel> viewModels = new List<ITimelineKeyframeViewModel>();
|
List<ITimelineKeyframeViewModel> viewModels = new();
|
||||||
foreach (LayerPropertyGroupViewModel layerPropertyGroupViewModel in LayerPropertyGroups)
|
foreach (LayerPropertyGroupViewModel layerPropertyGroupViewModel in LayerPropertyGroups)
|
||||||
viewModels.AddRange(layerPropertyGroupViewModel.GetAllKeyframeViewModels(false));
|
viewModels.AddRange(layerPropertyGroupViewModel.GetAllKeyframeViewModels(false));
|
||||||
|
|
||||||
|
|||||||
@ -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
|
// 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));
|
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);
|
BrushConfigurationViewModel viewModel = (BrushConfigurationViewModel) layerBrush.Descriptor.Provider.Plugin.Kernel.Get(configurationViewModel.Type, argument);
|
||||||
|
|
||||||
_windowManager.ShowDialog(new LayerBrushSettingsWindowViewModel(viewModel));
|
_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");
|
throw new ArtemisUIException("Effect configuration dialogs must have exactly one constructor");
|
||||||
|
|
||||||
ParameterInfo effectParameter = constructors.First().GetParameters().First(p => typeof(BaseLayerEffect).IsAssignableFrom(p.ParameterType));
|
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);
|
EffectConfigurationViewModel viewModel = (EffectConfigurationViewModel) layerEffect.Descriptor.Provider.Plugin.Kernel.Get(configurationViewModel.Type, argument);
|
||||||
_windowManager.ShowDialog(new LayerEffectSettingsWindowViewModel(viewModel));
|
_windowManager.ShowDialog(new LayerEffectSettingsWindowViewModel(viewModel));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,7 +24,7 @@ namespace Artemis.UI.Screens.ProfileEditor.LayerProperties.Tree
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
e.Handled = true;
|
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,
|
RoutedEvent = UIElement.MouseWheelEvent,
|
||||||
Source = sender
|
Source = sender
|
||||||
|
|||||||
@ -54,7 +54,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
|
|||||||
|
|
||||||
public List<TreeItemViewModel> GetAllChildren()
|
public List<TreeItemViewModel> GetAllChildren()
|
||||||
{
|
{
|
||||||
List<TreeItemViewModel> children = new List<TreeItemViewModel>();
|
List<TreeItemViewModel> children = new();
|
||||||
foreach (TreeItemViewModel childFolder in Items)
|
foreach (TreeItemViewModel childFolder in Items)
|
||||||
{
|
{
|
||||||
// Add all children in this element
|
// Add all children in this element
|
||||||
@ -128,7 +128,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
|
|||||||
if (!SupportsChildren)
|
if (!SupportsChildren)
|
||||||
throw new ArtemisUIException("Cannot add a folder to a profile element of type " + ProfileElement.GetType().Name);
|
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();
|
_profileEditorService.UpdateSelectedProfile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
|
|||||||
if (!SupportsChildren)
|
if (!SupportsChildren)
|
||||||
throw new ArtemisUIException("Cannot add a layer to a profile element of type " + ProfileElement.GetType().Name);
|
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
|
// Could be null if the default brush got disabled
|
||||||
LayerBrushDescriptor brush = _layerBrushService.GetDefaultLayerBrush();
|
LayerBrushDescriptor brush = _layerBrushService.GetDefaultLayerBrush();
|
||||||
@ -217,7 +217,7 @@ namespace Artemis.UI.Screens.ProfileEditor.ProfileTree.TreeItem
|
|||||||
Items.Remove(treeItemViewModel);
|
Items.Remove(treeItemViewModel);
|
||||||
|
|
||||||
// Add missing children
|
// Add missing children
|
||||||
List<TreeItemViewModel> newChildren = new List<TreeItemViewModel>();
|
List<TreeItemViewModel> newChildren = new();
|
||||||
foreach (ProfileElement profileElement in ProfileElement.Children.OrderBy(c => c.Order))
|
foreach (ProfileElement profileElement in ProfileElement.Children.OrderBy(c => c.Order))
|
||||||
if (profileElement is Folder folder)
|
if (profileElement is Folder folder)
|
||||||
{
|
{
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user