37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
|
using CommunityToolkit.Mvvm.ComponentModel;
|
||
|
using CtrEditor.ObjetosSim;
|
||
|
using System.Collections.ObjectModel;
|
||
|
using System.Reflection;
|
||
|
|
||
|
namespace CtrEditor
|
||
|
{
|
||
|
public partial class OsTreeNode : ObservableObject
|
||
|
{
|
||
|
[ObservableProperty]
|
||
|
private string name;
|
||
|
|
||
|
[ObservableProperty]
|
||
|
private ObservableCollection<OsTreeNode> children;
|
||
|
|
||
|
[ObservableProperty]
|
||
|
private osBase associatedObject;
|
||
|
|
||
|
[ObservableProperty]
|
||
|
private string relationshipType;
|
||
|
|
||
|
public OsTreeNode(string name, osBase obj = null, string relationship = "")
|
||
|
{
|
||
|
this.Name = name;
|
||
|
this.Children = new ObservableCollection<OsTreeNode>();
|
||
|
this.AssociatedObject = obj;
|
||
|
this.RelationshipType = relationship;
|
||
|
}
|
||
|
|
||
|
public static string GetTypeDisplayName(Type type)
|
||
|
{
|
||
|
var methodInfo = type.GetMethod("NombreClase", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy);
|
||
|
return methodInfo != null ? methodInfo.Invoke(null, null)?.ToString() : type.Name;
|
||
|
}
|
||
|
}
|
||
|
}
|