Esempio n. 1
0
        private void OnTimerTickForControlChecking(object sender, ElapsedEventArgs e)
        {
            _execTimer += _timerInterval;
            if (CancelHasBeenRequested(OnTimerTickForControlChecking))
            {
                return;
            }

            if (_execTimer > _appSettings.Value.MaxActionDelay)
            {
                StopTimer(OnTimerTickForControlChecking);
                //_parentWindow.Invoke(new Action(() => _parentWindow.DisplayMessage($"Control for cursor action #{_currentlyProcessingAction.CurrentAction.ActionNumber} could not be found", "Error")));
                //_parentWindow.Invoke(new Action(() => _parentWindow.CloseProcessingForm()));
            }

            FlaUI.Core.AutomationElements.AutomationElement hoveredElement = AutomationService.GetHoveredElement();
            try
            {
                if (_currentlyProcessingAction.CurrentAction.ControlType == "" || hoveredElement == null ||
                    hoveredElement.ControlType.ToString() != _currentlyProcessingAction.CurrentAction.ControlType)
                {
                    return;
                }

                if (_appSettings.Value.CheckControlName && hoveredElement.Name != _currentlyProcessingAction.CurrentAction.ControlName)
                {
                    return;
                }

                ElementHighlighterService.HighlightElement(hoveredElement, Color.BlueViolet);
                ExecuteMouseClick(_currentlyProcessingAction.CurrentAction);
            }
            catch (PropertyNotSupportedException)
            {
                //hoveredElement is not supported
            }
        }
Esempio n. 2
0
 public static AutomationElement HighlightMouseClickedElement()
 {
     ElementHighlighterService.HighlightElement(CurrentHoveredElement);
     return(CurrentHoveredElement);
 }