コード例 #1
0
            public                    IUiElement[] GetSelection()
            {
                // 20140302
                // AutomationElement[] nativeElements = (AutomationElement[])this._selectionPattern.GetParentElement().GetPatternPropertyValue(SelectionPattern.SelectionProperty, this._useCache);
                var nativeElements = (classic.AutomationElement[])_selectionPattern.GetParentElement().GetPatternPropertyValue(classic.SelectionPattern.SelectionProperty, _useCache);
                IUiEltCollection tempCollection = AutomationFactory.GetUiEltCollection(nativeElements);

                if (null == tempCollection || 0 == tempCollection.Count)
                {
                    return(new UiElement[] {});
                }
                else
                {
                    return(tempCollection.Cast <IUiElement>().ToArray <IUiElement>());
                }
            }
コード例 #2
0
            public                             IUiElement[] GetColumnHeaderItems()
            {
                // return (AutomationElement[])this._el.GetPatternPropertyValue(TableItemPattern.ColumnHeaderItemsProperty, this._useCache);
                // 20140302
                // AutomationElement[] nativeElements = (AutomationElement[])this._tableItemPattern.GetParentElement().GetPatternPropertyValue(TableItemPattern.ColumnHeaderItemsProperty, this._useCache);
                var nativeElements = (classic.AutomationElement[])_tableItemPattern.GetParentElement().GetPatternPropertyValue(classic.TableItemPattern.ColumnHeaderItemsProperty, _useCache);
                IUiEltCollection tempCollection = AutomationFactory.GetUiEltCollection(nativeElements);

                if (null == tempCollection || 0 == tempCollection.Count)
                {
                    return(new UiElement[] {});
                }
                else
                {
                    return(tempCollection.Cast <IUiElement>().ToArray());
                }
            }
コード例 #3
0
        public virtual IUiEltCollection FindAll(classic.TreeScope scope, UIANET.System.Windows.Automation.Condition condition)
        {
            switch (_innerElementType)
            {
            case InnerElementTypes.AutomationElementNet:
                return(AutomationFactory.GetUiEltCollection(_elementHolderNet.FindAll(scope, condition)));

//                case InnerElementTypes.AutomationElementCom:
//                    //
            case InnerElementTypes.UiElement:
                return(_elementHolderAdapter.FindAll(scope, condition));

            default:
//                case InnerElementTypes.Empty:
//                    return AutomationFactory.GetUiEltCollection(_elementHolderNet.FindAll(scope, condition));
                return(AutomationFactory.GetUiEltCollection(_elementHolderNet.FindAll(scope, condition)));
            }
        }
コード例 #4
0
        internal static IUiEltCollection PerformFindAll(this IExtendedModelHolder holder, classic.ControlType controlType)
        {
            try {
                var controlSearcherData =
                    new ControlSearcherData {
                    ControlType = controlType.ConvertControlTypeToStringArray(),
                    InputObject = new IUiElement[] { holder.GetParentElement() }
                };

                var controlSearcher =
                    AutomationFactory.GetSearcherImpl <ControlSearcher>();

                return(AutomationFactory.GetUiEltCollection(
                           controlSearcher.GetElements(
                               controlSearcherData,
                               holder.Seconds)));
            } catch (Exception) {
                return(new UiEltCollection(true));
            }
        }
コード例 #5
0
        public virtual IUiEltCollection this[string infoString]
        {
            get
            {
                if (string.IsNullOrEmpty(infoString))
                {
                    return(null);
                }

                try {
                    if (null == this || 0 == Count)
                    {
                        return(null);
                    }

                    const WildcardOptions options = WildcardOptions.IgnoreCase |
                                                    WildcardOptions.Compiled;

                    var wildcardInfoString =
                        new WildcardPattern(infoString, options);

                    var queryByStringData = from collectionItem
                                            in _collectionHolder //.ToArray()
                                            where wildcardInfoString.IsMatch(collectionItem.GetCurrent().Name) ||
                                            wildcardInfoString.IsMatch(collectionItem.GetCurrent().AutomationId) ||
                                            wildcardInfoString.IsMatch(collectionItem.GetCurrent().ClassName)
                                            select collectionItem;

                    return(AutomationFactory.GetUiEltCollection(queryByStringData));
                }
                catch {
                    return(null);
                    // return new IUiElement[] {};
                }
            }
        }