diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index fca9504ac..a9c4706ed 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -21,11 +21,11 @@ - + - - + + @@ -35,8 +35,8 @@ - - + + diff --git a/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs b/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs index f6f2d721a..bc66fb1ee 100644 --- a/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs +++ b/src/Artemis.Core/Models/Profile/Colors/ColorGradient.cs @@ -55,7 +55,7 @@ namespace Artemis.Core.Models.Profile.Colors if (right == null || left == right) return left.Color; - + position = (float) Math.Round((position - left.Position) / (right.Position - left.Position), 2); var a = (byte) ((right.Color.Alpha - left.Color.Alpha) * position + left.Color.Alpha); var r = (byte) ((right.Color.Red - left.Color.Red) * position + left.Color.Red); @@ -65,15 +65,19 @@ namespace Artemis.Core.Models.Profile.Colors } /// - /// [PH] Looping through HSV, adds 8 rainbow colors + /// Gets a new ColorGradient with colors looping through the HSV-spectrum /// - public void MakeFabulous() + /// + public static ColorGradient GetUnicornBarf() { + var gradient = new ColorGradient(); for (var i = 0; i < 9; i++) { var color = i != 8 ? SKColor.FromHsv(i * 32, 100, 100) : SKColor.FromHsv(0, 100, 100); - Stops.Add(new ColorGradientStop(color, 0.125f * i)); + gradient.Stops.Add(new ColorGradientStop(color, 0.125f * i)); } + + return gradient; } #region PropertyChanged diff --git a/src/Artemis.Core/Models/Profile/Layer.cs b/src/Artemis.Core/Models/Profile/Layer.cs index 8ec456c22..e9f74c2d9 100644 --- a/src/Artemis.Core/Models/Profile/Layer.cs +++ b/src/Artemis.Core/Models/Profile/Layer.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; -using System.Windows.Media.Animation; using Artemis.Core.Extensions; using Artemis.Core.Models.Profile.LayerProperties; using Artemis.Core.Models.Profile.LayerProperties.Attributes; @@ -22,6 +21,7 @@ namespace Artemis.Core.Models.Profile /// public sealed class Layer : ProfileElement { + private readonly List _expandedPropertyGroups; private LayerShape _layerShape; private List _leds; private SKPath _path; @@ -38,6 +38,8 @@ namespace Artemis.Core.Models.Profile Transform = new LayerTransformProperties {IsCorePropertyGroup = true}; _leds = new List(); + _expandedPropertyGroups = new List(); + General.PropertyGroupInitialized += GeneralOnPropertyGroupInitialized; } @@ -54,6 +56,9 @@ namespace Artemis.Core.Models.Profile Transform = new LayerTransformProperties {IsCorePropertyGroup = true}; _leds = new List(); + _expandedPropertyGroups = new List(); + _expandedPropertyGroups.AddRange(layerEntity.ExpandedPropertyGroups); + General.PropertyGroupInitialized += GeneralOnPropertyGroupInitialized; } @@ -99,10 +104,10 @@ namespace Artemis.Core.Models.Profile } } - [PropertyGroupDescription(Name = "General", Description = "A collection of general properties", ExpandByDefault = true)] + [PropertyGroupDescription(Name = "General", Description = "A collection of general properties")] public LayerGeneralProperties General { get; set; } - [PropertyGroupDescription(Name = "Transform", Description = "A collection of transformation properties", ExpandByDefault = true)] + [PropertyGroupDescription(Name = "Transform", Description = "A collection of transformation properties")] public LayerTransformProperties Transform { get; set; } /// @@ -115,6 +120,19 @@ namespace Artemis.Core.Models.Profile return $"[Layer] {nameof(Name)}: {Name}, {nameof(Order)}: {Order}"; } + public bool IsPropertyGroupExpanded(LayerPropertyGroup layerPropertyGroup) + { + return _expandedPropertyGroups.Contains(layerPropertyGroup.Path); + } + + public void SetPropertyGroupExpanded(LayerPropertyGroup layerPropertyGroup, bool expanded) + { + if (!expanded && IsPropertyGroupExpanded(layerPropertyGroup)) + _expandedPropertyGroups.Remove(layerPropertyGroup.Path); + else if (expanded && !IsPropertyGroupExpanded(layerPropertyGroup)) + _expandedPropertyGroups.Add(layerPropertyGroup.Path); + } + #region Storage internal override void ApplyToEntity() @@ -125,6 +143,8 @@ namespace Artemis.Core.Models.Profile LayerEntity.Order = Order; LayerEntity.Name = Name; LayerEntity.ProfileId = Profile.EntityId; + LayerEntity.ExpandedPropertyGroups.Clear(); + LayerEntity.ExpandedPropertyGroups.AddRange(_expandedPropertyGroups); General.ApplyToEntity(); Transform.ApplyToEntity(); diff --git a/src/Artemis.Core/Models/Profile/LayerGeneralProperties.cs b/src/Artemis.Core/Models/Profile/LayerGeneralProperties.cs index f12489f22..e0a2b46d4 100644 --- a/src/Artemis.Core/Models/Profile/LayerGeneralProperties.cs +++ b/src/Artemis.Core/Models/Profile/LayerGeneralProperties.cs @@ -1,5 +1,4 @@ -using Artemis.Core.Models.Profile.LayerProperties; -using Artemis.Core.Models.Profile.LayerProperties.Attributes; +using Artemis.Core.Models.Profile.LayerProperties.Attributes; using Artemis.Core.Models.Profile.LayerProperties.Types; using SkiaSharp; @@ -19,17 +18,15 @@ namespace Artemis.Core.Models.Profile [PropertyDescription(Name = "Brush type", Description = "The type of brush to use for this layer")] public LayerBrushReferenceLayerProperty BrushReference { get; set; } + protected override void PopulateDefaults() + { + ShapeType.DefaultValue = LayerShapeType.Rectangle; + FillType.DefaultValue = LayerFillType.Stretch; + BlendMode.DefaultValue = SKBlendMode.SrcOver; + } + protected override void OnPropertiesInitialized() { - // Populate defaults - if (!ShapeType.IsLoadedFromStorage) - ShapeType.BaseValue = LayerShapeType.Rectangle; - if (!FillType.IsLoadedFromStorage) - FillType.BaseValue = LayerFillType.Stretch; - if (!BlendMode.IsLoadedFromStorage) - BlendMode.BaseValue = SKBlendMode.SrcOver; - - // TODO: SpoinkyNL 28-4-2020: Select preferred default brush type with a fallback to the first available } } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs index bff3806a2..9dbed60a3 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/BaseLayerProperty.cs @@ -141,5 +141,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties } #endregion + + public abstract void ApplyDefaultValue(); } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs index 351593d3f..03184f426 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/LayerProperty.cs @@ -55,6 +55,12 @@ namespace Artemis.Core.Models.Profile.LayerProperties internal set => _currentValue = value; } + /// + /// Gets or sets the default value of this layer property. If set, this value is automatically applied if the property has no + /// value in storage + /// + public T DefaultValue { get; set; } + /// /// Gets a read-only list of all the keyframes on this layer property /// @@ -275,5 +281,10 @@ namespace Artemis.Core.Models.Profile.LayerProperties EasingFunction = (int) k.EasingFunction })); } + + public override void ApplyDefaultValue() + { + CurrentValue = DefaultValue; + } } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerProperties/Types/ColorGradientLayerProperty.cs b/src/Artemis.Core/Models/Profile/LayerProperties/Types/ColorGradientLayerProperty.cs index 1d32b63a7..7b6c36d5f 100644 --- a/src/Artemis.Core/Models/Profile/LayerProperties/Types/ColorGradientLayerProperty.cs +++ b/src/Artemis.Core/Models/Profile/LayerProperties/Types/ColorGradientLayerProperty.cs @@ -1,5 +1,6 @@ using Artemis.Core.Exceptions; using Artemis.Core.Models.Profile.Colors; +using Artemis.Storage.Entities.Profile; namespace Artemis.Core.Models.Profile.LayerProperties.Types { @@ -11,6 +12,18 @@ namespace Artemis.Core.Models.Profile.LayerProperties.Types KeyframesSupported = false; } + internal override void ApplyToLayerProperty(PropertyEntity entity, LayerPropertyGroup layerPropertyGroup, bool fromStorage) + { + base.ApplyToLayerProperty(entity, layerPropertyGroup, fromStorage); + + // Don't allow color gradients to be null + if (BaseValue == null) + { + BaseValue = DefaultValue ?? new ColorGradient(); + } + + } + protected override void UpdateCurrentValue(float keyframeProgress, float keyframeProgressEased) { throw new ArtemisCoreException("Color Gradients do not support keyframes."); diff --git a/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs b/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs index 2ea9b5047..c804705de 100644 --- a/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs +++ b/src/Artemis.Core/Models/Profile/LayerPropertyGroup.cs @@ -13,11 +13,11 @@ using Artemis.Storage.Entities.Profile; namespace Artemis.Core.Models.Profile { - public class LayerPropertyGroup + public abstract class LayerPropertyGroup { - private ReadOnlyCollection _allLayerProperties; private readonly List _layerProperties; private readonly List _layerPropertyGroups; + private ReadOnlyCollection _allLayerProperties; protected LayerPropertyGroup() { @@ -26,17 +26,22 @@ namespace Artemis.Core.Models.Profile } /// - /// The layer this property group applies to + /// The layer this property group applies to /// public Layer Layer { get; internal set; } + /// + /// The path of this property group + /// + public string Path { get; internal set; } + /// /// The parent group of this layer property group, set after construction /// public LayerPropertyGroup Parent { get; internal set; } /// - /// Gets whether this property group's properties are all initialized + /// Gets whether this property group's properties are all initialized /// public bool PropertiesInitialized { get; private set; } @@ -61,10 +66,39 @@ namespace Artemis.Core.Models.Profile public ReadOnlyCollection LayerPropertyGroups => _layerPropertyGroups.AsReadOnly(); /// - /// Called when all layer properties in this property group have been initialized + /// Recursively gets all layer properties on this group and any subgroups /// - protected virtual void OnPropertiesInitialized() + /// + public IReadOnlyCollection GetAllLayerProperties() { + if (!PropertiesInitialized) + return new List(); + if (_allLayerProperties != null) + return _allLayerProperties; + + var result = new List(LayerProperties); + foreach (var layerPropertyGroup in LayerPropertyGroups) + result.AddRange(layerPropertyGroup.GetAllLayerProperties()); + + _allLayerProperties = result.AsReadOnly(); + return _allLayerProperties; + } + + /// + /// Called before properties are fully initialized to allow you to populate + /// on the properties you want + /// + protected abstract void PopulateDefaults(); + + /// + /// Called when all layer properties in this property group have been initialized, you may access all properties on the + /// group here + /// + protected abstract void OnPropertiesInitialized(); + + protected virtual void OnPropertyGroupInitialized() + { + PropertyGroupInitialized?.Invoke(this, EventArgs.Empty); } internal void InitializeProperties(ILayerService layerService, Layer layer, [NotNull] string path) @@ -76,6 +110,7 @@ namespace Artemis.Core.Models.Profile throw new ArtemisCoreException("Layer property group already initialized, wut"); Layer = layer; + Path = path.TrimEnd('.'); // Get all properties with a PropertyDescriptionAttribute foreach (var propertyInfo in GetType().GetProperties()) @@ -110,9 +145,12 @@ namespace Artemis.Core.Models.Profile } } + PopulateDefaults(); + foreach (var layerProperty in _layerProperties.Where(p => !p.IsLoadedFromStorage)) + layerProperty.ApplyDefaultValue(); + OnPropertiesInitialized(); PropertiesInitialized = true; - OnPropertyGroupInitialized(); } @@ -152,25 +190,6 @@ namespace Artemis.Core.Models.Profile OnPropertyGroupOverriding(new PropertyGroupUpdatingEventArgs(overrideTime)); } - /// - /// Recursively gets all layer properties on this group and any subgroups - /// - /// - public IReadOnlyCollection GetAllLayerProperties() - { - if (!PropertiesInitialized) - return new List(); - if (_allLayerProperties != null) - return _allLayerProperties; - - var result = new List(LayerProperties); - foreach (var layerPropertyGroup in LayerPropertyGroups) - result.AddRange(layerPropertyGroup.GetAllLayerProperties()); - - _allLayerProperties = result.AsReadOnly(); - return _allLayerProperties; - } - private void InitializeProperty(Layer layer, string path, BaseLayerProperty instance) { var pluginGuid = IsCorePropertyGroup || instance.IsCoreProperty ? Constants.CorePluginInfo.Guid : layer.LayerBrush.PluginInfo.Guid; @@ -203,10 +222,5 @@ namespace Artemis.Core.Models.Profile } #endregion - - protected virtual void OnPropertyGroupInitialized() - { - PropertyGroupInitialized?.Invoke(this, EventArgs.Empty); - } } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/LayerTransformProperties.cs b/src/Artemis.Core/Models/Profile/LayerTransformProperties.cs index cb67e4dfb..81b35a838 100644 --- a/src/Artemis.Core/Models/Profile/LayerTransformProperties.cs +++ b/src/Artemis.Core/Models/Profile/LayerTransformProperties.cs @@ -1,5 +1,4 @@ -using Artemis.Core.Models.Profile.LayerProperties; -using Artemis.Core.Models.Profile.LayerProperties.Attributes; +using Artemis.Core.Models.Profile.LayerProperties.Attributes; using Artemis.Core.Models.Profile.LayerProperties.Types; using SkiaSharp; @@ -22,13 +21,14 @@ namespace Artemis.Core.Models.Profile [PropertyDescription(Description = "The opacity of the shape", InputAffix = "%", MinInputValue = 0f, MaxInputValue = 100f)] public FloatLayerProperty Opacity { get; set; } + protected override void PopulateDefaults() + { + Scale.DefaultValue = new SKSize(100, 100); + Opacity.DefaultValue = 100; + } + protected override void OnPropertiesInitialized() { - // Populate defaults - if (!Scale.IsLoadedFromStorage) - Scale.BaseValue = new SKSize(100, 100); - if (!Opacity.IsLoadedFromStorage) - Opacity.BaseValue = 100; } } } \ No newline at end of file diff --git a/src/Artemis.Core/Models/Profile/ProfileElement.cs b/src/Artemis.Core/Models/Profile/ProfileElement.cs index 89d74aa99..6657ade42 100644 --- a/src/Artemis.Core/Models/Profile/ProfileElement.cs +++ b/src/Artemis.Core/Models/Profile/ProfileElement.cs @@ -131,5 +131,10 @@ namespace Artemis.Core.Models.Profile /// Applies the profile element's properties to the underlying storage entity /// internal abstract void ApplyToEntity(); + + public override string ToString() + { + return $"{nameof(EntityId)}: {EntityId}, {nameof(Order)}: {Order}, {nameof(Name)}: {Name}"; + } } } \ No newline at end of file diff --git a/src/Artemis.Core/Ninject/CoreModule.cs b/src/Artemis.Core/Ninject/CoreModule.cs index 61701837b..b61a0f0c5 100644 --- a/src/Artemis.Core/Ninject/CoreModule.cs +++ b/src/Artemis.Core/Ninject/CoreModule.cs @@ -2,6 +2,8 @@ using Artemis.Core.Exceptions; using Artemis.Core.Plugins.Models; using Artemis.Core.Services.Interfaces; +using Artemis.Storage; +using Artemis.Storage.Migrations.Interfaces; using Artemis.Storage.Repositories.Interfaces; using LiteDB; using Ninject.Activation; @@ -60,6 +62,18 @@ namespace Artemis.Core.Ninject } }).InSingletonScope(); + Kernel.Bind().ToSelf().InSingletonScope(); + + // Bind all migrations as singletons + Kernel.Bind(x => + { + x.FromAssemblyContaining() + .SelectAllClasses() + .InheritedFrom() + .BindAllInterfaces() + .Configure(c => c.InSingletonScope()); + }); + // Bind all repositories as singletons Kernel.Bind(x => { diff --git a/src/Artemis.Core/Services/CoreService.cs b/src/Artemis.Core/Services/CoreService.cs index 896186074..6a07ae5b1 100644 --- a/src/Artemis.Core/Services/CoreService.cs +++ b/src/Artemis.Core/Services/CoreService.cs @@ -9,6 +9,8 @@ using Artemis.Core.Plugins.Abstract; using Artemis.Core.Plugins.Models; using Artemis.Core.Services.Interfaces; using Artemis.Core.Services.Storage.Interfaces; +using Artemis.Storage; +using Artemis.Storage.Migrations.Interfaces; using Newtonsoft.Json; using RGB.NET.Core; using Serilog; @@ -30,8 +32,9 @@ namespace Artemis.Core.Services private List _modules; private PluginSetting _loggingLevel; - internal CoreService(ILogger logger, ISettingsService settingsService, IPluginService pluginService, IRgbService rgbService, - ISurfaceService surfaceService, IProfileService profileService) + // ReSharper disable once UnusedParameter.Local - Storage migration service is injected early to ensure it runs before anything else + internal CoreService(ILogger logger, StorageMigrationService _, ISettingsService settingsService, IPluginService pluginService, + IRgbService rgbService, ISurfaceService surfaceService, IProfileService profileService) { _logger = logger; _pluginService = pluginService; @@ -48,6 +51,7 @@ namespace Artemis.Core.Services _pluginService.PluginEnabled += (sender, args) => _modules = _pluginService.GetPluginsOfType(); _pluginService.PluginDisabled += (sender, args) => _modules = _pluginService.GetPluginsOfType(); + ConfigureJsonConvert(); } @@ -99,7 +103,7 @@ namespace Artemis.Core.Services _logger.Information("Initialized without an active surface entity"); _profileService.ActivateDefaultProfiles(); - + OnInitialized(); } diff --git a/src/Artemis.Core/Services/Storage/ProfileService.cs b/src/Artemis.Core/Services/Storage/ProfileService.cs index cb258039c..a415ba49c 100644 --- a/src/Artemis.Core/Services/Storage/ProfileService.cs +++ b/src/Artemis.Core/Services/Storage/ProfileService.cs @@ -100,11 +100,13 @@ namespace Artemis.Core.Services.Storage public void DeleteProfile(Profile profile) { + _logger.Debug("Removing profile " + profile); _profileRepository.Remove(profile.ProfileEntity); } public void UpdateProfile(Profile profile, bool includeChildren) { + _logger.Debug("Updating profile " + profile); var memento = JsonConvert.SerializeObject(profile.ProfileEntity); profile.RedoStack.Clear(); profile.UndoStack.Push(memento); diff --git a/src/Artemis.Storage/Artemis.Storage.csproj b/src/Artemis.Storage/Artemis.Storage.csproj index 5efccadd8..0ae5807f4 100644 --- a/src/Artemis.Storage/Artemis.Storage.csproj +++ b/src/Artemis.Storage/Artemis.Storage.csproj @@ -5,6 +5,7 @@ 7 - + + \ No newline at end of file diff --git a/src/Artemis.Storage/Entities/Profile/LayerEntity.cs b/src/Artemis.Storage/Entities/Profile/LayerEntity.cs index 614e575c3..0792079ca 100644 --- a/src/Artemis.Storage/Entities/Profile/LayerEntity.cs +++ b/src/Artemis.Storage/Entities/Profile/LayerEntity.cs @@ -11,6 +11,7 @@ namespace Artemis.Storage.Entities.Profile Leds = new List(); PropertyEntities = new List(); Condition = new List(); + ExpandedPropertyGroups = new List(); } public Guid Id { get; set; } @@ -22,6 +23,7 @@ namespace Artemis.Storage.Entities.Profile public List Leds { get; set; } public List PropertyEntities { get; set; } public List Condition { get; set; } + public List ExpandedPropertyGroups { get; set; } [BsonRef("ProfileEntity")] public ProfileEntity Profile { get; set; } diff --git a/src/Artemis.Storage/Migrations/AttributeBasedPropertiesMigration.cs b/src/Artemis.Storage/Migrations/AttributeBasedPropertiesMigration.cs new file mode 100644 index 000000000..6fa31eb10 --- /dev/null +++ b/src/Artemis.Storage/Migrations/AttributeBasedPropertiesMigration.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Text; +using Artemis.Storage.Entities.Profile; +using Artemis.Storage.Migrations.Interfaces; +using LiteDB; + +namespace Artemis.Storage.Migrations +{ + public class AttributeBasedPropertiesMigration : IStorageMigration + { + public int UserVersion => 1; + public void Apply(LiteRepository repository) + { + if (repository.Database.CollectionExists("ProfileEntity")) + repository.Database.DropCollection("ProfileEntity"); + } + } +} diff --git a/src/Artemis.Storage/Migrations/Interfaces/IStorageMigration.cs b/src/Artemis.Storage/Migrations/Interfaces/IStorageMigration.cs new file mode 100644 index 000000000..a72a3c92b --- /dev/null +++ b/src/Artemis.Storage/Migrations/Interfaces/IStorageMigration.cs @@ -0,0 +1,10 @@ +using LiteDB; + +namespace Artemis.Storage.Migrations.Interfaces +{ + public interface IStorageMigration + { + int UserVersion { get; } + void Apply(LiteRepository repository); + } +} \ No newline at end of file diff --git a/src/Artemis.Storage/StorageMigrationService.cs b/src/Artemis.Storage/StorageMigrationService.cs new file mode 100644 index 000000000..35d642e09 --- /dev/null +++ b/src/Artemis.Storage/StorageMigrationService.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Linq; +using Artemis.Storage.Migrations.Interfaces; +using LiteDB; +using Serilog; + +namespace Artemis.Storage +{ + public class StorageMigrationService + { + private readonly ILogger _logger; + private readonly LiteRepository _repository; + private readonly List _migrations; + + public StorageMigrationService(ILogger logger, LiteRepository repository, List migrations) + { + _logger = logger; + _repository = repository; + _migrations = migrations; + + ApplyPendingMigrations(); + } + + public void ApplyPendingMigrations() + { + foreach (var storageMigration in _migrations.OrderBy(m => m.UserVersion)) + { + if (_repository.Database.UserVersion >= storageMigration.UserVersion) + continue; + + _logger.Information("Applying storage migration {storageMigration} to update DB from v{oldVersion} to v{newVersion}", + storageMigration.GetType().Name, _repository.Database.UserVersion, storageMigration.UserVersion); + storageMigration.Apply(_repository); + _repository.Database.UserVersion = storageMigration.UserVersion; + } + } + } +} \ No newline at end of file diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index f25f3f433..4714f8226 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -20,15 +20,15 @@ - - - + + + - - - + + + diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj index 95bf6f818..dd8684199 100644 --- a/src/Artemis.UI/Artemis.UI.csproj +++ b/src/Artemis.UI/Artemis.UI.csproj @@ -115,21 +115,21 @@ - + - - - + + + - - + + diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Abstract/LayerPropertyBaseViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Abstract/LayerPropertyBaseViewModel.cs index 3a4364209..b5d81d425 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Abstract/LayerPropertyBaseViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Abstract/LayerPropertyBaseViewModel.cs @@ -12,7 +12,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Abstract Children = new List(); } - public bool IsExpanded { get; set; } + public virtual bool IsExpanded { get; set; } public abstract bool IsVisible { get; } public List Children { get; set; } diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml index f82d7124f..5a952bbfc 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesView.xaml @@ -160,7 +160,7 @@ @@ -198,13 +198,12 @@ Background="{DynamicResource MaterialDesignCardBackground}"> - diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs index ae7320010..746746904 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertiesViewModel.cs @@ -54,6 +54,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties ProfileEditorService.ProfileElementSelected += ProfileEditorServiceOnProfileElementSelected; ProfileEditorService.CurrentTimeChanged += ProfileEditorServiceOnCurrentTimeChanged; + ProfileEditorService.PixelsPerSecondChanged += ProfileEditorServiceOnPixelsPerSecondChanged; base.OnInitialActivate(); } @@ -62,6 +63,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties { ProfileEditorService.ProfileElementSelected -= ProfileEditorServiceOnProfileElementSelected; ProfileEditorService.CurrentTimeChanged -= ProfileEditorServiceOnCurrentTimeChanged; + ProfileEditorService.PixelsPerSecondChanged -= ProfileEditorServiceOnPixelsPerSecondChanged; base.OnClose(); } @@ -83,6 +85,11 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties NotifyOfPropertyChange(() => TimeCaretPosition); } + private void ProfileEditorServiceOnPixelsPerSecondChanged(object? sender, EventArgs e) + { + NotifyOfPropertyChange(nameof(TimeCaretPosition)); + } + #region View model managament private void PopulateProperties(ProfileElement profileElement) diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertyGroupViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertyGroupViewModel.cs index 8481ba003..e87e2409a 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertyGroupViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/LayerPropertyGroupViewModel.cs @@ -18,7 +18,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties LayerPropertyGroup = layerPropertyGroup; PropertyGroupDescription = propertyGroupDescription; - IsExpanded = PropertyGroupDescription.ExpandByDefault; TreePropertyGroupViewModel = new TreePropertyGroupViewModel(this); TimelinePropertyGroupViewModel = new TimelinePropertyGroupViewModel(this); @@ -26,6 +25,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties PopulateChildren(); } + public override bool IsExpanded + { + get => LayerPropertyGroup.Layer.IsPropertyGroupExpanded(LayerPropertyGroup); + set => LayerPropertyGroup.Layer.SetPropertyGroupExpanded(LayerPropertyGroup, value); + } + public override bool IsVisible => !LayerPropertyGroup.IsHidden; public IProfileEditorService ProfileEditorService { get; } diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/TimelinePropertyViewModel.cs b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/TimelinePropertyViewModel.cs index cf2ffb3eb..fe0e3abff 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/TimelinePropertyViewModel.cs +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Timeline/TimelinePropertyViewModel.cs @@ -19,6 +19,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline LayerPropertyViewModel.LayerProperty.KeyframeAdded += LayerPropertyOnKeyframeModified; LayerPropertyViewModel.LayerProperty.KeyframeRemoved += LayerPropertyOnKeyframeModified; LayerPropertyViewModel.LayerProperty.KeyframesToggled += LayerPropertyOnKeyframeModified; + _profileEditorService.PixelsPerSecondChanged += ProfileEditorServiceOnPixelsPerSecondChanged; } private void LayerPropertyOnKeyframeModified(object sender, EventArgs e) @@ -26,6 +27,12 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline UpdateKeyframes(); } + private void ProfileEditorServiceOnPixelsPerSecondChanged(object? sender, EventArgs e) + { + foreach (var timelineKeyframeViewModel in TimelineKeyframeViewModels) + timelineKeyframeViewModel.Update(_profileEditorService.PixelsPerSecond); + } + public LayerPropertyViewModel LayerPropertyViewModel { get; } public override void UpdateKeyframes() @@ -55,6 +62,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline public override void Dispose() { + _profileEditorService.PixelsPerSecondChanged -= ProfileEditorServiceOnPixelsPerSecondChanged; LayerPropertyViewModel.LayerProperty.KeyframeAdded -= LayerPropertyOnKeyframeModified; LayerPropertyViewModel.LayerProperty.KeyframeRemoved -= LayerPropertyOnKeyframeModified; LayerPropertyViewModel.LayerProperty.KeyframesToggled -= LayerPropertyOnKeyframeModified; diff --git a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Tree/TreeView.xaml b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Tree/TreeView.xaml index 301ea5ef7..73bc66f98 100644 --- a/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Tree/TreeView.xaml +++ b/src/Artemis.UI/Screens/Module/ProfileEditor/LayerProperties/Tree/TreeView.xaml @@ -82,6 +82,8 @@ - + - + - + - + diff --git a/src/Artemis.UI/Services/ProfileEditorService.cs b/src/Artemis.UI/Services/ProfileEditorService.cs index 392ba57e4..a2a226976 100644 --- a/src/Artemis.UI/Services/ProfileEditorService.cs +++ b/src/Artemis.UI/Services/ProfileEditorService.cs @@ -77,8 +77,7 @@ namespace Artemis.UI.Services OnPixelsPerSecondChanged(); } } - - + public LayerPropertyBaseViewModel CreateLayerPropertyViewModel(BaseLayerProperty baseLayerProperty, PropertyDescriptionAttribute propertyDescription) { // Go through the pain of instantiating a generic type VM now via reflection to make things a lot simpler down the line diff --git a/src/Plugins/Artemis.Plugins.Devices.Asus/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.Asus/Properties/AssemblyInfo.cs index 387240943..8ce0de86d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.Asus/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.Asus/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] +[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs b/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs index 4b4c30871..46c4f0779 100644 --- a/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs +++ b/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/CoolerMasterDeviceProvider.cs @@ -1,5 +1,4 @@ -using System; -using System.IO; +using System.IO; using Artemis.Core.Plugins.Abstract; using Artemis.Core.Plugins.Models; using Artemis.Core.Services.Interfaces; diff --git a/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/Properties/AssemblyInfo.cs index 387240943..8ce0de86d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.CoolerMaster/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] +[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.Corsair/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.Corsair/Properties/AssemblyInfo.cs index 5923714b1..6a782c8a2 100644 --- a/src/Plugins/Artemis.Plugins.Devices.Corsair/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.Corsair/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("a779b2f8-c253-4c4b-8634-6eb8f594e96d")] +[assembly: Guid("a779b2f8-c253-4c4b-8634-6eb8f594e96d")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.DMX/Artemis.Plugins.Devices.DMX.csproj b/src/Plugins/Artemis.Plugins.Devices.DMX/Artemis.Plugins.Devices.DMX.csproj index a8943908b..5e719d5ef 100644 --- a/src/Plugins/Artemis.Plugins.Devices.DMX/Artemis.Plugins.Devices.DMX.csproj +++ b/src/Plugins/Artemis.Plugins.Devices.DMX/Artemis.Plugins.Devices.DMX.csproj @@ -24,7 +24,7 @@ - + diff --git a/src/Plugins/Artemis.Plugins.Devices.DMX/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.DMX/Properties/AssemblyInfo.cs index 387240943..8ce0de86d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.DMX/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.DMX/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] +[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.DMX/ViewModels/DMXConfigurationViewModel.cs b/src/Plugins/Artemis.Plugins.Devices.DMX/ViewModels/DMXConfigurationViewModel.cs index e11e7ec62..010933d59 100644 --- a/src/Plugins/Artemis.Plugins.Devices.DMX/ViewModels/DMXConfigurationViewModel.cs +++ b/src/Plugins/Artemis.Plugins.Devices.DMX/ViewModels/DMXConfigurationViewModel.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Artemis.Core.Plugins.Abstract; +using Artemis.Core.Plugins.Abstract; using Artemis.Core.Plugins.Abstract.ViewModels; namespace Artemis.Plugins.Devices.DMX.ViewModels @@ -11,7 +8,6 @@ namespace Artemis.Plugins.Devices.DMX.ViewModels public DMXConfigurationViewModel(Plugin plugin) : base(plugin) { var dmxInstance = RGB.NET.Devices.DMX.DMXDeviceProvider.Instance; - } } -} +} \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.Logitech/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.Logitech/Properties/AssemblyInfo.cs index 59bea6ed1..18cb6793a 100644 --- a/src/Plugins/Artemis.Plugins.Devices.Logitech/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.Logitech/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("235a45c7-24ad-4f47-b9d4-cd67e610a04d")] +[assembly: Guid("235a45c7-24ad-4f47-b9d4-cd67e610a04d")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.Msi/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.Msi/Properties/AssemblyInfo.cs index 387240943..8ce0de86d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.Msi/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.Msi/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] +[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.Novation/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.Novation/Properties/AssemblyInfo.cs index 387240943..8ce0de86d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.Novation/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.Novation/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] +[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.Razer/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.Razer/Properties/AssemblyInfo.cs index 387240943..8ce0de86d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.Razer/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.Razer/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] +[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.Roccat/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.Roccat/Properties/AssemblyInfo.cs index 387240943..8ce0de86d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.Roccat/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.Roccat/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] +[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.Roccat/RoccatDeviceProvider.cs b/src/Plugins/Artemis.Plugins.Devices.Roccat/RoccatDeviceProvider.cs index 68449dad9..c2f24c09f 100644 --- a/src/Plugins/Artemis.Plugins.Devices.Roccat/RoccatDeviceProvider.cs +++ b/src/Plugins/Artemis.Plugins.Devices.Roccat/RoccatDeviceProvider.cs @@ -2,8 +2,6 @@ using Artemis.Core.Plugins.Abstract; using Artemis.Core.Plugins.Models; using Artemis.Core.Services.Interfaces; -using RGB.NET.Core; -using RGB.NET.Devices.Roccat; namespace Artemis.Plugins.Devices.Roccat { diff --git a/src/Plugins/Artemis.Plugins.Devices.SteelSeries/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.SteelSeries/Properties/AssemblyInfo.cs index 387240943..8ce0de86d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.SteelSeries/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.SteelSeries/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] +[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.SteelSeries/SteelSeriesDeviceProvider.cs b/src/Plugins/Artemis.Plugins.Devices.SteelSeries/SteelSeriesDeviceProvider.cs index f406829a7..3e63cf3ee 100644 --- a/src/Plugins/Artemis.Plugins.Devices.SteelSeries/SteelSeriesDeviceProvider.cs +++ b/src/Plugins/Artemis.Plugins.Devices.SteelSeries/SteelSeriesDeviceProvider.cs @@ -1,5 +1,4 @@ -using System.IO; -using Artemis.Core.Plugins.Abstract; +using Artemis.Core.Plugins.Abstract; using Artemis.Core.Plugins.Models; using Artemis.Core.Services.Interfaces; using RGB.NET.Core; diff --git a/src/Plugins/Artemis.Plugins.Devices.WS281X/Artemis.Plugins.Devices.WS281X.csproj b/src/Plugins/Artemis.Plugins.Devices.WS281X/Artemis.Plugins.Devices.WS281X.csproj index c8d3b4d15..32ebb090d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.WS281X/Artemis.Plugins.Devices.WS281X.csproj +++ b/src/Plugins/Artemis.Plugins.Devices.WS281X/Artemis.Plugins.Devices.WS281X.csproj @@ -24,7 +24,7 @@ - + diff --git a/src/Plugins/Artemis.Plugins.Devices.WS281X/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.WS281X/Properties/AssemblyInfo.cs index 387240943..8ce0de86d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.WS281X/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.WS281X/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] +[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Devices.WS281X/WS281XDeviceProvider.cs b/src/Plugins/Artemis.Plugins.Devices.WS281X/WS281XDeviceProvider.cs index 02a69750f..45111b8f3 100644 --- a/src/Plugins/Artemis.Plugins.Devices.WS281X/WS281XDeviceProvider.cs +++ b/src/Plugins/Artemis.Plugins.Devices.WS281X/WS281XDeviceProvider.cs @@ -14,7 +14,6 @@ namespace Artemis.Plugins.Devices.WS281X // ReSharper disable once UnusedMember.Global public class WS281XDeviceProvider : DeviceProvider { - public PluginSettings Settings { get; } private readonly IRgbService _rgbService; public WS281XDeviceProvider(PluginInfo pluginInfo, IRgbService rgbService, PluginSettings settings) : base(pluginInfo, RGB.NET.Devices.WS281X.WS281XDeviceProvider.Instance) @@ -24,6 +23,8 @@ namespace Artemis.Plugins.Devices.WS281X HasConfigurationViewModel = true; } + public PluginSettings Settings { get; } + public override void EnablePlugin() { var definitions = Settings.GetSetting>("DeviceDefinitions"); diff --git a/src/Plugins/Artemis.Plugins.Devices.Wooting/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Devices.Wooting/Properties/AssemblyInfo.cs index 387240943..8ce0de86d 100644 --- a/src/Plugins/Artemis.Plugins.Devices.Wooting/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Devices.Wooting/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] +[assembly: Guid("c6bdb6d9-062d-4c28-a280-f3bd6197f07f")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/Artemis.Plugins.LayerBrushes.Color.csproj b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/Artemis.Plugins.LayerBrushes.Color.csproj index 896e3dd0c..69f924a12 100644 --- a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/Artemis.Plugins.LayerBrushes.Color.csproj +++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/Artemis.Plugins.LayerBrushes.Color.csproj @@ -23,7 +23,7 @@ - + diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProperties.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProperties.cs index 0dca4b77e..435000945 100644 --- a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProperties.cs +++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/ColorBrushProperties.cs @@ -19,19 +19,15 @@ namespace Artemis.Plugins.LayerBrushes.Color [PropertyDescription(Description = "The gradient of the brush")] public ColorGradientLayerProperty Gradient { get; set; } + protected override void PopulateDefaults() + { + GradientType.DefaultValue = LayerBrushes.Color.GradientType.Solid; + Color.DefaultValue = new SKColor(255, 0, 0); + Gradient.DefaultValue = ColorGradient.GetUnicornBarf(); + } + protected override void OnPropertiesInitialized() { - // Populate defaults - if (!GradientType.IsLoadedFromStorage) - GradientType.BaseValue = LayerBrushes.Color.GradientType.Solid; - if (!Color.IsLoadedFromStorage) - Color.BaseValue = new SKColor(255, 0, 0); - if (!Gradient.IsLoadedFromStorage) - { - Gradient.BaseValue = new ColorGradient(); - Gradient.BaseValue.MakeFabulous(); - } - GradientType.BaseValueChanged += GradientTypeOnBaseValueChanged; } diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/Properties/AssemblyInfo.cs index a3ad5f4f3..87d3be987 100644 --- a/src/Plugins/Artemis.Plugins.LayerBrushes.Color/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Color/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("0f288a66-6eb0-4589-8595-e33a3a3eaea2")] +[assembly: Guid("0f288a66-6eb0-4589-8595-e33a3a3eaea2")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/Artemis.Plugins.LayerBrushes.Noise.csproj b/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/Artemis.Plugins.LayerBrushes.Noise.csproj index 1e44dc52b..32073afb0 100644 --- a/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/Artemis.Plugins.LayerBrushes.Noise.csproj +++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/Artemis.Plugins.LayerBrushes.Noise.csproj @@ -23,8 +23,8 @@ - - + + diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProperties.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProperties.cs index d01cfa509..f2fda9f33 100644 --- a/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProperties.cs +++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/NoiseBrushProperties.cs @@ -34,26 +34,18 @@ namespace Artemis.Plugins.LayerBrushes.Noise [PropertyDescription(Description = "The speed at which the noise moves", MinInputValue = 0f, MaxInputValue = 64f)] public FloatLayerProperty AnimationSpeed { get; set; } + protected override void PopulateDefaults() + { + MainColor.DefaultValue = new SKColor(255, 0, 0); + SecondaryColor.DefaultValue = new SKColor(0, 0, 255); + GradientColor.DefaultValue = ColorGradient.GetUnicornBarf(); + Scale.DefaultValue = new SKSize(100, 100); + Hardness.DefaultValue = 500f; + AnimationSpeed.DefaultValue = 25f; + } + protected override void OnPropertiesInitialized() { - // Populate defaults - if (!MainColor.IsLoadedFromStorage) - MainColor.BaseValue = new SKColor(255, 0, 0); - if (!SecondaryColor.IsLoadedFromStorage) - SecondaryColor.BaseValue = new SKColor(0, 0, 255); - if (!GradientColor.IsLoadedFromStorage) - { - GradientColor.BaseValue = new ColorGradient(); - GradientColor.BaseValue.MakeFabulous(); - } - - if (!Scale.IsLoadedFromStorage) - Scale.BaseValue = new SKSize(100, 100); - if (!Hardness.IsLoadedFromStorage) - Hardness.BaseValue = 500f; - if (!AnimationSpeed.IsLoadedFromStorage) - AnimationSpeed.BaseValue = 25f; - ColorType.BaseValueChanged += ColorTypeOnBaseValueChanged; } diff --git a/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/Properties/AssemblyInfo.cs index c730cc822..dfc61567c 100644 --- a/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.LayerBrushes.Noise/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("7f4c7ab0-4c9b-452d-afed-34544c903def")] +[assembly: Guid("7f4c7ab0-4c9b-452d-afed-34544c903def")] \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Modules.General/Artemis.Plugins.Modules.General.csproj b/src/Plugins/Artemis.Plugins.Modules.General/Artemis.Plugins.Modules.General.csproj index 3a0227d9f..6336fe8ac 100644 --- a/src/Plugins/Artemis.Plugins.Modules.General/Artemis.Plugins.Modules.General.csproj +++ b/src/Plugins/Artemis.Plugins.Modules.General/Artemis.Plugins.Modules.General.csproj @@ -23,8 +23,8 @@ - - + + diff --git a/src/Plugins/Artemis.Plugins.Modules.General/GeneralDataModel.cs b/src/Plugins/Artemis.Plugins.Modules.General/GeneralDataModel.cs index a9d4ee2f4..1ce42c686 100644 --- a/src/Plugins/Artemis.Plugins.Modules.General/GeneralDataModel.cs +++ b/src/Plugins/Artemis.Plugins.Modules.General/GeneralDataModel.cs @@ -1,7 +1,6 @@ using Artemis.Core.Plugins.Abstract; using Artemis.Core.Plugins.Abstract.DataModels; using Artemis.Core.Plugins.Abstract.DataModels.Attributes; -using SkiaSharp; namespace Artemis.Plugins.Modules.General { @@ -24,14 +23,14 @@ namespace Artemis.Plugins.Modules.General public class PlayerInfo : DataModel { + public PlayerInfo(Module module) : base(module) + { + } + [DataModelProperty(Name = "A test string", Description = "This is a test string that's not of any use outside testing!")] public string TestString { get; set; } [DataModelProperty(Name = "A test boolean", Description = "This is a test boolean that's not of any use outside testing!")] public bool TestBoolean { get; set; } - - public PlayerInfo(Module module) : base(module) - { - } } } \ No newline at end of file diff --git a/src/Plugins/Artemis.Plugins.Modules.General/GeneralModule.cs b/src/Plugins/Artemis.Plugins.Modules.General/GeneralModule.cs index 4c9871d64..d3e52b7dc 100644 --- a/src/Plugins/Artemis.Plugins.Modules.General/GeneralModule.cs +++ b/src/Plugins/Artemis.Plugins.Modules.General/GeneralModule.cs @@ -21,7 +21,7 @@ namespace Artemis.Plugins.Modules.General var testSetting = _settings.GetSetting("TestSetting", DateTime.Now); } - + public override void EnablePlugin() { } diff --git a/src/Plugins/Artemis.Plugins.Modules.General/Properties/AssemblyInfo.cs b/src/Plugins/Artemis.Plugins.Modules.General/Properties/AssemblyInfo.cs index f9899c264..c434b9283 100644 --- a/src/Plugins/Artemis.Plugins.Modules.General/Properties/AssemblyInfo.cs +++ b/src/Plugins/Artemis.Plugins.Modules.General/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ -using System.Reflection; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from @@ -7,4 +6,4 @@ using System.Runtime.InteropServices; [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("e592f239-faa0-4840-9c85-46e5867d06d5")] +[assembly: Guid("e592f239-faa0-4840-9c85-46e5867d06d5")] \ No newline at end of file