示例工程的修改,以依赖注入的方式

This commit is contained in:
fengjiayi
2024-09-30 10:02:06 +08:00
parent c69fa0ccae
commit f900cac4ea
3 changed files with 49 additions and 25 deletions

View File

@@ -314,8 +314,8 @@ namespace Serein.WorkBench.Themes
#region
if (member is PropertyInfo property)
{
#region
if (typeof(IEnumerable).IsAssignableFrom(property.PropertyType) && property.GetValue(obj) is IEnumerable collection && collection is not null)
#region (
if (property.PropertyType != typeof(string) && typeof(IEnumerable).IsAssignableFrom(property.PropertyType) && property.GetValue(obj) is IEnumerable collection && collection is not null)
{
TreeViewItem memberNode = new TreeViewItem { Header = member.Name };
// 处理集合类型的属性
@@ -377,8 +377,8 @@ namespace Serein.WorkBench.Themes
#region
else if (member is FieldInfo field)
{
#region
if (typeof(IEnumerable).IsAssignableFrom(field.FieldType) && field.GetValue(obj) is IEnumerable collection && collection is not null)
#region (
if (field.FieldType != typeof(string) && typeof(IEnumerable).IsAssignableFrom(field.FieldType) && field.GetValue(obj) is IEnumerable collection && collection is not null)
{
TreeViewItem memberNode = new TreeViewItem { Header = member.Name };
// 处理集合类型的字段