예제 #1
0
        internal static AutomationElement FindFirst(
            AutomationElement parent,
            TreeScope scope,
            UIAComWrapper.Condition condition,
            int timeout)
        {
            var dtn = DateTime.Now.AddMilliseconds(timeout);

            // ReSharper disable once LoopVariableIsNeverChangedInsideLoop
            while (DateTime.Now <= dtn)
            {
                var element = parent.FindFirst(scope, condition);
                if (element != null)
                {
                    return(element);
                }
            }

            return(null);
        }
예제 #2
0
        internal static IEnumerable <AutomationElement> FindAll(
            AutomationElement parent,
            TreeScope scope,
            UIAComWrapper.Condition condition,
            int timeout)
        {
            var dtn = DateTime.Now.AddMilliseconds(timeout);

            // ReSharper disable once LoopVariableIsNeverChangedInsideLoop
            while (DateTime.Now <= dtn)
            {
                var elements = parent.FindAll(scope, condition);
                if (elements.Count > 0)
                {
                    return(elements.Cast <AutomationElement>());
                }
            }

            return(Enumerable.Empty <AutomationElement>());
        }
예제 #3
0
 internal static AutomationElement FindFirst(AutomationElement parent, TreeScope scope, UIAComWrapper.Condition condition)
 {
     return(FindFirst(parent, scope, condition, CruciatusFactory.Settings.SearchTimeout));
 }