添加项目文件。
This commit is contained in:
33
MSDevTool/ViewModels/ObjectViewModel.cs
Normal file
33
MSDevTool/ViewModels/ObjectViewModel.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user