1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Merge pull request #654 from Artemis-RGB/feature/AsReadOnly-replace

Core - replaced AsReadOnly calls in get only properties
This commit is contained in:
Robert Beekman 2021-09-09 15:16:10 +02:00 committed by GitHub
commit 9475f7cc0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 85 additions and 42 deletions

View File

@ -13,6 +13,11 @@ namespace Artemis.Core
{ {
private readonly List<DataModelConditionPart> _children = new(); private readonly List<DataModelConditionPart> _children = new();
protected DataModelConditionPart()
{
Children = new(_children);
}
/// <summary> /// <summary>
/// Gets the parent of this part /// Gets the parent of this part
/// </summary> /// </summary>
@ -21,7 +26,7 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// Gets the children of this part /// Gets the children of this part
/// </summary> /// </summary>
public ReadOnlyCollection<DataModelConditionPart> Children => _children.AsReadOnly(); public ReadOnlyCollection<DataModelConditionPart> Children { get; }
/// <summary> /// <summary>
/// Adds a child to the display condition part's <see cref="Children" /> collection /// Adds a child to the display condition part's <see cref="Children" /> collection

View File

@ -18,13 +18,14 @@ namespace Artemis.Core
{ {
DataBinding = dataBinding; DataBinding = dataBinding;
Entity = entity; Entity = entity;
Conditions = new(_conditions);
Load(); Load();
} }
/// <summary> /// <summary>
/// Gets a list of conditions applied to this data binding /// Gets a list of conditions applied to this data binding
/// </summary> /// </summary>
public ReadOnlyCollection<DataBindingCondition<TLayerProperty, TProperty>> Conditions => _conditions.AsReadOnly(); public ReadOnlyCollection<DataBindingCondition<TLayerProperty, TProperty>> Conditions { get; }
internal ConditionalDataBindingEntity Entity { get; } internal ConditionalDataBindingEntity Entity { get; }

View File

@ -17,7 +17,7 @@ namespace Artemis.Core
{ {
DataBinding = dataBinding; DataBinding = dataBinding;
Entity = entity; Entity = entity;
Modifiers = new(_modifiers);
Load(); Load();
} }
@ -29,7 +29,7 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// Gets a list of modifiers applied to this data binding /// Gets a list of modifiers applied to this data binding
/// </summary> /// </summary>
public ReadOnlyCollection<DataBindingModifier<TLayerProperty, TProperty>> Modifiers => _modifiers.AsReadOnly(); public ReadOnlyCollection<DataBindingModifier<TLayerProperty, TProperty>> Modifiers { get; }
internal DirectDataBindingEntity Entity { get; } internal DirectDataBindingEntity Entity { get; }

View File

@ -306,7 +306,7 @@ namespace Artemis.Core
ChildrenList.Add(new Layer(Profile, this, childLayer)); ChildrenList.Add(new Layer(Profile, this, childLayer));
// Ensure order integrity, should be unnecessary but no one is perfect specially me // Ensure order integrity, should be unnecessary but no one is perfect specially me
ChildrenList = ChildrenList.OrderBy(c => c.Order).ToList(); ChildrenList.Sort((a,b) => a.Order.CompareTo(b.Order));
for (int index = 0; index < ChildrenList.Count; index++) for (int index = 0; index < ChildrenList.Count; index++)
ChildrenList[index].Order = index + 1; ChildrenList[index].Order = index + 1;

View File

@ -43,6 +43,7 @@ namespace Artemis.Core
_transform = new LayerTransformProperties(); _transform = new LayerTransformProperties();
_leds = new List<ArtemisLed>(); _leds = new List<ArtemisLed>();
Leds = new ReadOnlyCollection<ArtemisLed>(_leds);
Adapter = new LayerAdapter(this); Adapter = new LayerAdapter(this);
Initialize(); Initialize();
@ -67,6 +68,7 @@ namespace Artemis.Core
_transform = new LayerTransformProperties(); _transform = new LayerTransformProperties();
_leds = new List<ArtemisLed>(); _leds = new List<ArtemisLed>();
Leds = new ReadOnlyCollection<ArtemisLed>(_leds);
Adapter = new LayerAdapter(this); Adapter = new LayerAdapter(this);
Load(); Load();
@ -76,7 +78,7 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// A collection of all the LEDs this layer is assigned to. /// A collection of all the LEDs this layer is assigned to.
/// </summary> /// </summary>
public ReadOnlyCollection<ArtemisLed> Leds => _leds.AsReadOnly(); public ReadOnlyCollection<ArtemisLed> Leds { get; private set; }
/// <summary> /// <summary>
/// Defines the shape that is rendered by the <see cref="LayerBrush" />. /// Defines the shape that is rendered by the <see cref="LayerBrush" />.
@ -679,6 +681,7 @@ namespace Artemis.Core
} }
_leds = leds; _leds = leds;
Leds = new ReadOnlyCollection<ArtemisLed>(_leds);
CalculateRenderProperties(); CalculateRenderProperties();
} }

View File

@ -44,6 +44,7 @@ namespace Artemis.Core
_baseValue = default!; _baseValue = default!;
_keyframes = new List<LayerPropertyKeyframe<T>>(); _keyframes = new List<LayerPropertyKeyframe<T>>();
Keyframes = new(_keyframes);
} }
/// <summary> /// <summary>
@ -337,7 +338,7 @@ namespace Artemis.Core
#region Keyframes #region Keyframes
private bool _keyframesEnabled; private bool _keyframesEnabled;
private List<LayerPropertyKeyframe<T>> _keyframes; private readonly List<LayerPropertyKeyframe<T>> _keyframes;
/// <summary> /// <summary>
/// Gets whether keyframes are supported on this type of property /// Gets whether keyframes are supported on this type of property
@ -363,7 +364,7 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// Gets a read-only list of all the keyframes on this layer property /// Gets a read-only list of all the keyframes on this layer property
/// </summary> /// </summary>
public ReadOnlyCollection<LayerPropertyKeyframe<T>> Keyframes => _keyframes.AsReadOnly(); public ReadOnlyCollection<LayerPropertyKeyframe<T>> Keyframes { get; }
/// <summary> /// <summary>
/// Gets the current keyframe in the timeline according to the current progress /// Gets the current keyframe in the timeline according to the current progress
@ -436,7 +437,7 @@ namespace Artemis.Core
/// </summary> /// </summary>
internal void SortKeyframes() internal void SortKeyframes()
{ {
_keyframes = _keyframes.OrderBy(k => k.Position).ToList(); _keyframes.Sort((a, b) => a.Position.CompareTo(b.Position));
} }
private void UpdateKeyframes(Timeline timeline) private void UpdateKeyframes(Timeline timeline)

View File

@ -37,6 +37,9 @@ namespace Artemis.Core
_layerProperties = new List<ILayerProperty>(); _layerProperties = new List<ILayerProperty>();
_layerPropertyGroups = new List<LayerPropertyGroup>(); _layerPropertyGroups = new List<LayerPropertyGroup>();
LayerProperties = new(_layerProperties);
LayerPropertyGroups = new(_layerPropertyGroups);
} }
/// <summary> /// <summary>
@ -96,12 +99,12 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// A list of all layer properties in this group /// A list of all layer properties in this group
/// </summary> /// </summary>
public ReadOnlyCollection<ILayerProperty> LayerProperties => _layerProperties.AsReadOnly(); public ReadOnlyCollection<ILayerProperty> LayerProperties { get; }
/// <summary> /// <summary>
/// A list of al child groups in this group /// A list of al child groups in this group
/// </summary> /// </summary>
public ReadOnlyCollection<LayerPropertyGroup> LayerPropertyGroups => _layerPropertyGroups.AsReadOnly(); public ReadOnlyCollection<LayerPropertyGroup> LayerPropertyGroups { get; }
/// <summary> /// <summary>
/// Recursively gets all layer properties on this group and any subgroups /// Recursively gets all layer properties on this group and any subgroups

View File

@ -24,12 +24,15 @@ namespace Artemis.Core
{ {
_name = name; _name = name;
Entity = new ProfileCategoryEntity(); Entity = new ProfileCategoryEntity();
ProfileConfigurations = new(_profileConfigurations);
} }
internal ProfileCategory(ProfileCategoryEntity entity) internal ProfileCategory(ProfileCategoryEntity entity)
{ {
_name = null!; _name = null!;
Entity = entity; Entity = entity;
ProfileConfigurations = new(_profileConfigurations);
Load(); Load();
} }
@ -73,7 +76,7 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// Gets a read only collection of the profiles inside this category /// Gets a read only collection of the profiles inside this category
/// </summary> /// </summary>
public ReadOnlyCollection<ProfileConfiguration> ProfileConfigurations => _profileConfigurations.AsReadOnly(); public ReadOnlyCollection<ProfileConfiguration> ProfileConfigurations { get; }
/// <summary> /// <summary>
/// Gets the unique ID of this category /// Gets the unique ID of this category

View File

@ -18,12 +18,13 @@ namespace Artemis.Core
private Profile _profile; private Profile _profile;
private bool _suspended; private bool _suspended;
internal List<ProfileElement> ChildrenList; internal readonly List<ProfileElement> ChildrenList;
internal ProfileElement(Profile profile) internal ProfileElement(Profile profile)
{ {
_profile = profile; _profile = profile;
ChildrenList = new List<ProfileElement>(); ChildrenList = new List<ProfileElement>();
Children = new(ChildrenList);
} }
/// <summary> /// <summary>
@ -56,16 +57,7 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// The element's children /// The element's children
/// </summary> /// </summary>
public ReadOnlyCollection<ProfileElement> Children public ReadOnlyCollection<ProfileElement> Children { get; }
{
get
{
lock (ChildrenList)
{
return ChildrenList.AsReadOnly();
}
}
}
/// <summary> /// <summary>
/// The order in which this element appears in the update loop and editor /// The order in which this element appears in the update loop and editor

View File

@ -24,6 +24,7 @@ namespace Artemis.Core
Timeline = new Timeline(); Timeline = new Timeline();
ExpandedPropertyGroups = new List<string>(); ExpandedPropertyGroups = new List<string>();
LayerEffectsList = new List<BaseLayerEffect>(); LayerEffectsList = new List<BaseLayerEffect>();
LayerEffects = new(LayerEffectsList);
LayerEffectStore.LayerEffectAdded += LayerEffectStoreOnLayerEffectAdded; LayerEffectStore.LayerEffectAdded += LayerEffectStoreOnLayerEffectAdded;
LayerEffectStore.LayerEffectRemoved += LayerEffectStoreOnLayerEffectRemoved; LayerEffectStore.LayerEffectRemoved += LayerEffectStoreOnLayerEffectRemoved;
@ -223,12 +224,12 @@ namespace Artemis.Core
#region Effect management #region Effect management
internal List<BaseLayerEffect> LayerEffectsList; internal readonly List<BaseLayerEffect> LayerEffectsList;
/// <summary> /// <summary>
/// Gets a read-only collection of the layer effects on this entity /// Gets a read-only collection of the layer effects on this entity
/// </summary> /// </summary>
public ReadOnlyCollection<BaseLayerEffect> LayerEffects => LayerEffectsList.AsReadOnly(); public ReadOnlyCollection<BaseLayerEffect> LayerEffects { get; }
/// <summary> /// <summary>
/// Adds a the layer effect described inthe provided <paramref name="descriptor" /> /// Adds a the layer effect described inthe provided <paramref name="descriptor" />

View File

@ -24,6 +24,7 @@ namespace Artemis.Core
MainSegmentLength = TimeSpan.FromSeconds(5); MainSegmentLength = TimeSpan.FromSeconds(5);
_extraTimelines = new List<Timeline>(); _extraTimelines = new List<Timeline>();
ExtraTimelines = new(_extraTimelines);
Save(); Save();
} }
@ -32,6 +33,7 @@ namespace Artemis.Core
{ {
Entity = entity; Entity = entity;
_extraTimelines = new List<Timeline>(); _extraTimelines = new List<Timeline>();
ExtraTimelines = new(_extraTimelines);
Load(); Load();
} }
@ -45,6 +47,7 @@ namespace Artemis.Core
EndSegmentLength = Parent.EndSegmentLength; EndSegmentLength = Parent.EndSegmentLength;
_extraTimelines = new List<Timeline>(); _extraTimelines = new List<Timeline>();
ExtraTimelines = new(_extraTimelines);
} }
/// <inheritdoc /> /// <inheritdoc />
@ -150,7 +153,7 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// Gets a list of extra copies of the timeline applied to this timeline /// Gets a list of extra copies of the timeline applied to this timeline
/// </summary> /// </summary>
public ReadOnlyCollection<Timeline> ExtraTimelines => _extraTimelines.AsReadOnly(); public ReadOnlyCollection<Timeline> ExtraTimelines { get; }
/// <summary> /// <summary>
/// Gets a boolean indicating whether the timeline has finished its run /// Gets a boolean indicating whether the timeline has finished its run

View File

@ -17,13 +17,14 @@ namespace Artemis.Core.LayerBrushes
protected LayerBrushProvider() protected LayerBrushProvider()
{ {
_layerBrushDescriptors = new List<LayerBrushDescriptor>(); _layerBrushDescriptors = new List<LayerBrushDescriptor>();
LayerBrushDescriptors = new(_layerBrushDescriptors);
Disabled += OnDisabled; Disabled += OnDisabled;
} }
/// <summary> /// <summary>
/// A read-only collection of all layer brushes added with <see cref="RegisterLayerBrushDescriptor{T}" /> /// A read-only collection of all layer brushes added with <see cref="RegisterLayerBrushDescriptor{T}" />
/// </summary> /// </summary>
public ReadOnlyCollection<LayerBrushDescriptor> LayerBrushDescriptors => _layerBrushDescriptors.AsReadOnly(); public ReadOnlyCollection<LayerBrushDescriptor> LayerBrushDescriptors { get; }
/// <summary> /// <summary>
/// Registers a layer brush descriptor for a given layer brush, so that it appears in the UI. /// Registers a layer brush descriptor for a given layer brush, so that it appears in the UI.

View File

@ -18,13 +18,14 @@ namespace Artemis.Core.LayerEffects
protected LayerEffectProvider() protected LayerEffectProvider()
{ {
_layerEffectDescriptors = new List<LayerEffectDescriptor>(); _layerEffectDescriptors = new List<LayerEffectDescriptor>();
LayerEffectDescriptors = new(_layerEffectDescriptors);
Disabled += OnDisabled; Disabled += OnDisabled;
} }
/// <summary> /// <summary>
/// A read-only collection of all layer effects added with <see cref="RegisterLayerEffectDescriptor{T}" /> /// A read-only collection of all layer effects added with <see cref="RegisterLayerEffectDescriptor{T}" />
/// </summary> /// </summary>
public ReadOnlyCollection<LayerEffectDescriptor> LayerEffectDescriptors => _layerEffectDescriptors.AsReadOnly(); public ReadOnlyCollection<LayerEffectDescriptor> LayerEffectDescriptors { get; }
/// <summary> /// <summary>
/// Adds a layer effect descriptor for a given layer effect, so that it appears in the UI. /// Adds a layer effect descriptor for a given layer effect, so that it appears in the UI.

View File

@ -26,6 +26,9 @@ namespace Artemis.Core.Modules
// These are both set right after construction to keep the constructor of inherited classes clean // These are both set right after construction to keep the constructor of inherited classes clean
Module = null!; Module = null!;
DataModelDescription = null!; DataModelDescription = null!;
ActivePaths = new(_activePaths);
DynamicChildren = new(_dynamicChildren);
} }
/// <summary> /// <summary>
@ -52,13 +55,13 @@ namespace Artemis.Core.Modules
/// Gets an read-only dictionary of all dynamic children /// Gets an read-only dictionary of all dynamic children
/// </summary> /// </summary>
[DataModelIgnore] [DataModelIgnore]
public ReadOnlyDictionary<string, DynamicChild> DynamicChildren => new(_dynamicChildren); public ReadOnlyDictionary<string, DynamicChild> DynamicChildren { get; }
/// <summary> /// <summary>
/// Gets a read-only list of <see cref="DataModelPath" />s targeting this data model /// Gets a read-only list of <see cref="DataModelPath" />s targeting this data model
/// </summary> /// </summary>
[DataModelIgnore] [DataModelIgnore]
public ReadOnlyCollection<DataModelPath> ActivePaths => _activePaths.AsReadOnly(); public ReadOnlyCollection<DataModelPath> ActivePaths { get; }
/// <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

View File

@ -114,6 +114,12 @@ namespace Artemis.Core.Modules
private readonly List<(DefaultCategoryName, string)> _defaultProfilePaths = new(); private readonly List<(DefaultCategoryName, string)> _defaultProfilePaths = new();
private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = new(); private readonly List<(DefaultCategoryName, string)> _pendingDefaultProfilePaths = new();
protected Module()
{
DefaultProfilePaths = new ReadOnlyCollection<(DefaultCategoryName, string)>(_defaultProfilePaths);
HiddenProperties = new(HiddenPropertiesList);
}
/// <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>
@ -122,7 +128,7 @@ namespace Artemis.Core.Modules
/// <summary> /// <summary>
/// Gets a read only collection of default profile paths /// Gets a read only collection of default profile paths
/// </summary> /// </summary>
public IReadOnlyCollection<(DefaultCategoryName, string)> DefaultProfilePaths => _defaultProfilePaths.AsReadOnly(); public IReadOnlyCollection<(DefaultCategoryName, string)> DefaultProfilePaths { get; }
/// <summary> /// <summary>
/// A list of activation requirements /// A list of activation requirements
@ -176,7 +182,7 @@ 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>
public ReadOnlyCollection<PropertyInfo> HiddenProperties => HiddenPropertiesList.AsReadOnly(); public ReadOnlyCollection<PropertyInfo> HiddenProperties { get; }
internal DataModel? InternalDataModel { get; set; } internal DataModel? InternalDataModel { get; set; }

View File

@ -30,6 +30,9 @@ namespace Artemis.Core
_features = new List<PluginFeatureInfo>(); _features = new List<PluginFeatureInfo>();
_profilers = new List<Profiler>(); _profilers = new List<Profiler>();
Features = new(_features);
Profilers = new(_profilers);
} }
/// <summary> /// <summary>
@ -64,12 +67,12 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// Gets a read-only collection of all features this plugin provides /// Gets a read-only collection of all features this plugin provides
/// </summary> /// </summary>
public ReadOnlyCollection<PluginFeatureInfo> Features => _features.AsReadOnly(); public ReadOnlyCollection<PluginFeatureInfo> Features { get; }
/// <summary> /// <summary>
/// Gets a read-only collection of profiles running on the plugin /// Gets a read-only collection of profiles running on the plugin
/// </summary> /// </summary>
public ReadOnlyCollection<Profiler> Profilers => _profilers.AsReadOnly(); public ReadOnlyCollection<Profiler> Profilers { get; }
/// <summary> /// <summary>
/// The assembly the plugin code lives in /// The assembly the plugin code lives in

View File

@ -44,6 +44,11 @@ namespace Artemis.Core.ScriptingProviders
/// </summary> /// </summary>
public abstract class ScriptingProvider : PluginFeature public abstract class ScriptingProvider : PluginFeature
{ {
protected ScriptingProvider()
{
Scripts = new(InternalScripts);
}
/// <summary> /// <summary>
/// Gets the name of the scripting language this provider provides /// Gets the name of the scripting language this provider provides
/// </summary> /// </summary>
@ -52,7 +57,7 @@ namespace Artemis.Core.ScriptingProviders
/// <summary> /// <summary>
/// Gets a list of all active scripts belonging to this scripting provider /// Gets a list of all active scripts belonging to this scripting provider
/// </summary> /// </summary>
public ReadOnlyCollection<Script> Scripts => InternalScripts.AsReadOnly(); public ReadOnlyCollection<Script> Scripts { get; }
internal abstract Type GlobalScriptType { get; } internal abstract Type GlobalScriptType { get; }
internal abstract Type ProfileScriptType { get; } internal abstract Type ProfileScriptType { get; }

View File

@ -49,6 +49,10 @@ namespace Artemis.Core.Services
_devices = new List<ArtemisDevice>(); _devices = new List<ArtemisDevice>();
_ledMap = new Dictionary<Led, ArtemisLed>(); _ledMap = new Dictionary<Led, ArtemisLed>();
EnabledDevices = new ReadOnlyCollection<ArtemisDevice>(_enabledDevices);
Devices = new ReadOnlyCollection<ArtemisDevice>(_devices);
LedMap = new ReadOnlyDictionary<Led, ArtemisLed>(_ledMap);
UpdateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / _targetFrameRateSetting.Value}; UpdateTrigger = new TimerUpdateTrigger {UpdateFrequency = 1.0 / _targetFrameRateSetting.Value};
SetRenderPaused(true); SetRenderPaused(true);
Surface.RegisterUpdateTrigger(UpdateTrigger); Surface.RegisterUpdateTrigger(UpdateTrigger);
@ -85,6 +89,7 @@ namespace Artemis.Core.Services
try try
{ {
_ledMap = new Dictionary<Led, ArtemisLed>(_devices.SelectMany(d => d.Leds).ToDictionary(l => l.RgbLed)); _ledMap = new Dictionary<Led, ArtemisLed>(_devices.SelectMany(d => d.Leds).ToDictionary(l => l.RgbLed));
LedMap = new ReadOnlyDictionary<Led, ArtemisLed>(_ledMap);
if (_surfaceLedGroup == null) if (_surfaceLedGroup == null)
{ {
@ -132,9 +137,9 @@ namespace Artemis.Core.Services
_texture?.Invalidate(); _texture?.Invalidate();
} }
public IReadOnlyCollection<ArtemisDevice> EnabledDevices => _enabledDevices.AsReadOnly(); public IReadOnlyCollection<ArtemisDevice> EnabledDevices { get; }
public IReadOnlyCollection<ArtemisDevice> Devices => _devices.AsReadOnly(); public IReadOnlyCollection<ArtemisDevice> Devices { get; }
public IReadOnlyDictionary<Led, ArtemisLed> LedMap => new ReadOnlyDictionary<Led, ArtemisLed>(_ledMap); public IReadOnlyDictionary<Led, ArtemisLed> LedMap { get; private set; }
public RGBSurface Surface { get; set; } public RGBSurface Surface { get; set; }
public bool IsRenderPaused { get; set; } public bool IsRenderPaused { get; set; }

View File

@ -24,6 +24,7 @@ namespace Artemis.Core.Services
_profileService = profileService; _profileService = profileService;
InternalGlobalScripts = new List<GlobalScript>(); InternalGlobalScripts = new List<GlobalScript>();
GlobalScripts = new(InternalGlobalScripts);
_pluginManagementService.PluginFeatureEnabled += PluginManagementServiceOnPluginFeatureToggled; _pluginManagementService.PluginFeatureEnabled += PluginManagementServiceOnPluginFeatureToggled;
_pluginManagementService.PluginFeatureDisabled += PluginManagementServiceOnPluginFeatureToggled; _pluginManagementService.PluginFeatureDisabled += PluginManagementServiceOnPluginFeatureToggled;
@ -80,7 +81,7 @@ namespace Artemis.Core.Services
CreateScriptInstance(profile, scriptConfiguration); CreateScriptInstance(profile, scriptConfiguration);
} }
public ReadOnlyCollection<GlobalScript> GlobalScripts => InternalGlobalScripts.AsReadOnly(); public ReadOnlyCollection<GlobalScript> GlobalScripts { get; }
public GlobalScript? CreateScriptInstance(ScriptConfiguration scriptConfiguration) public GlobalScript? CreateScriptInstance(ScriptConfiguration scriptConfiguration)
{ {

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using Artemis.Core; using Artemis.Core;
using Artemis.Core.Modules; using Artemis.Core.Modules;
@ -26,10 +27,13 @@ namespace Artemis.UI.Shared.Services
_kernel = kernel; _kernel = kernel;
_registeredDataModelEditors = new List<DataModelVisualizationRegistration>(); _registeredDataModelEditors = new List<DataModelVisualizationRegistration>();
_registeredDataModelDisplays = new List<DataModelVisualizationRegistration>(); _registeredDataModelDisplays = new List<DataModelVisualizationRegistration>();
RegisteredDataModelEditors = new ReadOnlyCollection<DataModelVisualizationRegistration>(_registeredDataModelEditors);
RegisteredDataModelDisplays = new ReadOnlyCollection<DataModelVisualizationRegistration>(_registeredDataModelDisplays);
} }
public IReadOnlyCollection<DataModelVisualizationRegistration> RegisteredDataModelEditors => _registeredDataModelEditors.AsReadOnly(); public IReadOnlyCollection<DataModelVisualizationRegistration> RegisteredDataModelEditors { get; }
public IReadOnlyCollection<DataModelVisualizationRegistration> RegisteredDataModelDisplays => _registeredDataModelDisplays.AsReadOnly(); public IReadOnlyCollection<DataModelVisualizationRegistration> RegisteredDataModelDisplays { get; }
public DataModelPropertiesViewModel GetMainDataModelVisualization() public DataModelPropertiesViewModel GetMainDataModelVisualization()
{ {

View File

@ -38,6 +38,8 @@ namespace Artemis.UI.Shared.Services
_rgbService = rgbService; _rgbService = rgbService;
_moduleService = moduleService; _moduleService = moduleService;
_registeredPropertyEditors = new List<PropertyInputRegistration>(); _registeredPropertyEditors = new List<PropertyInputRegistration>();
RegisteredPropertyEditors = new(_registeredPropertyEditors);
coreService.FrameRendered += CoreServiceOnFrameRendered; coreService.FrameRendered += CoreServiceOnFrameRendered;
PixelsPerSecond = 100; PixelsPerSecond = 100;
} }
@ -104,7 +106,7 @@ namespace Artemis.UI.Shared.Services
} }
} }
public ReadOnlyCollection<PropertyInputRegistration> RegisteredPropertyEditors => _registeredPropertyEditors.AsReadOnly(); public ReadOnlyCollection<PropertyInputRegistration> RegisteredPropertyEditors { get; }
public bool Playing { get; set; } public bool Playing { get; set; }