34 lines
1.0 KiB
C#
34 lines
1.0 KiB
C#
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Windows.Input;
|
|||
|
|
|
|||
|
|
|
|||
|
|
using Mstn.Toolkit.External;
|
|||
|
|
|
|||
|
|
|
|||
|
|
namespace MSDevTool.ViewModels
|
|||
|
|
{
|
|||
|
|
public class ObjectViewModel
|
|||
|
|
{
|
|||
|
|
public List<ClassPropValue> PropValues { get; set; }
|
|||
|
|
RelayCommand showElementCommand;
|
|||
|
|
|
|||
|
|
public ICommand ShowObjectCommand => showElementCommand ??= new RelayCommand(ShowObject, b => true);
|
|||
|
|
|
|||
|
|
private void ShowObject(object obj)
|
|||
|
|
{
|
|||
|
|
if (obj is ClassPropValue model && model.PropValue?.ToString() != "<null>")
|
|||
|
|
{
|
|||
|
|
var type = model.PropValue.GetType();
|
|||
|
|
if (type.IsClass || (type.IsValueType && !type.IsEnum && !type.IsPrimitive))
|
|||
|
|
{
|
|||
|
|
ObjectViewModel viewModel = new ObjectViewModel() { PropValues = SnoopHelpers.GetClassPropDictionary(model.PropValue) };
|
|||
|
|
ObjectView view = new ObjectView(viewModel);
|
|||
|
|
view.Title = model.PropName;
|
|||
|
|
view.Show();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|