private ToolTip GetToolTip(UIItem uiItem, IActionListener actionListener) { mouse.Click(uiItem.Bounds.Center()); actionListener.ActionPerformed(Action.WindowMessage); Thread.Sleep(CoreAppXmlConfiguration.Instance.TooltipWaitTime); return ToolTip.GetFrom(uiItem.Bounds.Center()); }
public void AddImageDragDropListener(IActionListener listener) { pictureBoxSource.DragDrop += (sender, e) => { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { var data = e.Data.GetData(DataFormats.FileDrop) as string[]; if (data != null && data.Length > 0) { listener.ActionPerformed(sender, new MyDragDropEventArgs<string[]>(data)); } } }; pictureBoxTarget.DragDrop += (sender, e) => { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { var data = e.Data.GetData(DataFormats.FileDrop) as string[]; if (data != null && data.Length > 0) { listener.ActionPerformed(sender, new MyDragDropEventArgs<string[]>(data)); } } }; }
protected ScrollBar(AutomationElement automationElement, IActionListener actionListener, ScrollBarButtonAutomationIds automationIds) : base(automationElement, actionListener) { this.automationIds = automationIds; var finder = new AutomationElementFinder(automationElement); primaryUIItemFactory = new PrimaryUIItemFactory(finder); }
public ScrollBars(AutomationElement automationElement, IActionListener actionListener, ScrollBarButtonAutomationIds hScrollBarButtonAutomationIds, ScrollBarButtonAutomationIds vScrollBarButtonAutomationIds) { this.actionListener = actionListener; this.hScrollBarButtonAutomationIds = hScrollBarButtonAutomationIds; this.vScrollBarButtonAutomationIds = vScrollBarButtonAutomationIds; finder = new AutomationElementFinder(automationElement); }
internal static IScrollBars CreateBars(AutomationElement parentElement, IActionListener listener) { var frameworkId = parentElement.Current.FrameworkId; if (frameworkId == WindowsFramework.Wpf.FrameworkId()) return new WPFScrollBars(parentElement, listener); if (frameworkId == WindowsFramework.Silverlight.FrameworkId()) return new ScrollBars(parentElement, listener, new SilverlightHScrollBarButtonAutomationIds(), new SilverlightVScrollBarButtonAutomationIds()); return new ScrollBars(parentElement, listener, new DefaultScrollBarButtonAutomationIds(), new DefaultScrollBarButtonAutomationIds()); }
public virtual IUIItem Create(SearchCriteria searchCriteria, IActionListener actionListener) { if (searchCriteria.IsIndexed) { UIItemCollection collection = CreateAll(searchCriteria, actionListener); return searchCriteria.IndexedItem(collection); } return dictionaryMappedItemFactory.Create(Finder.Descendant(searchCriteria.AutomationCondition), actionListener, searchCriteria.CustomItemType); }
public virtual IUIItem Get(SearchCriteria searchCriteria, IActionListener 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); }
private static ISuggestionList Find(IActionListener 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 TableScrollBars(AutomationElementFinder finder, IActionListener actionListener, ITableVerticalScrollOffset 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 ISuggestionList WaitTill(IActionListener actionListener, string failureMessage, Predicate<ISuggestionList> shouldRetry) { try { return Retry.For(() => Find(actionListener), shouldRetry, CoreAppXmlConfiguration.Instance.SuggestionListTimeout()); } catch (Exception ex) { throw new UIActionException(failureMessage + Constants.BusyMessage, ex); } }
public virtual void DoubleClickOutsideToolTip(UIItem uiItem, IActionListener actionListener) { actionListener.ActionPerforming(uiItem); ToolTip toolTip = GetToolTip(uiItem, actionListener); if (toolTip == null) mouse.DoubleClick(uiItem.Bounds.Center(), actionListener); else { logger.Debug("Found tooltip DoubleClicking outside tooltip bounds"); mouse.DoubleClick(toolTip.LeftOutside(uiItem.Bounds), actionListener); } }
public virtual UIItemCollection ItemsWithin(Rect bounds, IActionListener 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, IActionListener actionListener) { actionListener.ActionPerforming(uiItem); ToolTip toolTip = GetToolTip(uiItem, actionListener); if (toolTip == null) { //Because mouse has already been moved mouse.Click(MouseButton.Right, actionListener); } else { logger.Debug("Found tooltip RightClicking outside tooltip bounds"); mouse.RightClick(toolTip.LeftOutside(uiItem.Bounds), actionListener); } }
public virtual IUIItem Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, IActionListener 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); }
public ToolTip(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
public TreeNodes(AutomationElementFinder finder, IActionListener actionListener) : base(finder.Children(AutomationSearchCondition.ByControlType(ControlType.TreeItem)), actionListener) { }
public WPFStatusBar(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
public ListViewCells(List <AutomationElement> collection, IActionListener actionListener, ListViewHeader header) : base(collection, new ListViewCellFactory(), actionListener) { this.header = header; }
public Win32ListItem(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
public HScrollBar(AutomationElement automationElement, IActionListener actionListener, ScrollBarButtonAutomationIds automationIds) : base(automationElement, actionListener, automationIds) { }
public RadioButton(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
public void SetAddListener(IActionListener l) { m_addListener = l; }
private IUIItem Create(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, IActionListener actionListener) { IUIItem item = containerItemFactory.Get(searchCriteria, actionListener); if (item == null) { return(null); } windowItemsMap.Add(item.Location, searchCriteria); return(item); }
public virtual IUIItem Get(ContainerItemFactory containerItemFactory, SearchCriteria searchCriteria, IActionListener 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)); }
public WpfTreeViewHScrollBar(AutomationElement parent, IActionListener actionListener) : base(parent) { this.actionListener = actionListener; }
/// <summary> /// Initializes a new instance of the <see cref="UIItemCollection"/> class. /// </summary> /// <param name="automationElements"> /// The automation elements. /// </param> /// <param name="uiItemFactory"> /// The UI Item factory. /// </param> /// <param name="actionListener"> /// The action listener. /// </param> public UIItemCollection(IEnumerable automationElements, IUIItemFactory uiItemFactory, IActionListener actionListener) { foreach (AutomationElement automationElement in automationElements) { var uiItem = uiItemFactory.Create(automationElement, actionListener); if (uiItem != null) { this.Add(uiItem); } } }
/// <summary> /// Initializes a new instance of the <see cref="UIItemCollection"/> class. /// </summary> /// <param name="automationElements"> /// The automation elements. /// </param> /// <param name="actionListener"> /// The action listener. /// </param> public UIItemCollection(IEnumerable automationElements, IActionListener actionListener) : this(automationElements, DictionaryMappedItemFactory, actionListener) { }
private Desktop(AutomationElement automationElement, IActionListener actionListener, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, actionListener, initializeOption, windowSession) { finder = new AutomationElementFinder(automationElement); }
public DateTimePicker(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
public virtual void PressSpecialKey(KeyboardInput.SpecialKeys key, IActionListener actionListener) { Send(key, true); actionListener.ActionPerformed(Action.WindowMessage); }
public static ISuggestionList WaitAndFind(IActionListener actionListener) { return WaitTill(actionListener, "Took too long to find suggestion list", obj => obj == null); }
internal virtual void HoldKey(KeyboardInput.SpecialKeys key, IActionListener actionListener) { SendKeyDown((short)key, true); heldKeys.Add(key); actionListener.ActionPerformed(Action.WindowMessage); }
public UIItemContainer(AutomationElement automationElement, IActionListener actionListener) : this(automationElement, actionListener, InitializeOption.NoCache, new NullWindowSession()) { }
public virtual void LeaveKey(KeyboardInput.SpecialKeys key, IActionListener actionListener) { SendKeyUp((short)key, true); heldKeys.Remove(key); actionListener.ActionPerformed(Action.WindowMessage); }
protected Window(AutomationElement automationElement, IActionListener actionListener, InitializeOption initializeOption, WindowSession windowSession) : base(automationElement, actionListener, initializeOption, windowSession) { InitializeWindow(); minOpenTime = Task.Factory.StartNew(() => Thread.Sleep(500)); }
public ListItems(List <AutomationElement> collection, IActionListener actionListener) : base(collection, actionListener) { this.actionListener = actionListener; }
public WinFormTextBox(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
public Button(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { toggleableItem = new ToggleableItem(this); }
public WinFormScrollBars(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener, new DefaultScrollBarButtonAutomationIds(), new DefaultScrollBarButtonAutomationIds()) { }
public SelectionItem(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
public NonCachedContainerItemFactory(PrimaryUIItemFactory factory, IActionListener actionListener) { this.factory = factory; this.actionListener = actionListener; }
public WPFComboBox(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
protected Slider(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { uiItemContainer = new UIItemContainer(automationElement, actionListener, InitializeOption.NoCache, new NullWindowSession()); }
public ListControl(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { Finder = new AutomationElementFinder(automationElement); }
public WPFListItem(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { finder = new AutomationElementFinder(automationElement); }
public Label(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
protected ContainerStrip(AutomationElement element, IActionListener listener) : base(element, listener, InitializeOption.NoCache, new NullWindowSession()) { }
public static ISuggestionList WaitAndFind(IActionListener actionListener) { return(WaitTill(actionListener, "Took too long to find suggestion list", obj => obj == null)); }
public ProgressBar(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
public TitleBar(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { automationElementFinder = new AutomationElementFinder(automationElement); }
protected TreeNode(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { finder = new AutomationElementFinder(automationElement); }
public TableHorizontalScrollBar(AutomationElement automationElement, IActionListener actionListener) { }
public ComboBox(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { this.actionListener = actionListener; }
internal AttachedMouse(Mouse mouse, IActionListener actionListener) { this.actionListener = actionListener; this.mouse = mouse; }
public SilverlightComboBox(AutomationElement automationElement, IActionListener actionListener) : base(automationElement, actionListener) { }
public TableCellFactory(AutomationElement tableElement, IActionListener actionListener) { this.tableElement = tableElement; this.actionListener = actionListener; }
public NERGUI() { actor = new NERGUI.ActionPerformer(this); }