Description of ControlSearcherTemplateData.
Inheritance: SearcherTemplateData
Esempio n. 1
0
        public virtual List <IUiElement> GetElements(ControlSearcherTemplateData data)
        {
            ResultCollection = new List <IUiElement>();

            SingleControlSearcherData controlSearcherData = null;

            if (null != data)
            {
                controlSearcherData = data.ConvertControlSearcherTemplateDataToSingleControlSearcherData();
                SearchData          = data;
            }
            if (null == controlSearcherData)
            {
                controlSearcherData = SearchData.ConvertControlSearcherTemplateDataToSingleControlSearcherData();
            }
            if (null == controlSearcherData)
            {
                return(ResultCollection);
            }

            if (!string.IsNullOrEmpty(controlSearcherData.ContainsText))
            {
                controlSearcherData.Name = controlSearcherData.Value = controlSearcherData.ContainsText;
            }

            ResultCollection = FilterElements(controlSearcherData, LoadElements(controlSearcherData));

            return(ResultCollection);
        }
Esempio n. 2
0
 public static List<IUiElement> Win32Gateway_GetElements_NullControlSearcherDataInput(
     IUiElement rootElement,
     IUiElement[] elements,
     IEnumerable<int> handles,
     string searchString)
 {
     var controlProvider = new ControlFromWin32Provider();
     var controlSearcherData = new ControlSearcherTemplateData {
         ContainsText = searchString,
         Name = searchString,
         Win32 = true,
         InputObject = new IUiElement[] { rootElement }
     };
     controlProvider.SearchData = controlSearcherData;
     
     var handleCollector = FakeFactory.GetHandleCollector(rootElement, handles, elements);
     controlProvider.HandleCollector = handleCollector;
     
     List<IUiElement> resultList =
         controlProvider.GetElements(
             null);
     
     return resultList;
 }
Esempio n. 3
0
        // not used
//        internal static SingleControlSearcherData ConvertControlSearcherDataToSingleControlSearcherData(this ControlSearcherData data)
//        {
//            return new SingleControlSearcherData {
//                InputObject = (null == data.InputObject ? null : (data.InputObject[0] ?? null)),
//                Name = data.Name,
//                AutomationId = data.AutomationId,
//                Class = data.Class,
//                Value = data.Value,
//                ControlType = data.ControlType,
//                ContainsText = data.ContainsText,
//                Win32 = data.Win32,
//                CaseSensitive = data.CaseSensitive,
//                Regex = data.Regex,
//                SearchCriteria = data.SearchCriteria
//            };
//        }

        internal static SingleControlSearcherData ConvertControlSearcherTemplateDataToSingleControlSearcherData(this ControlSearcherTemplateData data)
        {
            return(new SingleControlSearcherData {
                InputObject = (null == data.InputObject ? null : (data.InputObject[0] ?? null)),
                Name = data.Name,
                AutomationId = data.AutomationId,
                Class = data.Class,
                Value = data.Value,
                ControlType = data.ControlType,
                ContainsText = data.ContainsText,
                Win32 = data.Win32,
                CaseSensitive = data.CaseSensitive,
                Regex = data.Regex,
                SearchCriteria = data.SearchCriteria
            });
        }