modified ITheme interface (#344)

* upgrade to .NET Core 3.2 Preview 3 and fixes for issues created by #314

* Components based on Bootstrap4 for Sections and  TabStrip to increase productivity and promote uniformity in Module UIs

* rolled back change creating an Infrastructure.Interfaces namespace, modified IModule interface to be strongly typed

* modified ITheme interface
This commit is contained in:
Shaun Walker 2020-04-05 15:31:54 -04:00 committed by GitHub
parent 02fde9cec3
commit 5a6f939a98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 70 deletions

View File

@ -1,20 +0,0 @@
using System.Collections.Generic;
namespace Oqtane.Themes.BlazorTheme
{
public class Theme : ITheme
{
public Dictionary<string, string> Properties
{
get
{
Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "Name", "Blazor Theme" },
{ "Version", "1.0.0" }
};
return properties;
}
}
}
}

View File

@ -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"
};
}
}

View File

@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using Oqtane.Models;
namespace Oqtane.Themes
{
public interface ITheme
{
Dictionary<string, string> Properties { get; }
Theme Theme { get; }
}
}

View File

@ -1,20 +0,0 @@
using System.Collections.Generic;
namespace Oqtane.Themes.OqtaneTheme
{
public class Theme : ITheme
{
public Dictionary<string, string> Properties
{
get
{
Dictionary<string, string> properties = new Dictionary<string, string>
{
{ "Name", "Oqtane Theme" },
{ "Version", "1.0.0" }
};
return properties;
}
}
}
}

View File

@ -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"
};
}
}

View File

@ -48,41 +48,22 @@ namespace Oqtane.Repository
if (themetype != null)
{
var themeobject = Activator.CreateInstance(themetype);
Dictionary<string, string> properties = (Dictionary<string, string>)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);
}

View File

@ -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; }