diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj
index ecfb0f91c..be5d7746a 100644
--- a/src/Artemis.Core/Artemis.Core.csproj
+++ b/src/Artemis.Core/Artemis.Core.csproj
@@ -73,20 +73,20 @@
..\packages\Ninject.Extensions.Factory.3.3.2\lib\net45\Ninject.Extensions.Factory.dll
-
- ..\packages\RGB.NET.Brushes.0.1.22\lib\net45\RGB.NET.Brushes.dll
+
+ ..\packages\RGB.NET.Brushes.0.1.25\lib\net45\RGB.NET.Brushes.dll
-
- ..\packages\RGB.NET.Core.0.1.22\lib\net45\RGB.NET.Core.dll
+
+ ..\packages\RGB.NET.Core.0.1.25\lib\net45\RGB.NET.Core.dll
-
- ..\packages\RGB.NET.Decorators.0.1.22\lib\net45\RGB.NET.Decorators.dll
+
+ ..\packages\RGB.NET.Decorators.0.1.25\lib\net45\RGB.NET.Decorators.dll
-
- ..\packages\RGB.NET.Devices.Corsair.0.1.22\lib\net45\RGB.NET.Devices.Corsair.dll
+
+ ..\packages\RGB.NET.Devices.Corsair.0.1.25\lib\net45\RGB.NET.Devices.Corsair.dll
-
- ..\packages\RGB.NET.Groups.0.1.22\lib\net45\RGB.NET.Groups.dll
+
+ ..\packages\RGB.NET.Groups.0.1.25\lib\net45\RGB.NET.Groups.dll
..\packages\Stylet.1.1.22\lib\net45\Stylet.dll
@@ -99,6 +99,9 @@
+
+ ..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll
+
diff --git a/src/Artemis.Core/Ninject/PluginSettingsProvider.cs b/src/Artemis.Core/Ninject/PluginSettingsProvider.cs
index ae0b15282..7de90072a 100644
--- a/src/Artemis.Core/Ninject/PluginSettingsProvider.cs
+++ b/src/Artemis.Core/Ninject/PluginSettingsProvider.cs
@@ -1,27 +1,31 @@
using System.Linq;
using Artemis.Core.Exceptions;
+using Artemis.Core.Plugins.Abstract;
using Artemis.Core.Plugins.Models;
using Artemis.Storage.Repositories;
using Ninject.Activation;
namespace Artemis.Core.Ninject
{
- public class PluginSettingsProvider : Provider
+ internal class PluginSettingsProvider : Provider
{
- private readonly ISettingRepository _settingRepository;
+ private readonly IPluginSettingRepository _pluginSettingRepository;
- public PluginSettingsProvider(ISettingRepository settingRepository)
+ internal PluginSettingsProvider(IPluginSettingRepository pluginSettingRepository)
{
- _settingRepository = settingRepository;
+ _pluginSettingRepository = pluginSettingRepository;
}
protected override PluginSettings CreateInstance(IContext context)
{
- var pluginInfo = context.Request.ParentRequest?.Parameters.FirstOrDefault(p => p.Name == "PluginInfo")?.GetValue(context, null) as PluginInfo;
+ var parentRequest = context.Request.ParentRequest;
+ if (parentRequest == null || !typeof(Plugin).IsAssignableFrom(parentRequest.Service))
+ throw new ArtemisCoreException("PluginSettings can only be injected into a plugin");
+ var pluginInfo = parentRequest.Parameters.FirstOrDefault(p => p.Name == "PluginInfo")?.GetValue(context, null) as PluginInfo;
if (pluginInfo == null)
throw new ArtemisCoreException("A plugin needs to be initialized with PluginInfo as a parameter");
- return new PluginSettings(pluginInfo, _settingRepository);
+ return new PluginSettings(pluginInfo, _pluginSettingRepository);
}
}
}
\ No newline at end of file
diff --git a/src/Artemis.Core/Plugins/Models/PluginSetting.cs b/src/Artemis.Core/Plugins/Models/PluginSetting.cs
index 1a0c7fb71..ed27ce3c7 100644
--- a/src/Artemis.Core/Plugins/Models/PluginSetting.cs
+++ b/src/Artemis.Core/Plugins/Models/PluginSetting.cs
@@ -8,17 +8,17 @@ namespace Artemis.Core.Plugins.Models
public class PluginSetting
{
private readonly PluginInfo _pluginInfo;
- private readonly SettingEntity _settingEntity;
- private readonly ISettingRepository _settingRepository;
+ private readonly PluginSettingEntity _pluginSettingEntity;
+ private readonly IPluginSettingRepository _pluginSettingRepository;
- internal PluginSetting(PluginInfo pluginInfo, ISettingRepository settingRepository, SettingEntity settingEntity)
+ internal PluginSetting(PluginInfo pluginInfo, IPluginSettingRepository pluginSettingRepository, PluginSettingEntity pluginSettingEntity)
{
_pluginInfo = pluginInfo;
- _settingRepository = settingRepository;
- _settingEntity = settingEntity;
+ _pluginSettingRepository = pluginSettingRepository;
+ _pluginSettingEntity = pluginSettingEntity;
- Name = settingEntity.Name;
- Value = JsonConvert.DeserializeObject(settingEntity.Value);
+ Name = pluginSettingEntity.Name;
+ Value = JsonConvert.DeserializeObject(pluginSettingEntity.Value);
}
///
@@ -34,14 +34,14 @@ namespace Artemis.Core.Plugins.Models
///
/// Determines whether the setting has been changed
///
- public bool HasChanged => JsonConvert.SerializeObject(Value) != _settingEntity.Value;
+ public bool HasChanged => JsonConvert.SerializeObject(Value) != _pluginSettingEntity.Value;
///
/// Resets the setting to the last saved value
///
public void RejectChanges()
{
- Value = JsonConvert.DeserializeObject(_settingEntity.Value);
+ Value = JsonConvert.DeserializeObject(_pluginSettingEntity.Value);
}
///
@@ -49,8 +49,8 @@ namespace Artemis.Core.Plugins.Models
///
public void Save()
{
- _settingEntity.Value = JsonConvert.SerializeObject(Value);
- _settingRepository.Save();
+ _pluginSettingEntity.Value = JsonConvert.SerializeObject(Value);
+ _pluginSettingRepository.Save();
}
///
@@ -59,8 +59,8 @@ namespace Artemis.Core.Plugins.Models
///
public async Task SaveAsync()
{
- _settingEntity.Value = JsonConvert.SerializeObject(Value);
- await _settingRepository.SaveAsync();
+ _pluginSettingEntity.Value = JsonConvert.SerializeObject(Value);
+ await _pluginSettingRepository.SaveAsync();
}
}
}
\ No newline at end of file
diff --git a/src/Artemis.Core/Plugins/Models/PluginSettings.cs b/src/Artemis.Core/Plugins/Models/PluginSettings.cs
index 20580d25c..a5220849b 100644
--- a/src/Artemis.Core/Plugins/Models/PluginSettings.cs
+++ b/src/Artemis.Core/Plugins/Models/PluginSettings.cs
@@ -9,27 +9,27 @@ namespace Artemis.Core.Plugins.Models
public class PluginSettings
{
private readonly PluginInfo _pluginInfo;
- private readonly ISettingRepository _settingRepository;
- private readonly Dictionary _settingEntities;
+ private readonly IPluginSettingRepository _pluginSettingRepository;
+ private readonly Dictionary _settingEntities;
- public PluginSettings(PluginInfo pluginInfo, ISettingRepository settingRepository)
+ internal PluginSettings(PluginInfo pluginInfo, IPluginSettingRepository pluginSettingRepository)
{
_pluginInfo = pluginInfo;
- _settingRepository = settingRepository;
- _settingEntities = settingRepository.GetByPluginGuid(_pluginInfo.Guid).ToDictionary(se => se.Name);
+ _pluginSettingRepository = pluginSettingRepository;
+ _settingEntities = pluginSettingRepository.GetByPluginGuid(_pluginInfo.Guid).ToDictionary(se => se.Name);
}
public PluginSetting GetSetting(string name, T defaultValue = default(T))
{
if (_settingEntities.ContainsKey(name))
- return new PluginSetting(_pluginInfo, _settingRepository, _settingEntities[name]);
-
- var settingEntity = new SettingEntity {Name = name, PluginGuid = _pluginInfo.Guid, Value = JsonConvert.SerializeObject(defaultValue)};
- _settingRepository.Add(settingEntity);
- _settingRepository.Save();
+ return new PluginSetting(_pluginInfo, _pluginSettingRepository, _settingEntities[name]);
+ var settingEntity = new PluginSettingEntity {Name = name, PluginGuid = _pluginInfo.Guid, Value = JsonConvert.SerializeObject(defaultValue)};
+ _pluginSettingRepository.Add(settingEntity);
+ _pluginSettingRepository.Save();
+
_settingEntities.Add(name, settingEntity);
- return GetSetting(name, defaultValue);
+ return new PluginSetting(_pluginInfo, _pluginSettingRepository, _settingEntities[name]);
}
}
}
\ No newline at end of file
diff --git a/src/Artemis.Core/Services/CoreService.cs b/src/Artemis.Core/Services/CoreService.cs
index 0cfa55bfb..db0a1be6a 100644
--- a/src/Artemis.Core/Services/CoreService.cs
+++ b/src/Artemis.Core/Services/CoreService.cs
@@ -8,6 +8,9 @@ using Color = System.Drawing.Color;
namespace Artemis.Core.Services
{
+ ///
+ /// Provides Artemis's core update loop
+ ///
public class CoreService : ICoreService
{
private readonly IPluginService _pluginService;
@@ -19,7 +22,6 @@ namespace Artemis.Core.Services
_rgbService = rgbService;
_rgbService.Surface.Updating += SurfaceOnUpdating;
-
Task.Run(Initialize);
}
diff --git a/src/Artemis.Core/Services/MainDataModelService.cs b/src/Artemis.Core/Services/MainDataModelService.cs
index 5ee12411c..52ca5e9f5 100644
--- a/src/Artemis.Core/Services/MainDataModelService.cs
+++ b/src/Artemis.Core/Services/MainDataModelService.cs
@@ -3,11 +3,13 @@ using System.Collections.ObjectModel;
using Artemis.Core.Exceptions;
using Artemis.Core.Models;
using Artemis.Core.Plugins.Abstract;
-using Artemis.Core.Plugins.Interfaces;
using Artemis.Core.Services.Interfaces;
namespace Artemis.Core.Services
{
+ ///
+ /// Provides access to the main data model
+ ///
public class MainDataModelService : IMainDataModelService
{
private readonly List _dataModelExpansions;
diff --git a/src/Artemis.Core/Services/PluginService.cs b/src/Artemis.Core/Services/PluginService.cs
index 36926545b..c7e8c15bb 100644
--- a/src/Artemis.Core/Services/PluginService.cs
+++ b/src/Artemis.Core/Services/PluginService.cs
@@ -16,6 +16,9 @@ using Ninject.Parameters;
namespace Artemis.Core.Services
{
+ ///
+ /// Provides access to plugin loading and unloading
+ ///
public class PluginService : IPluginService
{
private readonly IKernel _kernel;
diff --git a/src/Artemis.Core/Services/RgbService.cs b/src/Artemis.Core/Services/RgbService.cs
index d7fb13246..ca4fe8a03 100644
--- a/src/Artemis.Core/Services/RgbService.cs
+++ b/src/Artemis.Core/Services/RgbService.cs
@@ -11,6 +11,9 @@ using RGB.NET.Groups;
namespace Artemis.Core.Services
{
+ ///
+ /// Provides wrapped access the RGB.NET
+ ///
public class RgbService : IRgbService, IDisposable
{
private readonly List _loadedDevices;
diff --git a/src/Artemis.Core/Services/StorageService.cs b/src/Artemis.Core/Services/StorageService.cs
index 3d5d4c3ea..2a7293270 100644
--- a/src/Artemis.Core/Services/StorageService.cs
+++ b/src/Artemis.Core/Services/StorageService.cs
@@ -7,6 +7,9 @@ using Artemis.Storage.Repositories;
namespace Artemis.Core.Services
{
+ ///
+ /// Provides access to profile storage
+ ///
public class StorageService : IStorageService
{
private readonly IPluginService _pluginService;
diff --git a/src/Artemis.Core/packages.config b/src/Artemis.Core/packages.config
index 575498e27..4c44ad240 100644
--- a/src/Artemis.Core/packages.config
+++ b/src/Artemis.Core/packages.config
@@ -7,11 +7,12 @@
-
-
-
-
-
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.Plugins.LayerTypes.Brush/Artemis.Plugins.LayerTypes.Brush.csproj b/src/Artemis.Plugins.LayerTypes.Brush/Artemis.Plugins.LayerTypes.Brush.csproj
index 6972efc78..c75ff6124 100644
--- a/src/Artemis.Plugins.LayerTypes.Brush/Artemis.Plugins.LayerTypes.Brush.csproj
+++ b/src/Artemis.Plugins.LayerTypes.Brush/Artemis.Plugins.LayerTypes.Brush.csproj
@@ -38,9 +38,8 @@
..\packages\QRCoder.1.2.5\lib\net40\QRCoder.dll
-
- ..\packages\RGB.NET.Core.0.1.22\lib\net45\RGB.NET.Core.dll
- False
+
+ ..\packages\RGB.NET.Core.0.1.25\lib\net45\RGB.NET.Core.dll
..\packages\Stylet.1.1.22\lib\net45\Stylet.dll
diff --git a/src/Artemis.Plugins.LayerTypes.Brush/packages.config b/src/Artemis.Plugins.LayerTypes.Brush/packages.config
index 3fbd5a7c0..9bae427f8 100644
--- a/src/Artemis.Plugins.LayerTypes.Brush/packages.config
+++ b/src/Artemis.Plugins.LayerTypes.Brush/packages.config
@@ -1,7 +1,7 @@
-
+
\ No newline at end of file
diff --git a/src/Artemis.Plugins.Modules.General/Artemis.Plugins.Modules.General.csproj b/src/Artemis.Plugins.Modules.General/Artemis.Plugins.Modules.General.csproj
index b1e9c083b..df3fb150e 100644
--- a/src/Artemis.Plugins.Modules.General/Artemis.Plugins.Modules.General.csproj
+++ b/src/Artemis.Plugins.Modules.General/Artemis.Plugins.Modules.General.csproj
@@ -38,9 +38,8 @@
..\packages\QRCoder.1.3.5\lib\net40\QRCoder.dll
-
- ..\packages\RGB.NET.Core.0.1.22\lib\net45\RGB.NET.Core.dll
- False
+
+ ..\packages\RGB.NET.Core.0.1.25\lib\net45\RGB.NET.Core.dll
..\packages\Stylet.1.1.17\lib\net45\Stylet.dll
diff --git a/src/Artemis.Plugins.Modules.General/GeneralModule.cs b/src/Artemis.Plugins.Modules.General/GeneralModule.cs
index 0916e6408..beddcd704 100644
--- a/src/Artemis.Plugins.Modules.General/GeneralModule.cs
+++ b/src/Artemis.Plugins.Modules.General/GeneralModule.cs
@@ -80,7 +80,7 @@ namespace Artemis.Plugins.Modules.General
private void UpdateLedColor(Led led, double deltaTime)
{
if (_colors.ContainsKey(led))
- _colors[led] = ColorHelpers.ShiftColor(_colors[led], (int) (deltaTime * 1000));
+ _colors[led] = ColorHelpers.ShiftColor(_colors[led], (int) (deltaTime * 200));
else
_colors[led] = ColorHelpers.GetRandomRainbowColor();
}
diff --git a/src/Artemis.Plugins.Modules.General/packages.config b/src/Artemis.Plugins.Modules.General/packages.config
index cc1481525..bc59d252d 100644
--- a/src/Artemis.Plugins.Modules.General/packages.config
+++ b/src/Artemis.Plugins.Modules.General/packages.config
@@ -1,7 +1,7 @@
-
+
diff --git a/src/Artemis.Storage/Artemis.Storage.csproj b/src/Artemis.Storage/Artemis.Storage.csproj
index b3a6d3da5..a26324489 100644
--- a/src/Artemis.Storage/Artemis.Storage.csproj
+++ b/src/Artemis.Storage/Artemis.Storage.csproj
@@ -9,6 +9,9 @@
+
+
+
diff --git a/src/Artemis.Storage/Entities/PluginSettingEntity.cs b/src/Artemis.Storage/Entities/PluginSettingEntity.cs
new file mode 100644
index 000000000..6f275bf8b
--- /dev/null
+++ b/src/Artemis.Storage/Entities/PluginSettingEntity.cs
@@ -0,0 +1,13 @@
+using System;
+using System.ComponentModel.DataAnnotations;
+
+namespace Artemis.Storage.Entities
+{
+ public class PluginSettingEntity
+ {
+ public Guid PluginGuid { get; set; }
+ public string Name { get; set; }
+
+ public string Value { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Entities/SettingEntity.cs b/src/Artemis.Storage/Entities/SettingEntity.cs
index 0ecc277c8..a095b6ed7 100644
--- a/src/Artemis.Storage/Entities/SettingEntity.cs
+++ b/src/Artemis.Storage/Entities/SettingEntity.cs
@@ -1,13 +1,8 @@
-using System;
-using System.ComponentModel.DataAnnotations;
-
-namespace Artemis.Storage.Entities
+namespace Artemis.Storage.Entities
{
public class SettingEntity
{
- public Guid PluginGuid { get; set; }
public string Name { get; set; }
-
public string Value { get; set; }
}
}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Migrations/20190417180145_InitialCreate.Designer.cs b/src/Artemis.Storage/Migrations/20190429131614_InitialCreate.Designer.cs
similarity index 93%
rename from src/Artemis.Storage/Migrations/20190417180145_InitialCreate.Designer.cs
rename to src/Artemis.Storage/Migrations/20190429131614_InitialCreate.Designer.cs
index c62731c83..9c1adaaad 100644
--- a/src/Artemis.Storage/Migrations/20190417180145_InitialCreate.Designer.cs
+++ b/src/Artemis.Storage/Migrations/20190429131614_InitialCreate.Designer.cs
@@ -9,7 +9,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace Artemis.Storage.Migrations
{
[DbContext(typeof(StorageContext))]
- [Migration("20190417180145_InitialCreate")]
+ [Migration("20190429131614_InitialCreate")]
partial class InitialCreate
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
@@ -110,6 +110,19 @@ namespace Artemis.Storage.Migrations
b.ToTable("Leds");
});
+ modelBuilder.Entity("Artemis.Storage.Entities.PluginSettingEntity", b =>
+ {
+ b.Property("Name");
+
+ b.Property("PluginGuid");
+
+ b.Property("Value");
+
+ b.HasKey("Name", "PluginGuid");
+
+ b.ToTable("PluginSettings");
+ });
+
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
{
b.Property("Guid")
@@ -132,13 +145,12 @@ namespace Artemis.Storage.Migrations
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
{
- b.Property("Name");
-
- b.Property("PluginGuid");
+ b.Property("Name")
+ .ValueGeneratedOnAdd();
b.Property("Value");
- b.HasKey("Name", "PluginGuid");
+ b.HasKey("Name");
b.ToTable("Settings");
});
diff --git a/src/Artemis.Storage/Migrations/20190417180145_InitialCreate.cs b/src/Artemis.Storage/Migrations/20190429131614_InitialCreate.cs
similarity index 92%
rename from src/Artemis.Storage/Migrations/20190417180145_InitialCreate.cs
rename to src/Artemis.Storage/Migrations/20190429131614_InitialCreate.cs
index d07231fdf..ee606d7e1 100644
--- a/src/Artemis.Storage/Migrations/20190417180145_InitialCreate.cs
+++ b/src/Artemis.Storage/Migrations/20190429131614_InitialCreate.cs
@@ -28,7 +28,7 @@ namespace Artemis.Storage.Migrations
});
migrationBuilder.CreateTable(
- name: "Settings",
+ name: "PluginSettings",
columns: table => new
{
PluginGuid = table.Column(nullable: false),
@@ -37,7 +37,19 @@ namespace Artemis.Storage.Migrations
},
constraints: table =>
{
- table.PrimaryKey("PK_Settings", x => new { x.Name, x.PluginGuid });
+ table.PrimaryKey("PK_PluginSettings", x => new { x.Name, x.PluginGuid });
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Settings",
+ columns: table => new
+ {
+ Name = table.Column(nullable: false),
+ Value = table.Column(nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Settings", x => x.Name);
});
migrationBuilder.CreateTable(
@@ -181,6 +193,9 @@ namespace Artemis.Storage.Migrations
migrationBuilder.DropTable(
name: "Leds");
+ migrationBuilder.DropTable(
+ name: "PluginSettings");
+
migrationBuilder.DropTable(
name: "Profiles");
diff --git a/src/Artemis.Storage/Migrations/StorageContextModelSnapshot.cs b/src/Artemis.Storage/Migrations/StorageContextModelSnapshot.cs
index 6ecde8ea8..4f579d102 100644
--- a/src/Artemis.Storage/Migrations/StorageContextModelSnapshot.cs
+++ b/src/Artemis.Storage/Migrations/StorageContextModelSnapshot.cs
@@ -108,6 +108,19 @@ namespace Artemis.Storage.Migrations
b.ToTable("Leds");
});
+ modelBuilder.Entity("Artemis.Storage.Entities.PluginSettingEntity", b =>
+ {
+ b.Property("Name");
+
+ b.Property("PluginGuid");
+
+ b.Property("Value");
+
+ b.HasKey("Name", "PluginGuid");
+
+ b.ToTable("PluginSettings");
+ });
+
modelBuilder.Entity("Artemis.Storage.Entities.ProfileEntity", b =>
{
b.Property("Guid")
@@ -130,13 +143,12 @@ namespace Artemis.Storage.Migrations
modelBuilder.Entity("Artemis.Storage.Entities.SettingEntity", b =>
{
- b.Property("Name");
-
- b.Property("PluginGuid");
+ b.Property("Name")
+ .ValueGeneratedOnAdd();
b.Property("Value");
- b.HasKey("Name", "PluginGuid");
+ b.HasKey("Name");
b.ToTable("Settings");
});
diff --git a/src/Artemis.Storage/Repositories/IPluginSettingRepository.cs b/src/Artemis.Storage/Repositories/IPluginSettingRepository.cs
new file mode 100644
index 000000000..16a7d11d1
--- /dev/null
+++ b/src/Artemis.Storage/Repositories/IPluginSettingRepository.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+using Artemis.Storage.Entities;
+
+namespace Artemis.Storage.Repositories
+{
+ public interface IPluginSettingRepository : IRepository
+ {
+ void Add(PluginSettingEntity pluginSettingEntity);
+ List GetByPluginGuid(Guid pluginGuid);
+ Task> GetByPluginGuidAsync(Guid pluginGuid);
+ PluginSettingEntity GetByNameAndPluginGuid(string name, Guid pluginGuid);
+ Task GetByNameAndPluginGuidAsync(string name, Guid pluginGuid);
+ void Save();
+ Task SaveAsync();
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Repositories/ISettingRepository.cs b/src/Artemis.Storage/Repositories/ISettingRepository.cs
index 5c0a7d835..e0b5550cd 100644
--- a/src/Artemis.Storage/Repositories/ISettingRepository.cs
+++ b/src/Artemis.Storage/Repositories/ISettingRepository.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
+using System.Collections.Generic;
using System.Threading.Tasks;
using Artemis.Storage.Entities;
@@ -8,12 +6,11 @@ namespace Artemis.Storage.Repositories
{
public interface ISettingRepository : IRepository
{
- IQueryable GetAll();
- List GetByPluginGuid(Guid pluginGuid);
void Add(SettingEntity settingEntity);
- Task> GetByPluginGuidAsync(Guid pluginGuid);
- Task GetByNameAndPluginGuid(string name, Guid pluginGuid);
- Task GetByName(string name);
+ SettingEntity Get(string name);
+ Task GetAsync(string name);
+ List GetAll();
+ Task> GetAllAsync();
void Save();
Task SaveAsync();
}
diff --git a/src/Artemis.Storage/Repositories/PluginSettingRepository.cs b/src/Artemis.Storage/Repositories/PluginSettingRepository.cs
new file mode 100644
index 000000000..a62aaaa90
--- /dev/null
+++ b/src/Artemis.Storage/Repositories/PluginSettingRepository.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Artemis.Storage.Entities;
+using Microsoft.EntityFrameworkCore;
+
+namespace Artemis.Storage.Repositories
+{
+ public class PluginSettingRepository : IPluginSettingRepository
+ {
+ private readonly StorageContext _dbContext;
+
+ internal PluginSettingRepository()
+ {
+ _dbContext = new StorageContext();
+ _dbContext.Database.EnsureCreated();
+ }
+
+ public void Add(PluginSettingEntity pluginSettingEntity)
+ {
+ _dbContext.PluginSettings.Add(pluginSettingEntity);
+ }
+
+ public List GetByPluginGuid(Guid pluginGuid)
+ {
+ return _dbContext.PluginSettings.Where(p => p.PluginGuid == pluginGuid).ToList();
+ }
+
+ public async Task> GetByPluginGuidAsync(Guid pluginGuid)
+ {
+ return await _dbContext.PluginSettings.Where(p => p.PluginGuid == pluginGuid).ToListAsync();
+ }
+
+ public PluginSettingEntity GetByNameAndPluginGuid(string name, Guid pluginGuid)
+ {
+ return _dbContext.PluginSettings.FirstOrDefault(p => p.Name == name && p.PluginGuid == pluginGuid);
+ }
+
+ public async Task GetByNameAndPluginGuidAsync(string name, Guid pluginGuid)
+ {
+ return await _dbContext.PluginSettings.FirstOrDefaultAsync(p => p.Name == name && p.PluginGuid == pluginGuid);
+ }
+
+ public void Save()
+ {
+ _dbContext.SaveChanges();
+ }
+
+ public async Task SaveAsync()
+ {
+ await _dbContext.SaveChangesAsync();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.Storage/Repositories/SettingRepository.cs b/src/Artemis.Storage/Repositories/SettingRepository.cs
index 8564edbf8..fafe9308c 100644
--- a/src/Artemis.Storage/Repositories/SettingRepository.cs
+++ b/src/Artemis.Storage/Repositories/SettingRepository.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Artemis.Storage.Entities;
@@ -17,36 +16,31 @@ namespace Artemis.Storage.Repositories
_dbContext.Database.EnsureCreated();
}
- public IQueryable GetAll()
- {
- return _dbContext.Settings;
- }
-
- public List GetByPluginGuid(Guid pluginGuid)
- {
- return _dbContext.Settings.Where(p => p.PluginGuid == pluginGuid).ToList();
- }
-
public void Add(SettingEntity settingEntity)
{
_dbContext.Settings.Add(settingEntity);
}
- public async Task> GetByPluginGuidAsync(Guid pluginGuid)
+ public SettingEntity Get(string name)
{
- return await _dbContext.Settings.Where(p => p.PluginGuid == pluginGuid).ToListAsync();
+ return _dbContext.Settings.FirstOrDefault(p => p.Name == name);
}
- public async Task GetByNameAndPluginGuid(string name, Guid pluginGuid)
- {
- return await _dbContext.Settings.FirstOrDefaultAsync(p => p.Name == name && p.PluginGuid == pluginGuid);
- }
-
- public async Task GetByName(string name)
+ public async Task GetAsync(string name)
{
return await _dbContext.Settings.FirstOrDefaultAsync(p => p.Name == name);
}
+ public List GetAll()
+ {
+ return _dbContext.Settings.ToList();
+ }
+
+ public async Task> GetAllAsync()
+ {
+ return await _dbContext.Settings.ToListAsync();
+ }
+
public void Save()
{
_dbContext.SaveChanges();
diff --git a/src/Artemis.Storage/StorageContext.cs b/src/Artemis.Storage/StorageContext.cs
index 275494767..8af00a422 100644
--- a/src/Artemis.Storage/StorageContext.cs
+++ b/src/Artemis.Storage/StorageContext.cs
@@ -1,8 +1,8 @@
-using System;
-using System.IO;
+using System.IO;
using System.Reflection;
using Artemis.Storage.Entities;
using Microsoft.EntityFrameworkCore;
+using SQLitePCL;
namespace Artemis.Storage
{
@@ -10,23 +10,26 @@ namespace Artemis.Storage
{
public DbSet Profiles { get; set; }
public DbSet Settings { get; set; }
+ public DbSet PluginSettings { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
-#if DEBUG
+// var dbLocation = @"C:\Repos\Artemis\src\Artemis.Storage\Storage.db";
+ #if DEBUG
var dbLocation = Path.GetFullPath(Path.Combine(Assembly.GetEntryAssembly().Location, @"..\..\..\..\Artemis.Storage\Storage.db"));
-#else
+ #else
var dbLocation = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + "\\Artemis\\Storage.db";
-#endif
+ #endif
optionsBuilder.UseSqlite("Data Source=" + dbLocation);
// Requires Microsoft.Data.Sqlite in the startup project
- SQLitePCL.Batteries.Init();
+ Batteries.Init();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
- modelBuilder.Entity().HasKey(s => new {s.Name, s.PluginGuid});
+ modelBuilder.Entity().HasKey(s => s.Name);
+ modelBuilder.Entity().HasKey(s => new {s.Name, s.PluginGuid});
base.OnModelCreating(modelBuilder);
}
}
diff --git a/src/Artemis.UI/Artemis.UI.csproj b/src/Artemis.UI/Artemis.UI.csproj
index dadd7dd96..a997aa09b 100644
--- a/src/Artemis.UI/Artemis.UI.csproj
+++ b/src/Artemis.UI/Artemis.UI.csproj
@@ -99,20 +99,44 @@
..\packages\PropertyChanged.Fody.2.6.1\lib\net452\PropertyChanged.dll
-
- ..\packages\RGB.NET.Brushes.0.1.22\lib\net45\RGB.NET.Brushes.dll
+
+ ..\packages\RGB.NET.Brushes.0.1.25\lib\net45\RGB.NET.Brushes.dll
-
- ..\packages\RGB.NET.Core.0.1.22\lib\net45\RGB.NET.Core.dll
+
+ ..\packages\RGB.NET.Core.0.1.25\lib\net45\RGB.NET.Core.dll
-
- ..\packages\RGB.NET.Decorators.0.1.22\lib\net45\RGB.NET.Decorators.dll
+
+ ..\packages\RGB.NET.Decorators.0.1.25\lib\net45\RGB.NET.Decorators.dll
-
- ..\packages\RGB.NET.Devices.Corsair.0.1.22\lib\net45\RGB.NET.Devices.Corsair.dll
+
+ ..\packages\RGB.NET.Devices.Corsair.0.1.25\lib\net45\RGB.NET.Devices.Corsair.dll
-
- ..\packages\RGB.NET.Groups.0.1.22\lib\net45\RGB.NET.Groups.dll
+
+ ..\packages\RGB.NET.Groups.0.1.25\lib\net45\RGB.NET.Groups.dll
+
+
+ ..\packages\SharpVectors.Reloaded.1.3.0\lib\net40\SharpVectors.Converters.Wpf.dll
+
+
+ ..\packages\SharpVectors.Reloaded.1.3.0\lib\net40\SharpVectors.Core.dll
+
+
+ ..\packages\SharpVectors.Reloaded.1.3.0\lib\net40\SharpVectors.Css.dll
+
+
+ ..\packages\SharpVectors.Reloaded.1.3.0\lib\net40\SharpVectors.Dom.dll
+
+
+ ..\packages\SharpVectors.Reloaded.1.3.0\lib\net40\SharpVectors.Model.dll
+
+
+ ..\packages\SharpVectors.Reloaded.1.3.0\lib\net40\SharpVectors.Rendering.Gdi.dll
+
+
+ ..\packages\SharpVectors.Reloaded.1.3.0\lib\net40\SharpVectors.Rendering.Wpf.dll
+
+
+ ..\packages\SharpVectors.Reloaded.1.3.0\lib\net40\SharpVectors.Runtime.Wpf.dll
..\packages\SQLitePCLRaw.bundle_green.1.1.12\lib\net45\SQLitePCLRaw.batteries_green.dll
@@ -162,17 +186,22 @@
-
+
+
+
+
+
-
-
+
+
-
+
App.xaml
Code
-
+
+
Designer
MSBuild:Compile
@@ -185,19 +214,35 @@
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
Designer
MSBuild:Compile
-
+
+ Designer
+ MSBuild:Compile
+
+
+ MSBuild:Compile
+ Designer
+
+
+ Designer
+ MSBuild:Compile
+
+
+ Designer
+ MSBuild:Compile
+
+
Designer
MSBuild:Compile
diff --git a/src/Artemis.UI/Bootstrapper.cs b/src/Artemis.UI/Bootstrapper.cs
index c3c420e5b..5a8ed2654 100644
--- a/src/Artemis.UI/Bootstrapper.cs
+++ b/src/Artemis.UI/Bootstrapper.cs
@@ -4,6 +4,7 @@ using Artemis.Core.Services.Interfaces;
using Artemis.UI.Ninject;
using Artemis.UI.Stylet;
using Artemis.UI.ViewModels;
+using Artemis.UI.ViewModels.Screens;
using Ninject;
namespace Artemis.UI
diff --git a/src/Artemis.UI/Ninject/UiModule.cs b/src/Artemis.UI/Ninject/UiModule.cs
index 85df21828..9f7fe984a 100644
--- a/src/Artemis.UI/Ninject/UiModule.cs
+++ b/src/Artemis.UI/Ninject/UiModule.cs
@@ -15,7 +15,7 @@ namespace Artemis.UI.Ninject
{
x.FromThisAssembly()
.SelectAllClasses()
- .InheritedFrom()
+ .InheritedFrom()
.BindAllInterfaces();
});
diff --git a/src/Artemis.UI/ViewModels/Controls/Editor/SurfaceEditorViewModel.cs b/src/Artemis.UI/ViewModels/Controls/Editor/SurfaceEditorViewModel.cs
new file mode 100644
index 000000000..40f4fb128
--- /dev/null
+++ b/src/Artemis.UI/ViewModels/Controls/Editor/SurfaceEditorViewModel.cs
@@ -0,0 +1,43 @@
+using System.Collections.ObjectModel;
+using System.Linq;
+using Artemis.Core.Events;
+using Artemis.Core.Services.Interfaces;
+using Artemis.UI.ViewModels.Controls.RgbDevice;
+using RGB.NET.Core;
+
+namespace Artemis.UI.ViewModels.Controls.Editor
+{
+ public class SurfaceEditorViewModel
+ {
+ private readonly IRgbService _rgbService;
+
+ public SurfaceEditorViewModel(IRgbService rgbService)
+ {
+ Devices = new ObservableCollection();
+
+ _rgbService = rgbService;
+ _rgbService.DeviceLoaded += RgbServiceOnDeviceLoaded;
+ _rgbService.Surface.Updated += SurfaceOnUpdated;
+
+ foreach (var surfaceDevice in _rgbService.Surface.Devices)
+ Devices.Add(new RgbDeviceViewModel(surfaceDevice));
+ }
+
+
+ public ObservableCollection Devices { get; set; }
+
+ private void RgbServiceOnDeviceLoaded(object sender, DeviceEventArgs e)
+ {
+ if (Devices.All(d => d.Device != e.Device))
+ Devices.Add(new RgbDeviceViewModel(e.Device));
+ }
+
+ private void SurfaceOnUpdated(UpdatedEventArgs args)
+ {
+ foreach (var rgbDeviceViewModel in Devices)
+ {
+ rgbDeviceViewModel.Update();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbDeviceViewModel.cs b/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbDeviceViewModel.cs
new file mode 100644
index 000000000..e7f6a35bd
--- /dev/null
+++ b/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbDeviceViewModel.cs
@@ -0,0 +1,28 @@
+using System.Collections.Generic;
+using RGB.NET.Core;
+
+namespace Artemis.UI.ViewModels.Controls.RgbDevice
+{
+ public class RgbDeviceViewModel
+ {
+ private readonly List _leds;
+
+ public RgbDeviceViewModel(IRGBDevice device)
+ {
+ Device = device;
+ _leds = new List();
+
+ foreach (var led in Device)
+ _leds.Add(new RgbLedViewModel(led));
+ }
+
+ public IRGBDevice Device { get; }
+ public IReadOnlyCollection Leds => _leds.AsReadOnly();
+
+ public void Update()
+ {
+ foreach (var rgbLedViewModel in _leds)
+ rgbLedViewModel.Update();
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbLedViewModel.cs b/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbLedViewModel.cs
new file mode 100644
index 000000000..16d5904fd
--- /dev/null
+++ b/src/Artemis.UI/ViewModels/Controls/RgbDevice/RgbLedViewModel.cs
@@ -0,0 +1,96 @@
+using System;
+using System.Windows;
+using System.Windows.Media;
+using RGB.NET.Core;
+using SharpVectors.Converters;
+using SharpVectors.Renderers.Wpf;
+using Stylet;
+using Color = System.Windows.Media.Color;
+
+namespace Artemis.UI.ViewModels.Controls.RgbDevice
+{
+ public class RgbLedViewModel : PropertyChangedBase
+ {
+ public RgbLedViewModel(Led led)
+ {
+ Led = led;
+
+ Execute.OnUIThread(CreateLedGeometry);
+ Update();
+ }
+
+ public Led Led { get; }
+
+ public double X { get; private set; }
+
+ public double Y { get; private set; }
+
+ public double Width { get; private set; }
+
+ public double Height { get; private set; }
+
+ public Color FillColor { get; set; }
+
+ public DrawingImage DisplayDrawing { get; private set; }
+
+ public string Tooltip => $"{Led.Id} - {Led.LedRectangle}";
+
+ private void CreateLedGeometry()
+ {
+ // Prepare the SVG for this LED
+ var converter = new FileSvgReader(new WpfDrawingSettings {OptimizePath = true});
+ if (Led.Image != null)
+ {
+ DisplayDrawing = new DrawingImage(converter.Read(Led.Image));
+ }
+ else
+ {
+ var relativeRectangle = new Rect(0, 0, Led.LedRectangle.Width, Led.LedRectangle.Height);
+ Geometry geometry;
+ switch (Led.Shape)
+ {
+ case Shape.Custom:
+ geometry = Geometry.Parse(Led.ShapeData);
+ break;
+ case Shape.Rectangle:
+ geometry = new RectangleGeometry(relativeRectangle, 2, 2);
+ break;
+ case Shape.Circle:
+ geometry = new EllipseGeometry(relativeRectangle);
+ break;
+ default:
+ throw new ArgumentOutOfRangeException();
+ }
+
+ var drawing = new GeometryDrawing(null, new Pen(null, 2), geometry);
+ DisplayDrawing = new DrawingImage(drawing);
+ }
+
+ NotifyOfPropertyChange(() => DisplayDrawing);
+ }
+
+ public void Update()
+ {
+ FillColor = Color.FromRgb((byte) Math.Round(255 * Led.Color.R), (byte) Math.Round(255 * Led.Color.G), (byte) Math.Round(255 * Led.Color.B));
+ X = Led.LedRectangle.X;
+ Y = Led.LedRectangle.Y;
+ Width = Led.LedRectangle.Width;
+ Height = Led.LedRectangle.Height;
+
+ if (DisplayDrawing != null)
+ {
+ Execute.OnUIThread(() =>
+ {
+ if (DisplayDrawing.Drawing is GeometryDrawing geometryDrawing)
+ {
+ geometryDrawing.Brush = new SolidColorBrush(FillColor) {Opacity = 0.6};
+ geometryDrawing.Pen.Brush = new SolidColorBrush(FillColor);
+ }
+ else if (DisplayDrawing.Drawing is DrawingGroup drawingGroup)
+ drawingGroup.OpacityMask = new SolidColorBrush(FillColor);
+ });
+ NotifyOfPropertyChange(() => DisplayDrawing);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Controls/Settings/RgbDeviceSettingsViewModel.cs b/src/Artemis.UI/ViewModels/Controls/Settings/RgbDeviceSettingsViewModel.cs
new file mode 100644
index 000000000..ee0553900
--- /dev/null
+++ b/src/Artemis.UI/ViewModels/Controls/Settings/RgbDeviceSettingsViewModel.cs
@@ -0,0 +1,25 @@
+using Humanizer;
+using RGB.NET.Core;
+
+namespace Artemis.UI.ViewModels.Controls.Settings
+{
+ public class RgbDeviceSettingsViewModel
+ {
+ public IRGBDevice Device { get; }
+
+ public RgbDeviceSettingsViewModel(IRGBDevice device)
+ {
+ Device = device;
+
+ Type = Device.DeviceInfo.DeviceType.ToString().Humanize();
+ Name = Device.DeviceInfo.Model;
+ Manufacturer = Device.DeviceInfo.Manufacturer;
+ Enabled = true;
+ }
+
+ public string Type { get; set; }
+ public string Name { get; set; }
+ public string Manufacturer { get; set; }
+ public bool Enabled { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Interfaces/IEditorViewModel.cs b/src/Artemis.UI/ViewModels/Interfaces/IEditorViewModel.cs
new file mode 100644
index 000000000..c96dd7b56
--- /dev/null
+++ b/src/Artemis.UI/ViewModels/Interfaces/IEditorViewModel.cs
@@ -0,0 +1,7 @@
+namespace Artemis.UI.ViewModels.Interfaces
+{
+ public interface IEditorViewModel : IScreenViewModel
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Interfaces/IHomeViewModel.cs b/src/Artemis.UI/ViewModels/Interfaces/IHomeViewModel.cs
index a16a74f84..509d2df41 100644
--- a/src/Artemis.UI/ViewModels/Interfaces/IHomeViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Interfaces/IHomeViewModel.cs
@@ -1,6 +1,6 @@
namespace Artemis.UI.ViewModels.Interfaces
{
- public interface IHomeViewModel : IArtemisViewModel
+ public interface IHomeViewModel : IScreenViewModel
{
void OpenUrl(string url);
}
diff --git a/src/Artemis.UI/ViewModels/Interfaces/IArtemisViewModel.cs b/src/Artemis.UI/ViewModels/Interfaces/IScreenViewModel.cs
similarity index 68%
rename from src/Artemis.UI/ViewModels/Interfaces/IArtemisViewModel.cs
rename to src/Artemis.UI/ViewModels/Interfaces/IScreenViewModel.cs
index 5ac9f1683..96734ea11 100644
--- a/src/Artemis.UI/ViewModels/Interfaces/IArtemisViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Interfaces/IScreenViewModel.cs
@@ -2,7 +2,7 @@
namespace Artemis.UI.ViewModels.Interfaces
{
- public interface IArtemisViewModel : IScreen
+ public interface IScreenViewModel : IScreen
{
string Title { get; }
}
diff --git a/src/Artemis.UI/ViewModels/Interfaces/ISettingsViewModel.cs b/src/Artemis.UI/ViewModels/Interfaces/ISettingsViewModel.cs
index 34bf2f59c..4debbf352 100644
--- a/src/Artemis.UI/ViewModels/Interfaces/ISettingsViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Interfaces/ISettingsViewModel.cs
@@ -1,6 +1,6 @@
namespace Artemis.UI.ViewModels.Interfaces
{
- public interface ISettingsViewModel : IArtemisViewModel
+ public interface ISettingsViewModel : IScreenViewModel
{
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Screens/EditorViewModel.cs b/src/Artemis.UI/ViewModels/Screens/EditorViewModel.cs
new file mode 100644
index 000000000..6279828a4
--- /dev/null
+++ b/src/Artemis.UI/ViewModels/Screens/EditorViewModel.cs
@@ -0,0 +1,18 @@
+using Artemis.Core.Services.Interfaces;
+using Artemis.UI.ViewModels.Controls.Editor;
+using Artemis.UI.ViewModels.Interfaces;
+using Stylet;
+
+namespace Artemis.UI.ViewModels.Screens
+{
+ public class EditorViewModel : Screen, IEditorViewModel
+ {
+ public EditorViewModel(IRgbService rgbService)
+ {
+ SurfaceEditorViewModel = new SurfaceEditorViewModel(rgbService);
+ }
+
+ public SurfaceEditorViewModel SurfaceEditorViewModel { get; set; }
+ public string Title => "Editor";
+ }
+}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/HomeViewModel.cs b/src/Artemis.UI/ViewModels/Screens/HomeViewModel.cs
similarity index 91%
rename from src/Artemis.UI/ViewModels/HomeViewModel.cs
rename to src/Artemis.UI/ViewModels/Screens/HomeViewModel.cs
index 25d99189d..d71a83d18 100644
--- a/src/Artemis.UI/ViewModels/HomeViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Screens/HomeViewModel.cs
@@ -3,7 +3,7 @@ using System.Diagnostics;
using Artemis.UI.ViewModels.Interfaces;
using Stylet;
-namespace Artemis.UI.ViewModels
+namespace Artemis.UI.ViewModels.Screens
{
public class HomeViewModel : Screen, IHomeViewModel
{
diff --git a/src/Artemis.UI/ViewModels/RootViewModel.cs b/src/Artemis.UI/ViewModels/Screens/RootViewModel.cs
similarity index 91%
rename from src/Artemis.UI/ViewModels/RootViewModel.cs
rename to src/Artemis.UI/ViewModels/Screens/RootViewModel.cs
index c307d11e8..eb2addcd5 100644
--- a/src/Artemis.UI/ViewModels/RootViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Screens/RootViewModel.cs
@@ -5,20 +5,18 @@ using System.Threading.Tasks;
using System.Windows.Controls;
using Artemis.Core.Events;
using Artemis.Core.Plugins.Abstract;
-using Artemis.Core.Plugins.Interfaces;
using Artemis.Core.Services.Interfaces;
using Artemis.UI.ViewModels.Interfaces;
-using Artemis.UI.ViewModels.Settings;
using Stylet;
-namespace Artemis.UI.ViewModels
+namespace Artemis.UI.ViewModels.Screens
{
public class RootViewModel : Conductor.Collection.OneActive
{
- private readonly ICollection _artemisViewModels;
+ private readonly ICollection _artemisViewModels;
private readonly IPluginService _pluginService;
- public RootViewModel(ICollection artemisViewModels, IPluginService pluginService)
+ public RootViewModel(ICollection artemisViewModels, IPluginService pluginService)
{
_artemisViewModels = artemisViewModels;
_pluginService = pluginService;
@@ -104,6 +102,9 @@ namespace Artemis.UI.ViewModels
case "Workshop":
// ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(WorkshopViewModel)));
break;
+ case "Editor":
+ ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(EditorViewModel)));
+ break;
case "Settings":
ActivateItem(_artemisViewModels.First(v => v.GetType() == typeof(SettingsViewModel)));
break;
diff --git a/src/Artemis.UI/ViewModels/Settings/SettingsViewModel.cs b/src/Artemis.UI/ViewModels/Screens/SettingsViewModel.cs
similarity index 51%
rename from src/Artemis.UI/ViewModels/Settings/SettingsViewModel.cs
rename to src/Artemis.UI/ViewModels/Screens/SettingsViewModel.cs
index a7d5b61ac..dea3e7da7 100644
--- a/src/Artemis.UI/ViewModels/Settings/SettingsViewModel.cs
+++ b/src/Artemis.UI/ViewModels/Screens/SettingsViewModel.cs
@@ -1,28 +1,28 @@
-using System.Collections.Generic;
-using Artemis.Core.Events;
+using Artemis.Core.Events;
using Artemis.Core.Services.Interfaces;
+using Artemis.UI.ViewModels.Controls.Settings;
using Artemis.UI.ViewModels.Interfaces;
using Stylet;
-namespace Artemis.UI.ViewModels.Settings
+namespace Artemis.UI.ViewModels.Screens
{
public class SettingsViewModel : Screen, ISettingsViewModel
{
public SettingsViewModel(IRgbService rgbService)
{
- DeviceSettingsViewModels = new List();
+ DeviceSettingsViewModels = new BindableCollection();
foreach (var device in rgbService.Surface.Devices)
- DeviceSettingsViewModels.Add(new DeviceSettingsViewModel(device));
+ DeviceSettingsViewModels.Add(new RgbDeviceSettingsViewModel(device));
rgbService.DeviceLoaded += UpdateDevices;
}
- public List DeviceSettingsViewModels { get; set; }
+ public BindableCollection DeviceSettingsViewModels { get; set; }
public string Title => "Settings";
private void UpdateDevices(object sender, DeviceEventArgs deviceEventArgs)
{
- DeviceSettingsViewModels.Add(new DeviceSettingsViewModel(deviceEventArgs.Device));
+ DeviceSettingsViewModels.Add(new RgbDeviceSettingsViewModel(deviceEventArgs.Device));
}
}
}
\ No newline at end of file
diff --git a/src/Artemis.UI/ViewModels/Settings/DeviceSettingsViewModel.cs b/src/Artemis.UI/ViewModels/Settings/DeviceSettingsViewModel.cs
deleted file mode 100644
index e04b528a2..000000000
--- a/src/Artemis.UI/ViewModels/Settings/DeviceSettingsViewModel.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using Humanizer;
-using RGB.NET.Core;
-
-namespace Artemis.UI.ViewModels.Settings
-{
- public class DeviceSettingsViewModel
- {
- private readonly IRGBDevice _device;
-
- public DeviceSettingsViewModel(IRGBDevice device)
- {
- _device = device;
-
- Type = _device.DeviceInfo.DeviceType.ToString().Humanize();
- Name = _device.DeviceInfo.Model;
- Manufacturer = _device.DeviceInfo.Manufacturer;
- Enabled = true;
- }
-
- public string Type { get; set; }
- public string Name { get; set; }
- public string Manufacturer { get; set; }
- public bool Enabled { get; set; }
- }
-}
\ No newline at end of file
diff --git a/src/Artemis.UI/Views/Controls/Editor/SurfaceEditorView.xaml b/src/Artemis.UI/Views/Controls/Editor/SurfaceEditorView.xaml
new file mode 100644
index 000000000..eaa1602f4
--- /dev/null
+++ b/src/Artemis.UI/Views/Controls/Editor/SurfaceEditorView.xaml
@@ -0,0 +1,33 @@
+
+
+ Surface editor view
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Views/Controls/RgbDevice/RgbDeviceView.xaml b/src/Artemis.UI/Views/Controls/RgbDevice/RgbDeviceView.xaml
new file mode 100644
index 000000000..699fe70b4
--- /dev/null
+++ b/src/Artemis.UI/Views/Controls/RgbDevice/RgbDeviceView.xaml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Views/Controls/RgbDevice/RgbLedView.xaml b/src/Artemis.UI/Views/Controls/RgbDevice/RgbLedView.xaml
new file mode 100644
index 000000000..58221db4e
--- /dev/null
+++ b/src/Artemis.UI/Views/Controls/RgbDevice/RgbLedView.xaml
@@ -0,0 +1,12 @@
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Views/Settings/DeviceSettingsView.xaml b/src/Artemis.UI/Views/Controls/Settings/RgbDeviceSettingsView.xaml
similarity index 78%
rename from src/Artemis.UI/Views/Settings/DeviceSettingsView.xaml
rename to src/Artemis.UI/Views/Controls/Settings/RgbDeviceSettingsView.xaml
index 5a0d5e17e..c33fda513 100644
--- a/src/Artemis.UI/Views/Settings/DeviceSettingsView.xaml
+++ b/src/Artemis.UI/Views/Controls/Settings/RgbDeviceSettingsView.xaml
@@ -1,10 +1,10 @@
-
diff --git a/src/Artemis.UI/Views/Screens/EditorView.xaml b/src/Artemis.UI/Views/Screens/EditorView.xaml
new file mode 100644
index 000000000..929b215b4
--- /dev/null
+++ b/src/Artemis.UI/Views/Screens/EditorView.xaml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+ In the editor you can either edit your surface layout or edit a profile.
+
+
+
\ No newline at end of file
diff --git a/src/Artemis.UI/Views/HomeView.xaml b/src/Artemis.UI/Views/Screens/HomeView.xaml
similarity index 98%
rename from src/Artemis.UI/Views/HomeView.xaml
rename to src/Artemis.UI/Views/Screens/HomeView.xaml
index 9d8e62487..ec6d126fd 100644
--- a/src/Artemis.UI/Views/HomeView.xaml
+++ b/src/Artemis.UI/Views/Screens/HomeView.xaml
@@ -1,4 +1,4 @@
-
+ d:DataContext="{d:DesignInstance screens:HomeViewModel, IsDesignTimeCreatable=True}">
diff --git a/src/Artemis.UI/Views/RootView.xaml b/src/Artemis.UI/Views/Screens/RootView.xaml
similarity index 94%
rename from src/Artemis.UI/Views/RootView.xaml
rename to src/Artemis.UI/Views/Screens/RootView.xaml
index 7e52d4419..f9b49cc6b 100644
--- a/src/Artemis.UI/Views/RootView.xaml
+++ b/src/Artemis.UI/Views/Screens/RootView.xaml
@@ -1,4 +1,4 @@
-
@@ -106,6 +107,13 @@
Workshop
+
+
+
+ Editor
+
+
@@ -23,7 +24,14 @@
Devices
- A list of plugins and options to disable them
+ A list of devices and options to disable them
+
+
+
+
+
+
+
Plugins
diff --git a/src/Artemis.UI/packages.config b/src/Artemis.UI/packages.config
index 67a7db653..a5a3637f3 100644
--- a/src/Artemis.UI/packages.config
+++ b/src/Artemis.UI/packages.config
@@ -14,12 +14,13 @@
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/Artemis.sln.DotSettings b/src/Artemis.sln.DotSettings
new file mode 100644
index 000000000..9ad040f9a
--- /dev/null
+++ b/src/Artemis.sln.DotSettings
@@ -0,0 +1,64 @@
+
+ True
+ Built-in: Full Cleanup
+ RequiredForMultiline
+ RequiredForMultiline
+ RequiredForMultiline
+ USUAL_INDENT
+ NEVER
+ NEVER
+ NEVER
+ 200
+ True
+ True
+ True
+ False
+ True
+ False
+ True
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" />
+ True
+ True
+ True
+ True
+ True
\ No newline at end of file