Ejemplo n.º 1
0
        /// <inheritdoc />
        public override AutomationElement FindFirst(TreeScope treeScope, ConditionBase condition)
        {
            var nativeFoundElement = CacheRequest.IsCachingActive
                ? NativeElement.FindFirstBuildCache((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition), CacheRequest.Current.ToNative(Automation))
                : NativeElement.FindFirst((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition));

            return(AutomationElementConverter.NativeToManaged(Automation, nativeFoundElement));
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public override AutomationElement FindIndexed(TreeScope treeScope, int index, ConditionBase condition)
        {
            var nativeFoundElements = CacheRequest.IsCachingActive
                ? NativeElement.FindAllBuildCache((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition), CacheRequest.Current.ToNative(Automation))
                : NativeElement.FindAll((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition));
            var nativeElement = nativeFoundElements.GetElement(index);

            return(nativeElement == null ? null : AutomationElementConverter.NativeToManaged(Automation, nativeElement));
        }
Ejemplo n.º 3
0
        /// <inheritdoc />
        public override AutomationElement FindFirstWithOptions(TreeScope treeScope, ConditionBase condition,
                                                               TreeTraversalOptions traversalOptions, AutomationElement root)
        {
            var nativeFoundElement = CacheRequest.IsCachingActive
                ? NativeElement7.FindFirstWithOptionsBuildCache((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition), CacheRequest.Current.ToNative(Automation), (UIA.TreeTraversalOptions)traversalOptions, root.ToNative())
                : NativeElement7.FindFirstWithOptions((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition), (UIA.TreeTraversalOptions)traversalOptions, root.ToNative());

            return(AutomationElementConverter.NativeToManaged(Automation, nativeFoundElement));
        }
Ejemplo n.º 4
0
            private LinqQueryExpression <Flat_Entity> Convert(ExpressionConversionVisitor <Flat_Entity> converter, Expression <Func <Flat_Entity, bool> > expr)
            {
                var conditionConverter = new ConditionConverter <Flat_Entity>(
                    converter.DataModel,
                    converter.TableIdentifier
                    );
                var converted = conditionConverter.ConvertClause(expr);

                return(new LinqQueryExpression <Flat_Entity>(
                           converted.QueryExpression, converted.Joins
                           ));
            }
Ejemplo n.º 5
0
        public override DataTemplate SelectTemplate(object item, DependencyObject container)
        {
            object conditionValue = ConditionConverter.Convert(item, null, null, null);

            foreach (ConditionalDataTemplateRule rule in Rules)
            {
                if (Equals(rule.Value, conditionValue))
                {
                    return(rule.DataTemplate);
                }
            }

            return(base.SelectTemplate(item, container));
        }
Ejemplo n.º 6
0
        public static UIA.IUIAutomationCacheRequest ToNative(this CacheRequest cacheRequest, UIA3Automation automation)
        {
            var nativeCacheRequest = automation.NativeAutomation.CreateCacheRequest();

            nativeCacheRequest.AutomationElementMode = (UIA.AutomationElementMode)cacheRequest.AutomationElementMode;
            nativeCacheRequest.TreeFilter            = ConditionConverter.ToNative(automation, cacheRequest.TreeFilter);
            nativeCacheRequest.TreeScope             = (UIA.TreeScope)cacheRequest.TreeScope;
            foreach (var pattern in cacheRequest.Patterns)
            {
                nativeCacheRequest.AddPattern(pattern.Id);
            }
            foreach (var property in cacheRequest.Properties)
            {
                nativeCacheRequest.AddProperty(property.Id);
            }
            return(nativeCacheRequest);
        }
Ejemplo n.º 7
0
        public static UIA.CacheRequest ToNative(this CacheRequest cacheRequest)
        {
            var nativeCacheRequest = new UIA.CacheRequest();

            nativeCacheRequest.AutomationElementMode = (UIA.AutomationElementMode)cacheRequest.AutomationElementMode;
            nativeCacheRequest.TreeFilter            = ConditionConverter.ToNative(cacheRequest.TreeFilter);
            nativeCacheRequest.TreeScope             = (UIA.TreeScope)cacheRequest.TreeScope;
            foreach (var pattern in cacheRequest.Patterns)
            {
                nativeCacheRequest.Add(UIA.AutomationPattern.LookupById(pattern.Id));
            }
            foreach (var property in cacheRequest.Properties)
            {
                nativeCacheRequest.Add(UIA.AutomationProperty.LookupById(property.Id));
            }
            return(nativeCacheRequest);
        }
Ejemplo n.º 8
0
        /// <inheritdoc />
        public override SHAutomationElement FindIndexed(TreeScope treeScope, int index, ConditionBase condition)
        {
            var nativeFoundElements = NativeElement.FindAll((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition));
            var nativeElement       = nativeFoundElements.GetElement(index);

            return(nativeElement == null ? null :SHAutomationElementConverter.NativeToManaged(Automation, nativeElement));
        }
Ejemplo n.º 9
0
        /// <inheritdoc />
        public override SHAutomationElement FindFirstWithOptions(TreeScope treeScope, ConditionBase condition,
                                                                 TreeTraversalOption traversalOptions, SHAutomationElement root)
        {
            var nativeFoundElement = NativeElement7.FindFirstWithOptions((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition), (UIA.TreeTraversalOptions)traversalOptions, SHAutomationElementConverter.ToNative(root));

            return(SHAutomationElementConverter.NativeToManaged(Automation, nativeFoundElement));
        }
Ejemplo n.º 10
0
        /// <inheritdoc />
        public override SHAutomationElement FindFirst(TreeScope treeScope, ConditionBase condition)
        {
            var nativeFoundElement = NativeElement.FindFirst((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition));

            return(SHAutomationElementConverter.NativeToManaged(Automation, nativeFoundElement));
        }
Ejemplo n.º 11
0
        /// <inheritdoc />
        public override SHAutomationElement[] FindAll(TreeScope treeScope, ConditionBase condition)
        {
            var nativeFoundElements = NativeElement.FindAll((UIA.TreeScope)treeScope, ConditionConverter.ToNative(Automation, condition));

            return(SHAutomationElementConverter.NativeArrayToManaged(Automation, nativeFoundElements));
        }
Ejemplo n.º 12
0
        /// <inheritdoc />
        public override AutomationElement FindFirst(TreeScope treeScope, ConditionBase condition)
        {
            var cacheRequest = CacheRequest.IsCachingActive ? CacheRequest.Current.ToNative() : null;

            cacheRequest?.Push();
            var nativeFoundElement = NativeElement.FindFirst((UIA.TreeScope)treeScope, ConditionConverter.ToNative(condition));

            cacheRequest?.Pop();
            return(AutomationElementConverter.NativeToManaged(Automation, nativeFoundElement));
        }
Ejemplo n.º 13
0
        /// <inheritdoc />
        public override AutomationElement FindIndexed(TreeScope treeScope, int index, ConditionBase condition)
        {
            var cacheRequest = CacheRequest.IsCachingActive ? CacheRequest.Current.ToNative() : null;

            cacheRequest?.Push();
            var nativeFoundElements = NativeElement.FindAll((UIA.TreeScope)treeScope, ConditionConverter.ToNative(condition));

            cacheRequest?.Pop();
            var nativeElement = nativeFoundElements.Count > index ? nativeFoundElements[index] : null;

            return(nativeElement == null ? null : AutomationElementConverter.NativeToManaged(Automation, nativeElement));
        }