Esempio n. 1
0
 public ScrollBars(AutomationElement automationElement, ActionListener actionListener,
     ScrollBarButtonAutomationIds hScrollBarButtonAutomationIds, ScrollBarButtonAutomationIds vScrollBarButtonAutomationIds) {
     this.actionListener = actionListener;
     this.hScrollBarButtonAutomationIds = hScrollBarButtonAutomationIds;
     this.vScrollBarButtonAutomationIds = vScrollBarButtonAutomationIds;
     finder = new AutomationElementFinder(automationElement);
 }
Esempio n. 2
0
 public UIItem(AutomationElement automationElement, ActionListener actionListener)
 {
     if (null == automationElement) throw new NullReferenceException();
     this.automationElement = automationElement;
     this.actionListener = actionListener;
     factory = new PrimaryUIItemFactory(new AutomationElementFinder(automationElement));
 }
 public void addActionListener(ActionListener actionListener)
 {
     lock (actionListeners)
     {
         actionListeners.Add(actionListener);
     }
 }
Esempio n. 4
0
 private IUIItem Create(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, ActionListener actionListener)
 {
     IUIItem item = containerItemFactory.Get(searchCriteria, actionListener);
     if (item == null) return null;
     windowItemsMap.Add(item.Location, searchCriteria);
     return item;
 }
Esempio n. 5
0
 protected ScrollBar(AutomationElement automationElement, ActionListener actionListener, ScrollBarButtonAutomationIds automationIds)
     : base(automationElement, actionListener)
 {
     this.automationIds = automationIds;
     var finder = new AutomationElementFinder(automationElement);
     primaryUIItemFactory = new PrimaryUIItemFactory(finder);
 }
 private ToolTip GetToolTip(UIItem uiItem, ActionListener actionListener)
 {
     mouse.Click(uiItem.Bounds.Center());
     actionListener.ActionPerformed(Action.WindowMessage);
     Thread.Sleep(CoreAppXmlConfiguration.Instance.TooltipWaitTime);
     return ToolTip.GetFrom(uiItem.Bounds.Center());
 }
        private static SuggestionList WaitTill(ActionListener actionListener, string failureMessage, Clock.Matched matched)
        {
            Clock.Do getSuggestionList = () => Find(actionListener);
            Clock.Expired onExpiration = delegate { throw new UIActionException(failureMessage + Constants.BusyMessage); };

            return
                (SuggestionList) new Clock(CoreAppXmlConfiguration.Instance.SuggestionListTimeout).Perform(getSuggestionList, matched, onExpiration);
        }
 internal static IScrollBars CreateBars(AutomationElement parentElement, ActionListener listener)
 {
     var frameworkId = parentElement.Current.FrameworkId;
     if (frameworkId == Constants.WPFFrameworkId)
         return new WPFScrollBars(parentElement, listener);
     if (frameworkId == Constants.SilverlightFrameworkId)
         return new ScrollBars(parentElement, listener, new SilverlightHScrollBarButtonAutomationIds(), new SilverlightVScrollBarButtonAutomationIds());
     return new ScrollBars(parentElement, listener, new DefaultScrollBarButtonAutomationIds(), new DefaultScrollBarButtonAutomationIds());
 }
Esempio n. 9
0
 public virtual IUIItem Create(SearchCriteria searchCriteria, ActionListener actionListener)
 {
     if (searchCriteria.IsIndexed)
     {
         UIItemCollection collection = CreateAll(searchCriteria, actionListener);
         return searchCriteria.IndexedItem(collection);
     }
     return dictionaryMappedItemFactory.Create(Finder.Descendant(searchCriteria.AutomationCondition), actionListener,
                                               searchCriteria.CustomItemType);
 }
Esempio n. 10
0
 public virtual IUIItem Get(SearchCriteria searchCriteria, ActionListener uiItemActionListener)
 {
     IUIItem item = Find(searchCriteria);
     if (item == null || item is UIItemContainer)
     {
         //Cannot create dynamic proxy for class which has methods using generics. Also its not required to intercept methods on UIItem containers
         return item;
     }
     return UIItemProxyFactory.Create(item, uiItemActionListener);
 }
Esempio n. 11
0
 private static SuggestionList WaitTill(ActionListener actionListener, string failureMessage, Predicate<SuggestionList> shouldRetry)
 {
     try
     {
         return Retry.For(() => Find(actionListener), shouldRetry, CoreAppXmlConfiguration.Instance.SuggestionListTimeout);
     }
     catch (Exception ex)
     {
         throw new UIActionException(failureMessage + Constants.BusyMessage, ex);
     }
 }
Esempio n. 12
0
 private bool TryGetPopupMenu(AutomationSearchCondition[] searchConditions, ActionListener actionListener, out PopUpMenu popUpMenu)
 {
     var element = Retry.For(() => Finder.Child(searchConditions), CoreAppXmlConfiguration.Instance.PopupTimeout(), TimeSpan.FromMilliseconds(100));
     if (element == null)
     {
         popUpMenu = null;
         return false;
     }
     popUpMenu = new PopUpMenu(element, actionListener);
     return true;
 }
Esempio n. 13
0
 public virtual PopUpMenu WPFPopupMenu(ActionListener actionListener)
 {
     var searchConditions = new[]
                                {
                                    AutomationSearchCondition.ByControlType(ControlType.Window),
                                    AutomationSearchCondition.ByControlType(ControlType.Menu)
                                };
     PopUpMenu popUpMenu;
     TryGetPopupMenu(searchConditions, actionListener, out popUpMenu);
     return popUpMenu;
 }
Esempio n. 14
0
 public TableScrollBars(AutomationElementFinder finder, ActionListener actionListener, TableVerticalScrollOffset tableVerticalScrollOffset)
 {
     AutomationElement verticalScrollElement = finder.Child(AutomationSearchCondition.ByControlType(ControlType.Pane).OfName(UIItemIdAppXmlConfiguration.Instance.TableVerticalScrollBar));
     verticalScrollBar = (verticalScrollElement == null)
                             ? (IVScrollBar) new NullVScrollBar()
                             : new TableVerticalScrollBar(verticalScrollElement, actionListener, tableVerticalScrollOffset);
     AutomationElement horizontalScrollElement = finder.Child(AutomationSearchCondition.ByControlType(ControlType.Pane).OfName(UIItemIdAppXmlConfiguration.Instance.TableHorizontalScrollBar));
     horizontalScrollBar = (horizontalScrollElement == null)
                               ? (IHScrollBar) new NullHScrollBar()
                               : new TableHorizontalScrollBar(horizontalScrollElement, actionListener);
 }
        private static SuggestionList Find(ActionListener actionListener)
        {
            AutomationElement dropDown =
                new AutomationElementFinder(AutomationElement.RootElement).Child(AutomationSearchCondition.ByClassName("Auto-Suggest Dropdown"));
            if (dropDown == null) return null;

            AutomationElement listViewElement =
                new AutomationElementFinder(dropDown).Child(AutomationSearchCondition.ByControlType(ControlType.DataGrid));
            if (listViewElement == null) return null;
            return new ListView(listViewElement, actionListener);
        }
 public virtual void DoubleClickOutsideToolTip(UIItem uiItem, ActionListener actionListener)
 {
     actionListener.ActionPerforming(uiItem);
     ToolTip toolTip = GetToolTip(uiItem, actionListener);
     if (toolTip == null)
         mouse.DoubleClick(uiItem.Bounds.Center(), actionListener);
     else
     {
         WhiteLogger.Instance.Debug("Found tooltip DoubleClicking outside tooltip bounds");
         mouse.DoubleClick(toolTip.LeftOutside(uiItem.Bounds), actionListener);
     }
 }
Esempio n. 17
0
        public virtual UIItemCollection ItemsWithin(Rect bounds, ActionListener actionListener)
        {
            var collection = new UIItemCollection();
            List<AutomationElement> descendants = Finder.Descendants(AutomationSearchCondition.All);
            foreach (AutomationElement automationElement in descendants)
            {
                if (!bounds.Contains(automationElement.Current.BoundingRectangle)) continue;

                var factory = new DictionaryMappedItemFactory();
                collection.Add(factory.Create(automationElement, actionListener));
            }
            return collection;
        }
 public virtual void RightClickOutsideToolTip(UIItem uiItem, ActionListener actionListener)
 {
     actionListener.ActionPerforming(uiItem);
     ToolTip toolTip = GetToolTip(uiItem, actionListener);
     if (toolTip == null)
     {
         //Because mouse has already been moved
         mouse.RightClickHere(actionListener);
     }
     else
     {
         WhiteLogger.Instance.Debug("Found tooltip RightClicking outside tooltip bounds");
         mouse.RightClick(toolTip.LeftOutside(uiItem.Bounds), actionListener);
     }
 }
Esempio n. 19
0
    /*public Player owner {
        get {
            if(mFlockUnit != null) {
                int index = Player.GroupToIndex(mFlockUnit.type);
                if(index >= 0 && index < Player.playerCount) {
                    return Player.GetPlayer(index);
                }
            }

            return null;
        }
    }*/
    protected override void Awake()
    {
        base.Awake();

        mFlockUnit = GetComponentInChildren<FlockUnit>();
        mListener = GetComponentInChildren<ActionListener>();

        if(mFlockUnit != null) {
            mFlockUnit.groupMoveEnabled = false;
        }

        if(mListener != null) {
            mListener.enterCallback += OnActionEnter;
            mListener.hitEnterCallback += OnActionHitEnter;
            mListener.hitExitCallback += OnActionHitExit;
            mListener.finishCallback += OnActionFinish;
        }
    }
Esempio n. 20
0
        public virtual IUIItem Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, ActionListener actionListener)
        {
            logger.DebugFormat("Finding item based on criteria: ({0}) on ({1})", searchCriteria, initializeOption.Identifier);
            Point location = windowItemsMap.GetItemLocation(searchCriteria);
            if (location.Equals(RectX.UnlikelyWindowPosition))
            {
                logger.Debug("[PositionBasedSearch] Could not find based on position, finding using search.");
                return Create(containerItemFactory, searchCriteria, actionListener);
            }

            AutomationElement automationElement = AutomationElementX.GetAutomationElementFromPoint(location);
            if (automationElement != null && searchCriteria.AppliesTo(automationElement))
            {
                IUIItem item = new DictionaryMappedItemFactory().Create(automationElement, actionListener, searchCriteria.CustomItemType);
                return UIItemProxyFactory.Create(item, actionListener);
            }

            logger.DebugFormat("[PositionBasedSearch] UIItem {0} changed its position, finding using search.", searchCriteria);
            return Create(containerItemFactory, searchCriteria, actionListener);
        }
Esempio n. 21
0
        public virtual void Send(string keysToType, ActionListener actionListener)
        {
            if (heldKeys.Count > 0) keysToType = keysToType.ToLower();

            CapsLockOn = false;
            foreach (char c in keysToType)
            {
                short key = VkKeyScan(c);
                if (c.Equals('\r')) continue;

                if (ShiftKeyIsNeeded(key)) SendKeyDown((short) KeyboardInput.SpecialKeys.SHIFT, false);
                if (CtrlKeyIsNeeded(key)) SendKeyDown((short) KeyboardInput.SpecialKeys.CONTROL, false);
                if (AltKeyIsNeeded(key)) SendKeyDown((short) KeyboardInput.SpecialKeys.ALT, false);
                Press(key, false);
                if (ShiftKeyIsNeeded(key)) SendKeyUp((short) KeyboardInput.SpecialKeys.SHIFT, false);
                if (CtrlKeyIsNeeded(key)) SendKeyUp((short) KeyboardInput.SpecialKeys.CONTROL, false);
                if (AltKeyIsNeeded(key)) SendKeyUp((short) KeyboardInput.SpecialKeys.ALT, false);
            }

            actionListener.ActionPerformed(Action.WindowMessage);
        }
Esempio n. 22
0
 internal virtual void HoldKey(KeyboardInput.SpecialKeys key, ActionListener actionListener)
 {
     SendKeyDown((short)key, true);
     heldKeys.Add(key);
     actionListener.ActionPerformed(Action.WindowMessage);
 }
Esempio n. 23
0
 public Tree(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
     finder = new AutomationElementFinder(automationElement);
 }
Esempio n. 24
0
 public TableHorizontalScrollBar(AutomationElement automationElement, ActionListener actionListener)
 {
 }
Esempio n. 25
0
 public virtual void PressSpecialKey(KeyboardInput.SpecialKeys key, ActionListener actionListener)
 {
     Send(key, true);
     actionListener.ActionPerformed(Action.WindowMessage);
 }
Esempio n. 26
0
 private static void ActionPerformed(ActionListener actionListener)
 {
     actionListener.ActionPerformed(new Action(ActionType.WindowMessage));
 }
Esempio n. 27
0
 internal virtual void RightClickHere(ActionListener actionListener)
 {
     RightClick();
     actionListener.ActionPerformed(Action.WindowMessage);
 }
Esempio n. 28
0
 public WPFStatusBar(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener) {}
Esempio n. 29
0
 public SilverlightDocument(AutomationElement automationElement, ActionListener actionListener,
                            InitializeOption initializeOption,
                            WindowSession windowSession)
     : base(automationElement, actionListener, initializeOption, windowSession)
 {
 }
Esempio n. 30
0
 private static void ActionPerformed(ActionListener actionListener)
 {
     actionListener.ActionPerformed(new Action(ActionType.WindowMessage));
 }
 public virtual IUIItem Create(AutomationElement automationElement, ActionListener actionListener)
 {
     return new TableHeader(automationElement, actionListener);
 }
Esempio n. 32
0
 public DateTimePicker(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Esempio n. 33
0
 /// <summary>
 /// Creates a <code>Timer</code> that will notify its listeners every
 /// <code>delay</code> milliseconds.
 /// </summary>
 public Timer(int @delay, ActionListener @listener)
 {
 }
Esempio n. 34
0
 /// <summary>
 /// Removes the specified action listener from the <code>Timer</code>.
 /// </summary>
 public void removeActionListener(ActionListener @listener)
 {
 }
Esempio n. 35
0
 public SelectionItem(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Esempio n. 36
0
 public WPFComboBox(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
 }
Esempio n. 37
0
 public SilverlightDocument(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
 }
Esempio n. 38
0
 public RadioButton(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Esempio n. 39
0
 public PopUpMenu(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
     this.actionListener = actionListener;
 }
Esempio n. 40
0
 public WinFormScrollBars(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener, new DefaultScrollBarButtonAutomationIds(), new DefaultScrollBarButtonAutomationIds())
 {
 }
Esempio n. 41
0
 public virtual void Click(Point point, ActionListener actionListener)
 {
     Location = point;
     Click();
     ActionPerformed(actionListener);
 }
Esempio n. 42
0
 public WPFTreeNode(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Esempio n. 43
0
 public virtual void RightClick(Point point, ActionListener actionListener)
 {
     Location = point;
     RightClickHere(actionListener);
 }
 public TextBox(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
 }
Esempio n. 45
0
 public Button(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
     toggleableItem = new ToggleableItem(this);
 }
Esempio n. 46
0
 public ListItems(List <AutomationElement> collection, ActionListener actionListener) : base(collection, actionListener)
 {
     this.actionListener = actionListener;
 }
Esempio n. 47
0
 public virtual void LeaveKey(KeyboardInput.SpecialKeys key, ActionListener actionListener)
 {
     SendKeyUp((short)key, true);
     heldKeys.Remove(key);
     actionListener.ActionPerformed(Action.WindowMessage);
 }
Esempio n. 48
0
 public TableColumn(AutomationElement automationElement, ActionListener actionListener, int index) : base(automationElement, actionListener)
 {
     this.index = index;
 }
Esempio n. 49
0
 /// <summary>
 /// Adds an action listener to the <code>Timer</code>.
 /// </summary>
 public void addActionListener(ActionListener @listener)
 {
 }
Esempio n. 50
0
 protected Slider(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
     uiItemContainer = new UIItemContainer(automationElement, actionListener, InitializeOption.NoCache, new NullWindowSession());
 }
Esempio n. 51
0
 internal virtual void RightClickHere(ActionListener actionListener)
 {
     RightClick();
     actionListener.ActionPerformed(Action.WindowMessage);
 }
Esempio n. 52
0
 public WpfVScrollBar(AutomationElement parent, ActionListener actionListener) : base(parent)
 {
     this.actionListener = actionListener;
 }
Esempio n. 53
0
 public WpfVScrollBar(AutomationElement parent, ActionListener actionListener) : base(parent)
 {
     this.actionListener = actionListener;
 }
Esempio n. 54
0
 public TitleBar(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
     automationElementFinder = new AutomationElementFinder(automationElement);
 }
 public TableVerticalScrollBar(AutomationElement automationElement, ActionListener actionListener, TableVerticalScrollOffset offset)
     : base(automationElement, actionListener)
 {
     this.offset = offset;
 }
        public virtual TableRows CreateRows(ActionListener actionListener, TableHeader tableHeader)
        {
            List <AutomationElement> rowElements = GetRowElements();

            return(new TableRows(rowElements, actionListener, tableHeader, new TableCellFactory(automationElementFinder.AutomationElement, actionListener)));
        }
Esempio n. 57
0
 public TextBox(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
 }
Esempio n. 58
0
 public ListViewCells(List <AutomationElement> collection, ActionListener actionListener, ListViewHeader header)
     : base(collection, new ListViewCellFactory(), actionListener)
 {
     this.header = header;
 }
Esempio n. 59
0
 public WpfDatePicker(AutomationElement automationElement, ActionListener actionListener)
     : base(automationElement, actionListener)
 {
 }
Esempio n. 60
0
 protected CustomUIItem(AutomationElement automationElement, ActionListener actionListener) : base(automationElement, actionListener)
 {
 }