private Window ModalWindow(Clock.Do find, InitializeOption option, WindowSession windowSession) { var clock = new Clock(CoreAppXmlConfiguration.Instance.BusyTimeout); Clock.Matched matched = obj => obj != null; Clock.Expired expired = () => null; var automationElement = (AutomationElement) clock.Perform(find, matched, expired); return automationElement == null ? null: Create(automationElement, option, windowSession); }
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); }
public static ToolTip FindToolTip(Clock.Do perform) { var clock = new Clock(CoreAppXmlConfiguration.Instance.TooltipWaitTime); Clock.Matched matched = obj => obj != null; Clock.Expired expired = () => null; var automationElement = (AutomationElement) clock.Perform(perform, matched, expired); return automationElement == null ? null : new ToolTip(automationElement, new NullActionListener()); }
internal virtual void MakeVisible(VerticalSpanProvider verticalSpanProvider) { if (verticalScroll == null) { WhiteLogger.Instance.DebugFormat("Vertical scrollbar not present in parent of {0}", uiItem); return; } if (!verticalScroll.IsScrollable) { WhiteLogger.Instance.DebugFormat("Vertical scrollbar is not scrollable for parent of {0}", uiItem); return; } VerticalSpan verticalSpan = verticalSpanProvider.VerticalSpan; if (verticalScroll.IsNotMinimum) { verticalScroll.SetToMinimum(); verticalSpan = verticalSpanProvider.VerticalSpan; WhiteLogger.Instance.DebugFormat("Scroll Position set to minimum value."); } if (verticalSpan.Contains(uiItem.Bounds)) { WhiteLogger.Instance.DebugFormat("UIItem ({0}) whose bounds are ({1}) is within bounds of parent whose vertical span is {2}", uiItem, uiItem.Bounds, verticalSpan); return; } WhiteLogger.Instance.DebugFormat("Trying to make visible {0}, item's bounds are {1} and parent's span is {2}", uiItem, uiItem.Bounds, verticalSpan); var clock = new Clock(CoreAppXmlConfiguration.Instance.BusyTimeout, 0); clock.RunWhile(() => verticalScroll.ScrollDownLarge(), delegate { Rect bounds = uiItem.Bounds; WhiteLogger.Instance.DebugFormat( "Trying to make visible {0}, item's bounds are {1} and parent's span is {2}", uiItem, bounds, verticalSpan); return verticalSpan.DoesntContain(bounds); }, delegate { throw new UIActionException(string.Format("Could not make the {0} visible{1}", uiItem, Constants.BusyMessage)); }); }
public virtual void SetToMinimum() { var clock = new Clock(CoreAppXmlConfiguration.Instance.BusyTimeout, 0); clock.RunWhile(() => BackLargeChangeButton.PerformClick(), () => Value > 0, delegate { throw new UIActionException(string.Format("Could not set the ScrollBar to minimum visible{0}", Constants.BusyMessage)); }); WhiteLogger.Instance.DebugFormat("ScrollBar position set to {0}", Value); }
private bool TryGetPopupMenu(AutomationSearchCondition[] searchConditions, ActionListener actionListener, out PopUpMenu popUpMenu) { var clock = new Clock(CoreAppXmlConfiguration.Instance.PopupTimeout, 100); Clock.Do @do = () => finder.Child(searchConditions); Clock.Matched matched = obj => obj != null; var element = (AutomationElement) clock.Perform(@do, matched, () => null); if (element == null) { popUpMenu = null; return false; } popUpMenu = new PopUpMenu(element, actionListener); return true; }