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); }
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>()); }
internal static AutomationElement FindFirst(AutomationElement parent, TreeScope scope, UIAComWrapper.Condition condition) { return(FindFirst(parent, scope, condition, CruciatusFactory.Settings.SearchTimeout)); }