public void RefreshProperties(GuiDebuggerElementInfo elementInfo) { var propertyInfos = _guiDebuggerService.GetElementPropertyInfos(elementInfo.Id); foreach (var existingElementProp in elementInfo.Properties.ToArray()) { if (propertyInfos.All(x => x.Name != existingElementProp.Name)) { elementInfo.Properties.Remove(existingElementProp); } } foreach (var property in propertyInfos) { var elementProp = elementInfo.Properties.FirstOrDefault(x => x.Name == property.Name); if (elementProp == null) { elementProp = new GuiDebuggerElementPropertyInfo() { Name = property.Name }; elementInfo.Properties.Add(elementProp); } elementProp.Value = property.Value; } }
private void GuiDebuggerElementInfoSelectionManagerOnSelectionChanged(object sender, SelectionChangedEventArgs <GuiDebuggerElementInfo> e) { ElementInfo = _guiDebuggerElementInfoSelectionManager.GetSelectedItem(); if (ElementInfo != null) { _guiDebugDataService.RefreshProperties(ElementInfo); _guiDebugDataService.HighlightGuiElement(ElementInfo); } }
/// <summary> /// Initializes a new instance of the <see cref="ElementInspectorViewModel"/> class. /// </summary> public ElementInspectorViewModel(IGuiDebugDataService guiDebugDataService, ISelectionManager <GuiDebuggerElementInfo> guiDebuggerElementInfoSelectionManager) { _guiDebugDataService = guiDebugDataService; _guiDebuggerElementInfoSelectionManager = guiDebuggerElementInfoSelectionManager; _guiDebuggerElementInfoSelectionManager.SelectionChanged += GuiDebuggerElementInfoSelectionManagerOnSelectionChanged; Title = "Element Inspector"; ElementInfo = _guiDebuggerElementInfoSelectionManager.GetSelectedItem(); }
public void HighlightGuiElement(GuiDebuggerElementInfo elementInfo) { _guiDebuggerService.HighlightGuiElement(elementInfo.Id); }