diff --git a/Oqtane.Client/Themes/BlazorTheme/Theme.cs b/Oqtane.Client/Themes/BlazorTheme/Theme.cs deleted file mode 100644 index 4f95db85..00000000 --- a/Oqtane.Client/Themes/BlazorTheme/Theme.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -namespace Oqtane.Themes.BlazorTheme -{ - public class Theme : ITheme - { - public Dictionary Properties - { - get - { - Dictionary properties = new Dictionary - { - { "Name", "Blazor Theme" }, - { "Version", "1.0.0" } - }; - return properties; - } - } - } -} diff --git a/Oqtane.Client/Themes/BlazorTheme/ThemeInfo.cs b/Oqtane.Client/Themes/BlazorTheme/ThemeInfo.cs new file mode 100644 index 00000000..7c52e766 --- /dev/null +++ b/Oqtane.Client/Themes/BlazorTheme/ThemeInfo.cs @@ -0,0 +1,14 @@ +using Oqtane.Models; + +namespace Oqtane.Themes.BlazorTheme +{ + public class ThemeInfo : ITheme + { + public Theme Theme => new Theme + { + Name = "Blazor Theme", + Version = "1.0.0" + }; + + } +} diff --git a/Oqtane.Client/Themes/ITheme.cs b/Oqtane.Client/Themes/ITheme.cs index 134ec3a2..16d77bf4 100644 --- a/Oqtane.Client/Themes/ITheme.cs +++ b/Oqtane.Client/Themes/ITheme.cs @@ -1,10 +1,9 @@ -using System; -using System.Collections.Generic; +using Oqtane.Models; namespace Oqtane.Themes { public interface ITheme { - Dictionary Properties { get; } + Theme Theme { get; } } } diff --git a/Oqtane.Client/Themes/OqtaneTheme/Theme.cs b/Oqtane.Client/Themes/OqtaneTheme/Theme.cs deleted file mode 100644 index 4a9ab697..00000000 --- a/Oqtane.Client/Themes/OqtaneTheme/Theme.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Collections.Generic; - -namespace Oqtane.Themes.OqtaneTheme -{ - public class Theme : ITheme - { - public Dictionary Properties - { - get - { - Dictionary properties = new Dictionary - { - { "Name", "Oqtane Theme" }, - { "Version", "1.0.0" } - }; - return properties; - } - } - } -} diff --git a/Oqtane.Client/Themes/OqtaneTheme/ThemeInfo.cs b/Oqtane.Client/Themes/OqtaneTheme/ThemeInfo.cs new file mode 100644 index 00000000..39784cf3 --- /dev/null +++ b/Oqtane.Client/Themes/OqtaneTheme/ThemeInfo.cs @@ -0,0 +1,13 @@ +using Oqtane.Models; + +namespace Oqtane.Themes.OqtaneTheme +{ + public class ThemeInfo : ITheme + { + public Theme Theme => new Theme + { + Name = "Oqtane Theme", + Version = "1.0.0" + }; + } +} diff --git a/Oqtane.Server/Repository/ThemeRepository.cs b/Oqtane.Server/Repository/ThemeRepository.cs index 3bb3f7e9..1fa7c813 100644 --- a/Oqtane.Server/Repository/ThemeRepository.cs +++ b/Oqtane.Server/Repository/ThemeRepository.cs @@ -48,41 +48,22 @@ namespace Oqtane.Repository if (themetype != null) { var themeobject = Activator.CreateInstance(themetype); - Dictionary properties = (Dictionary)themetype.GetProperty("Properties").GetValue(themeobject); - theme = new Theme - { - ThemeName = @namespace, - Name = GetProperty(properties, "Name"), - Version = GetProperty(properties, "Version"), - Owner = GetProperty(properties, "Owner"), - Url = GetProperty(properties, "Url"), - Contact = GetProperty(properties, "Contact"), - License = GetProperty(properties, "License"), - Dependencies = GetProperty(properties, "Dependencies"), - ThemeControls = "", - PaneLayouts = "", - ContainerControls = "", - AssemblyName = assembly.FullName.Split(",")[0] - }; + theme = (Theme)themetype.GetProperty("Theme").GetValue(themeobject); } else { theme = new Theme { - ThemeName = @namespace, Name = themeControlType.Name, - Version = new Version(1, 0, 0).ToString(), - Owner = "", - Url = "", - Contact = "", - License = "", - Dependencies = "", - ThemeControls = "", - PaneLayouts = "", - ContainerControls = "", - AssemblyName = assembly.FullName.Split(",")[0] + Version = new Version(1, 0, 0).ToString() }; } + // set internal properties + theme.ThemeName = @namespace; + theme.ThemeControls = ""; + theme.PaneLayouts = ""; + theme.ContainerControls = ""; + theme.AssemblyName = assembly.FullName.Split(",")[0]; themes.Add(theme); index = themes.FindIndex(item => item.ThemeName == @namespace); } diff --git a/Oqtane.Shared/Models/Theme.cs b/Oqtane.Shared/Models/Theme.cs index e4b29cfc..a2dd83df 100644 --- a/Oqtane.Shared/Models/Theme.cs +++ b/Oqtane.Shared/Models/Theme.cs @@ -2,6 +2,17 @@ { public class Theme { + public Theme() + { + Name = ""; + Version = ""; + Owner = ""; + Url = ""; + Contact = ""; + License = ""; + Dependencies = ""; + } + public string ThemeName { get; set; } public string Name { get; set; } public string Version { get; set; }