Example #1
0
        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));
                }
            }
        }
Example #2
0
        public override void DeselectGroupedElements()
        {
            List <GraphicElement> elementsToRemove = new List <GraphicElement>();

            selectedElements.Where(el => el.Parent != null).ForEach(el =>
            {
                var els     = EraseIntersectionsTopToBottom(el);
                el.Selected = false;
                DrawBottomToTop(els);
                UpdateScreen(els);
                elementsToRemove.Add(el);
            });

            elementsToRemove.ForEach(el => selectedElements.Remove(el));

            if (selectedElements.Count == 0)
            {
                ElementSelected.Fire(this, new ElementEventArgs()
                {
                    Element = null
                });
            }
            else
            {
                // Select the first element.
                // TODO: This needs to fire an event that can handle the group of selected elements,
                // particularly for PropertyGrid handling.
                ElementSelected.Fire(this, new ElementEventArgs()
                {
                    Element = selectedElements[0]
                });
            }
        }
Example #3
0
        // Deselect all other elements.
        public override void SelectOnlyElement(GraphicElement el)
        {
            List <GraphicElement> intersections      = FindAllIntersections(el).ToList();
            List <GraphicElement> deselectedElements = new List <GraphicElement>();

            selectedElements.Where(e => e != el).ForEach(e =>
            {
                intersections.AddRange(FindAllIntersections(e));
                e.Deselect();
                deselectedElements.Add(e);
            });

            if (!selectedElements.Contains(el))
            {
                selectedElements.Add(el);
                el.Select();
            }

            deselectedElements.ForEach(e => selectedElements.Remove(e));

            EraseTopToBottom(intersections);
            DrawBottomToTop(intersections);
            UpdateScreen(intersections);
            ElementSelected.Fire(this, new ElementEventArgs()
            {
                Element = el
            });
        }
Example #4
0
        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
            });
        }
Example #5
0
        public void SelectElement(GraphicElement el)
        {
            DeselectCurrentSelectedElement();
            var els = EraseTopToBottom(el);

            el.Selected = true;
            DrawBottomToTop(els);
            UpdateScreen(els);
            selectedElement = el;
            ElementSelected.Fire(this, new ElementEventArgs()
            {
                Element = el
            });
        }
Example #6
0
        public override void DeselectCurrentSelectedElements()
        {
            selectedElements.ForEach(el =>
            {
                var els     = EraseIntersectionsTopToBottom(el);
                el.Selected = false;
                DrawBottomToTop(els);
                UpdateScreen(els);
            });

            selectedElements.Clear();
            ElementSelected.Fire(this, new ElementEventArgs()
            {
                Element = null
            });
        }
Example #7
0
 public override void SelectElement(GraphicElement el)
 {
     // Add to selected elements only once!
     if (!selectedElements.Contains(el))
     {
         var els = EraseIntersectionsTopToBottom(el);
         selectedElements.Add(el);
         el.Selected = true;
         DrawBottomToTop(els);
         UpdateScreen(els);
         ElementSelected.Fire(this, new ElementEventArgs()
         {
             Element = el
         });
     }
 }
Example #8
0
 protected void OnMouseDown(object sender, MouseEventArgs args)
 {
     if (args.Button == MouseButtons.Left)
     {
         leftMouseDown = true;
         DeselectCurrentSelectedElement();
         SelectElement(args.Location);
         selectedAnchor = selectedElement?.GetAnchors().FirstOrDefault(a => a.Near(mousePosition));
         ElementSelected.Fire(this, new ElementEventArgs()
         {
             Element = selectedElement
         });
         dragging      = selectedElement != null;
         mousePosition = args.Location;
     }
 }
        public override void SelectElement(GraphicElement el)
        {
            DeselectCurrentSelectedElement();

            if (el != null)
            {
                var els = EraseIntersectionsTopToBottom(el);
                el.Select();
                DrawBottomToTop(els);
                UpdateScreen(els);
                selectedElements.Add(el);
                ElementSelected.Fire(this, new ElementEventArgs()
                {
                    Element = el
                });
            }
        }
Example #10
0
        /// <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));
        }
Example #11
0
        public void CustomerIDItem(String CustomerIDField, String CustomerID, String SelectIcon, String SelectedElement, String RealSelected, String NextButton)
        {
            _driver.FindElementByXPath(CustomerIDField).Clear();
            _driver.FindElementByXPath(CustomerIDField).SendKeys(CustomerID);
            _driver.FindElementByXPath(SelectIcon).Click();
            IList <IWebElement> SelectElement = _driver.FindElementsByXPath(SelectedElement);

            foreach (var ElementSelected in SelectElement)
            {
                if (ElementSelected.Text.Equals(RealSelected))
                {
                    ElementSelected.Click();
                    String RemoveLastChar = ElementSelected.Text.Remove(ElementSelected.Text.Length - 1);
                    File.WriteAllText(Resources.MerchantDetails, CustomerID + Environment.NewLine + RemoveLastChar);
                    break;
                }
            }
            _driver.FindElementByXPath(NextButton).Click();
        }
Example #12
0
 public override void SelectElement(GraphicElement el)
 {
     // Add to selected elements only once!
     if (!selectedElements.Contains(el))
     {
         var els = EraseIntersectionsTopToBottom(el);
         selectedElements.Add(el);
         el.Select();
         DrawBottomToTop(els);
         UpdateScreen(els);
         ElementSelected.Fire(this, new ElementEventArgs()
         {
             Element = el
         });
         // Added this to support the NavTo feature, so that the element
         // can override this behavior (which is empty in the GraphicElement)
         // to do other things AFTER the rendering of the selected element has taken place.
         el.ElementSelected();
     }
 }
Example #13
0
 /// <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));
 }