/// <summary> /// Find *multiple* UIItems based on SearchCriteria /// </summary> /// <param name="searchCriteria">UIItem identification conditions</param> /// <param name="scope">Scope of search</param> /// <param name="timeout">Timeout value for search (milliseconds)</param> /// <returns>Matching UIItems</returns> protected static IUIItem[] FindUIItems( SearchCriteria searchCriteria, UIItem scope, int timeout) { if (timeout > 0) { WhiteConfigHelper.OriginalFindUIItemTimeout = timeout; } if (scope == null) { scope = WorkSpace.MainWindow.Window; } Report.Output( Report.Level.Debug, Resources.UIItemMultipleFindUsingSearchCriteriaMsg, searchCriteria.ToString(), typeof(T).ToString(), scope.PrimaryIdentification); IUIItem[] matchingUIItems = null; var stopwatch = new Stopwatch(); var elapsedTime = new TimeSpan(); try { stopwatch.Start(); matchingUIItems = scope.GetMultiple(searchCriteria); elapsedTime = stopwatch.Elapsed; Report.Output( Report.Level.Debug, Resources.UIItemMultipleFoundMsg, matchingUIItems.Length.ToString(), elapsedTime); } catch (AutomationException ex) { elapsedTime = stopwatch.Elapsed; Report.Output( Report.Level.Debug, Resources.UIItemMultipleNotFoundMsg, elapsedTime, ex.Message); } finally { stopwatch.Stop(); if (timeout > 0) { WhiteConfigHelper.ResetFindUIItemTimeout(); } } return(matchingUIItems); }