internal IEnumerable<IUiElement> SearchByWildcardViaWin32( IUiElement inputObject, ControlSearcherData data, HandleCollector handleCollector) { var tempListWin32 = new List<IUiElement>(); if (!string.IsNullOrEmpty(data.Name) || !string.IsNullOrEmpty(data.Value)) { var controlFrom32Provider = AutomationFactory.GetObject<ControlFromWin32Provider>(); var singleControlSearcherData = new SingleControlSearcherData { InputObject = inputObject, Name = data.Name, Value = data.Value, AutomationId = data.AutomationId, Class = data.Class }; controlFrom32Provider.HandleCollector = handleCollector; tempListWin32.AddRange( controlFrom32Provider.GetElements( singleControlSearcherData.ConvertSingleControlSearcherDataToControlSearcherTemplateData())); } var resultList = new List<IUiElement>(); foreach (IUiElement tempElement3 in tempListWin32) { bool goFurther = true; if (null != data.ControlType && 0 < data.ControlType.Length) { // 20140312 // goFurther &= !data.ControlType.Any(controlTypeName => String.Equals(tempElement3.Current.ControlType.ProgrammaticName.Substring(12), controlTypeName, StringComparison.CurrentCultureIgnoreCase)); goFurther &= !data.ControlType.Any(controlTypeName => String.Equals(tempElement3.GetCurrent().ControlType.ProgrammaticName.Substring(12), controlTypeName, StringComparison.CurrentCultureIgnoreCase)); } else { goFurther = false; } if (goFurther) continue; if (null == data.SearchCriteria || 0 == data.SearchCriteria.Length) { resultList.Add(tempElement3); } else { if (!TestControlWithAllSearchCriteria(data.SearchCriteria, tempElement3)) continue; resultList.Add(tempElement3); } } if (null != tempListWin32) { tempListWin32.Clear(); tempListWin32 = null; } return resultList; }
internal IEnumerable <IUiElement> SearchByWildcardViaWin32( IUiElement inputObject, ControlSearcherData data, HandleCollector handleCollector) { var tempListWin32 = new List <IUiElement>(); if (!string.IsNullOrEmpty(data.Name) || !string.IsNullOrEmpty(data.Value)) { var controlFrom32Provider = AutomationFactory.GetObject <ControlFromWin32Provider>(); var singleControlSearcherData = new SingleControlSearcherData { InputObject = inputObject, Name = data.Name, Value = data.Value, AutomationId = data.AutomationId, Class = data.Class }; controlFrom32Provider.HandleCollector = handleCollector; tempListWin32.AddRange( controlFrom32Provider.GetElements( singleControlSearcherData.ConvertSingleControlSearcherDataToControlSearcherTemplateData())); } var resultList = new List <IUiElement>(); foreach (IUiElement tempElement3 in tempListWin32) { bool goFurther = true; if (null != data.ControlType && 0 < data.ControlType.Length) { // 20140312 // goFurther &= !data.ControlType.Any(controlTypeName => String.Equals(tempElement3.Current.ControlType.ProgrammaticName.Substring(12), controlTypeName, StringComparison.CurrentCultureIgnoreCase)); goFurther &= !data.ControlType.Any(controlTypeName => String.Equals(tempElement3.GetCurrent().ControlType.ProgrammaticName.Substring(12), controlTypeName, StringComparison.CurrentCultureIgnoreCase)); } else { goFurther = false; } if (goFurther) { continue; } if (null == data.SearchCriteria || 0 == data.SearchCriteria.Length) { resultList.Add(tempElement3); } else { if (!TestControlWithAllSearchCriteria(data.SearchCriteria, tempElement3)) { continue; } resultList.Add(tempElement3); } } if (null != tempListWin32) { tempListWin32.Clear(); tempListWin32 = null; } return(resultList); }