private void DispatcherTimerTick(object sender, EventArgs e) { if (System.Windows.Input.Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Control)) { var screenPos = Mouse.Position; var hoveredElement = _automation.FromPoint(screenPos); // Skip items in the current process // Like Inspect itself or the overlay window if (hoveredElement.Properties.ProcessId == Process.GetCurrentProcess().Id) { return; } if (!Equals(_currentHoveredElement, hoveredElement)) { _currentHoveredElement = hoveredElement; //ElementHovered?.Invoke(hoveredElement); } else { HighlightElement(hoveredElement); } if (System.Windows.Input.Keyboard.Modifiers.HasFlag(System.Windows.Input.ModifierKeys.Alt)) { ElementSelected?.Invoke(new UIElement(hoveredElement)); } } }
private void ElementSquare_OnPreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { var elementBlocks = VisualTreeHelpers.FindAllChildren <TextBlock>(sender as Border); SelectedElement = (elementBlocks.ToList()[0].Tag as Element); ElementSelected?.Invoke(sender, new ElementEventArgs { SelectedElement = this.SelectedElement }); }
/// <summary> /// Fires the ElementSelected event after setting the element selection /// </summary> /// <param name="listElements">The elements to indicate as selected</param> public void FireElementSelectedEvent(List <ProjectLayoutElement> listElements) { if (listElements == null) { m_listSelectedElements = listElements; } else { m_listSelectedElements = new List <ProjectLayoutElement>(); foreach (var zElement in listElements) { m_listSelectedElements.Add(ProjectManager.Instance.LookupElementReference(zElement)); } } ElementSelected?.Invoke(this, new ElementEventArgs(m_listSelectedElements)); }
/// <summary> /// Fires the ElementSelected event after setting the element selection /// </summary> /// <param name="listElements">The elements to indicate as selected</param> public void FireElementSelectedEvent(List <ProjectLayoutElement> listElements) { m_listSelectedElements = listElements; ElementSelected?.Invoke(this, new ElementEventArgs(listElements)); }