Inheritance: AutomationIdentifier
Esempio n. 1
0
		public void RaisePropertyChangedEvent (AutomationPeer peer, 
		                                       AutomationProperty property, 
		                                       object oldValue, 
						       object newValue)
		{
			if (!AccessibilityEnabled || peer == null)
				return;

			if (object.Equals (newValue, oldValue))
				return;

			// We are going to raise changes only when the value ACTUALLY CHANGES
			IAutomationCacheProperty cachedProperty = peer.GetCachedProperty (property);
			if (cachedProperty != null) {
				if (object.Equals (newValue, cachedProperty.OldValue))
					return;
				cachedProperty.OldValue = newValue;
			}

			if (AutomationPropertyChanged != null)
				AutomationPropertyChanged (this, 
				                           new AutomationPropertyChangedEventArgs (peer, 
							                                           property, 
												   oldValue, 
												   newValue));
		}
Esempio n. 2
0
		static GridItemPatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
						"GridItemPatternIdentifiers.Pattern");

			RowProperty =
				new AutomationProperty (RowPropertyId,
						"GridItemPatternIdentifiers.RowProperty");

			ColumnProperty =
				new AutomationProperty (ColumnPropertyId,
						"GridItemPatternIdentifiers.ColumnProperty");

			RowSpanProperty =
				new AutomationProperty (RowSpanPropertyId,
						"GridItemPatternIdentifiers.RowSpanProperty");

			ColumnSpanProperty =
				new AutomationProperty (ColumnSpanPropertyId,
						"GridItemPatternIdentifiers.ColumnSpanProperty");

			ContainingGridProperty =
				new AutomationProperty (ContainingGridPropertyId,
						"GridItemPatternIdentifiers.ContainingGridProperty");
		}
        // Process all the Element Properties
        internal override object GetElementProperty(AutomationProperty idProp)
        {
            if (idProp == AutomationElement.IsOffscreenProperty)
            {
                Rect parentRect = GetParent().BoundingRectangle;
                NativeMethods.Win32Rect itemRect = ListViewCheckBoxRect(_hwnd, _listviewItem);
                if (itemRect.IsEmpty || parentRect.IsEmpty)
                {
                    return true;
                }

                if (Misc.MapWindowPoints(_hwnd, IntPtr.Zero, ref itemRect, 2) && !Misc.IsItemVisible(ref parentRect, ref itemRect))
                {
                    return true;
                }
            }
            // EventManager.DispatchEvent() genericaly uses GetElementProperty()
            // to get properties during a property change event.  Proccess ToggleStateProperty
            // so the ToggleStateProperty Change Event can get the correct state.
            else if (idProp == TogglePattern.ToggleStateProperty)
            {
                return ((IToggleProvider)this).ToggleState;
            }

            return base.GetElementProperty(idProp);
        }
Esempio n. 4
0
        public static IEnumerable<Condition> CreateConditionPathForPropertyValues(AutomationProperty property, 
            IEnumerable<object> values)
        {
            IEnumerable<PropertyCondition> conditions = values.Select(value => new PropertyCondition(property, value));

            return conditions.Cast<Condition>();
        }
Esempio n. 5
0
		static WindowPatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "WindowPatternIdentifiers.Pattern");
			CanMaximizeProperty =
				new AutomationProperty (CanMaximizePropertyId,
				                        "WindowPatternIdentifiers.CanMaximizeProperty");
			CanMinimizeProperty =
				new AutomationProperty (CanMinimizePropertyId,
				                        "WindowPatternIdentifiers.CanMinimizeProperty");
			IsModalProperty =
				new AutomationProperty (IsModalPropertyId,
				                        "WindowPatternIdentifiers.IsModalProperty");
			IsTopmostProperty =
				new AutomationProperty (IsTopmostPropertyId,
				                        "WindowPatternIdentifiers.IsTopmostProperty");
			WindowInteractionStateProperty =
				new AutomationProperty (WindowInteractionStatePropertyId,
				                        "WindowPatternIdentifiers.WindowInteractionStateProperty");
			WindowVisualStateProperty =
				new AutomationProperty (WindowVisualStatePropertyId,
				                        "WindowPatternIdentifiers.WindowVisualStateProperty");
			WindowClosedEvent =
				new AutomationEvent (WindowClosedEventId,
				                     "WindowPatternIdentifiers.WindowClosedProperty");
			WindowOpenedEvent =
				new AutomationEvent (WindowOpenedEventId,
				                     "WindowPatternIdentifiers.WindowOpenedProperty");
		}
 public AutomationElementCollection GetAllChildNodes(AutomationElement element, AutomationProperty automationProperty, object value, TreeScope treeScope)
 {
     var allChildNodes = element.FindAll(treeScope, GetPropertyCondition(automationProperty, value));
     if (allChildNodes == null)
         throw new ElementNotAvailableException("Not able to find the child nodes of the element");
     return allChildNodes;
 }
Esempio n. 7
0
 public void Add(AutomationProperty property)
 {
     lock (this.IUIAutomationCacheRequest) {
         CheckAccess();
         this.IUIAutomationCacheRequest.AddProperty(propertyId: property.Id);
     }
 }
		public AutomationPropertyChangedEventArgs (AutomationProperty property, object oldValue, object newValue) :
            base (AutomationElementIdentifiers.AutomationPropertyChangedEvent)
		{
			Property = property;
			OldValue = oldValue;
			NewValue = newValue;
		}
		protected BaseAutomationPropertyEvent (SimpleControlProvider provider,
		                                       AutomationProperty property)
			: base (provider)
		{
			this.property = property;
			OldValue = Provider.GetPropertyValue (Property.Id);
		}
Esempio n. 10
0
        //------------------------------------------------------
        //
        //  Patterns Implementation
        //
        //------------------------------------------------------

        #region ProxyHwnd Methods

        // ------------------------------------------------------
        //
        // Internal Methods
        //
        // ------------------------------------------------------

        // Advises proxy that an event has been added.
        // Maps the Automation Events into WinEvents and add those to the list of WinEvents notification hooks
        internal virtual void AdviseEventAdded (AutomationEvent eventId, AutomationProperty [] aidProps)
        {
            // No RawElementBase creation callback, exit from here
            if (_createOnEvent == null)
            {
                return;
            }

            int cEvents = 0;
            WinEventTracker.EvtIdProperty [] aEvents;

            // Gets an Array of WinEvents to trap on a per window handle basis
            if (eventId == AutomationElement.AutomationPropertyChangedEvent)
            {
                aEvents = PropertyToWinEvent (aidProps, out cEvents);
            }
            else
            {
                aEvents = EventToWinEvent (eventId, out cEvents);
            }

            // If we have WinEvents to trap, add those to the list of WinEvent
            // notification list
            if (cEvents > 0)
            {
                WinEventTracker.AddToNotificationList (_hwnd, _createOnEvent, aEvents, cEvents);
            }
        }
Esempio n. 11
0
        public AutomationProperty[] GetSupportedProperties()
        {
            int[]    rawPropertyIds;
            string[] rawPropertyNames;
            try
            {
                Automation.Factory.PollForPotentialSupportedProperties(this._obj, out rawPropertyIds, out rawPropertyNames);
            }
            catch (System.Runtime.InteropServices.COMException e)
            {
                Exception newEx; if (Utility.ConvertException(e, out newEx))
                {
                    throw newEx;
                }
                else
                {
                    throw;
                }
            }
            int[] propertyIds = (int[])rawPropertyIds;

            // This element may support properties that are not registered for this
            // client.  Filter them out.
            List <AutomationProperty> properties = new List <AutomationProperty>();

            foreach (int propertyId in propertyIds)
            {
                AutomationProperty property = AutomationProperty.LookupById(propertyId);
                if (property != null)
                {
                    properties.Add(property);
                }
            }
            return(properties.ToArray());
        }
 public AutomationPropertyChangedEventArgs(AutomationProperty property, object oldValue, object newValue) :
     base(AutomationElementIdentifiers.AutomationPropertyChangedEvent)
 {
     Property = property;
     OldValue = oldValue;
     NewValue = newValue;
 }
Esempio n. 13
0
 public static IEnumerable<AutomationElement> FindDescendantsBy(this AutomationElement ae, AutomationProperty property, object value)
 {
     return ae.FindAll(
     TreeScope.Descendants,
     new PropertyCondition(property, value))
     .Cast<AutomationElement>();
 }
Esempio n. 14
0
 public static void ClickTabItem(this TestBase @this, AutomationProperty searchBy, object value, AutomationElement retrievedControl = null)
 {
     Dictionary<AutomationProperty, object> searchCretia = new Dictionary<AutomationProperty, object>();
     searchCretia.Add(SearchBy.ByControlType, ControlType.TabItem);
     searchCretia.Add(searchBy, value);
     var target = @this.App.FindDescendant(searchCretia, retrievedControl);
     ControlProvider.Transfer<AETabItem>(target).Select();
 }
Esempio n. 15
0
        /// <summary>
        /// Get string describing specified property idenfier
        /// </summary>
        /// <param name="property">property to get string for</param>
        /// <returns>Sting containing human-readable name of specified property</returns>
        public static string PropertyName(AutomationProperty property)
        {
            Misc.ValidateArgumentNonNull(property, "property");
            // Suppress PRESHARP Parameter to this public method must be validated; element is checked above.
#pragma warning suppress 56506
            string full = property.ProgrammaticName.Split('.')[1]; // remove portion before the ".", leaving just "NameProperty" or similar
            return(full.Substring(0, full.Length - 8));            // Slice away "Property" suffix
        }
 public object GetPropertyValue(AutomationProperty property)
 {
     if (TestOfMoreThanTwoPatternPropertiesPattern.Standalone1Property.Equals(property))
         return 42;
     if (TestOfMoreThanTwoPatternPropertiesPattern.NullStringStandaloneProperty.Equals(property))
         return null;
     return null;
 }
Esempio n. 17
0
		public bool SupportsProperty (AutomationProperty property)
		{
			try {
				return dbusElement.SupportsProperty (property.Id);
			} catch (Exception ex) {
					throw DbusExceptionTranslator.Translate (ex);
			}
		}
Esempio n. 18
0
 // threadsafe
 private object this[AutomationProperty property] {
 	get {
 		return STAHelper.Invoke(
 			delegate() {
 		    	return element.GetCurrentPropertyValue(property);
 			}
 		);
 	}
 }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        public AutomationPatternInfo( 
            AutomationPattern id,
            AutomationProperty [ ] properties,
            WrapObjectClientSide clientSideWrapper )
        {
            _id = id;
            _properties = properties;
            _clientSideWrapper = clientSideWrapper;
        }
Esempio n. 20
0
 static DockPatternIdentifiers()
 {
     Pattern =
         new AutomationPattern(PatternId,
                               "DockPatternIdentifiers.Pattern");
     DockPositionProperty =
         new AutomationProperty(DockPositionPropertyId,
                                "DockPatternIdentifiers.DockPositionProperty");
 }
Esempio n. 21
0
		static DockPatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "DockPatternIdentifiers.Pattern");
			DockPositionProperty = 
				new AutomationProperty (DockPositionPropertyId,
				                        "DockPatternIdentifiers.DockPositionProperty");
		}
        //------------------------------------------------------
        //
        //  Patterns Implementation
        //
        //------------------------------------------------------

        #region ProxySimple Interface

        // Process all the Logical and Raw Element Properties
        internal override object GetElementProperty (AutomationProperty idProp)
        {
            if (idProp == AutomationElement.IsControlElementProperty)
            {
                return false;
            }

            return base.GetElementProperty (idProp);
        }
 static TogglePatternIdentifiers()
 {
     Pattern =
         new AutomationPattern(PatternId,
                               "TogglePatternIdentifiers.Pattern");
     ToggleStateProperty =
         new AutomationProperty(ToggleStatePropertyId,
                                "TogglePatternIdentifiers.ToggleStateProperty");
 }
Esempio n. 24
0
		static TogglePatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "TogglePatternIdentifiers.Pattern");
			ToggleStateProperty =
				new AutomationProperty (ToggleStatePropertyId,
				                        "TogglePatternIdentifiers.ToggleStateProperty");
		}
Esempio n. 25
0
 public void Add(AutomationProperty property)
 {
     Utility.ValidateArgumentNonNull(property, "property");
     lock (this._lock)
     {
         this.CheckAccess();
         this._obj.AddProperty(property.Id);
     }
 }
 public void Add(AutomationProperty property)
 {
     Utility.ValidateArgumentNonNull(property, "property");
     lock (this._lock)
     {
         this.CheckAccess();
         this._obj.AddProperty(property.Id);
     }
 }
		static ExpandCollapsePatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "ExpandCollapsePatternIdentifiers.Pattern");
			
			ExpandCollapseStateProperty =
				new AutomationProperty (ExpandCollapseStatePropertyId, 
			                        "ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty");
		}
Esempio n. 28
0
        private void Init(AutomationProperty property, object val, PropertyConditionFlags flags)
        {
            Utility.ValidateArgumentNonNull(property, "property");

            this._obj = (UIAutomationClient.IUIAutomationPropertyCondition)
                        Automation.Factory.CreatePropertyConditionEx(
                property.Id,
                Utility.UnwrapObject(val),
                (UIAutomationClient.PropertyConditionFlags)flags);
        }
Esempio n. 29
0
        //-----------------------------------------------------
        // 
        //  Constructors 
        //
        //----------------------------------------------------- 

        #region Constructors

        internal AutomationPropertyInfo( 
            AutomationProperty id,
            DependencyProperty dependencyProperty, 
            DependencyProperty overrideDP 
            )
        { 
            _id = id;
            _dependencyProperty = dependencyProperty;
            _overrideDP = overrideDP;
        } 
Esempio n. 30
0
        static ExpandCollapsePatternIdentifiers()
        {
            Pattern =
                new AutomationPattern(PatternId,
                                      "ExpandCollapsePatternIdentifiers.Pattern");

            ExpandCollapseStateProperty =
                new AutomationProperty(ExpandCollapseStatePropertyId,
                                       "ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty");
        }
Esempio n. 31
0
        public static object ConvertPropertyValue(
            AutomationProperty property,
            Variant propertyValueVariant)
        {
            var obj1 = propertyValueVariant.ToObject();

            if (property.Id == AutomationElement.ControlTypeProperty.Id)
            {
                var key = (int)obj1;
                return(ControlType._idTable.ContainsKey(key: key) ? (object)ControlType._idTable[key : key] : throw new KeyNotFoundException(message : string.Format(format : "Unknown ControlType: {0}.", arg0 : key)));
            }

            if (property.Id == ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty.Id)
            {
                return((ExpandCollapseState)obj1);
            }
            if (property.Id == AutomationElement.OrientationProperty.Id)
            {
                return((OrientationType)obj1);
            }
            if (property.Id == AutomationElement.BoundingRectangleProperty.Id)
            {
                var numArray = (double[])obj1;
                return(new Rect(x: numArray[0], y: numArray[1], width: numArray[2], height: numArray[3]));
            }

            if (property.Id == WindowPatternIdentifiers.WindowInteractionStateProperty.Id)
            {
                return((WindowInteractionState)obj1);
            }
            if (property.Id == WindowPatternIdentifiers.WindowVisualStateProperty.Id)
            {
                return((WindowVisualState)obj1);
            }
            switch (obj1)
            {
            case IUIAutomationElementArray elementArray:
                return(new AutomationElementCollection(elementArray: elementArray));

            case object[] objArray:
                var       automationElementList = new List <AutomationElement>(capacity: objArray.Length);
                foreach (var obj2 in objArray)
                {
                    if (obj2 is IUIAutomationElement autoElement1)
                    {
                        automationElementList.Add(item: new AutomationElement(autoElement: autoElement1));
                    }
                }
                return(automationElementList.ToArray());

            default:
                return(obj1 is IUIAutomationElement autoElement ? new AutomationElement(autoElement: autoElement) : obj1);
            }
        }
Esempio n. 32
0
 internal object GetPropertyValue(AutomationProperty property, bool cached)
 {
     if (cached)
     {
         return(GetCachedPropertyValue(property));
     }
     else
     {
         return(GetCurrentPropertyValue(property));
     }
 }
        public AutomationElement FindItemByProperty(
            AutomationElement element,
            AutomationProperty property,
            object value)
        {
            Validate.ArgumentNotNull(parameter: property, parameterName: nameof(property));
            var variant     = value.ToVariant();
            var autoElement = element == (AutomationElement)null ? this._itemContainerPattern.FindItemByProperty(pStartAfter: null, propertyId: property.Id, value: variant) : this._itemContainerPattern.FindItemByProperty(pStartAfter: element.IUIAutomationElement, propertyId: property.Id, value: variant);

            variant.Free();
            return(autoElement != null ? new AutomationElement(autoElement: autoElement) : null);
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        internal AutomationPropertyInfo( 
            AutomationPropertyConverter converter,
            AutomationProperty id,
            Type type,
            object defaultValue
            )
        {
            _id = id;
            _type = type;
            _defaultValue = defaultValue;
            _converter = converter;
        }
Esempio n. 35
0
        // get default value for a property
        internal static object GetDefaultValue(AutomationProperty property)
        {
            AutomationPropertyInfo pi;

            if (!Schema.GetPropertyInfo(property, out pi))
            {
                Debug.Assert(false, "GetDefaultValue was passed an unknown property");
                return null;
            }

            return pi.DefaultValue;
        }
Esempio n. 36
0
 public void Add(AutomationProperty property)
 {
     if (property == null)
     {
         throw new ArgumentNullException("property");
     }
     if (IsContainedInAnyThreadStack())
     {
         throw new InvalidOperationException("Cannot modify an active CacheRequest");
     }
     cachedProperties.Add(property);
 }
Esempio n. 37
0
        public object GetCurrentPropertyValue(AutomationProperty property, bool ignoreDefaultValue)
        {
            Validate.ArgumentNotNull(parameter: property, parameterName: nameof(property));
            var propertyValueVariant = new Variant();

            try {
                propertyValueVariant = IUIAutomationElement.GetCurrentPropertyValueEx(propertyId: property.Id, ignoreDefaultValue: Convert.ToInt32(value: ignoreDefaultValue));
            } catch (COMException ex) {
            }

            return(UiaConvert.ConvertPropertyValue(property: property, propertyValueVariant: propertyValueVariant));
        }
Esempio n. 38
0
		public void AddAutomationPropertyChangedEventHandler (IElement element, TreeScope scope, AutomationPropertyChangedEventHandler eventHandler, AutomationProperty[] properties)
		{
			if (element == null)
				return;
			ClientElement clientElement = element as ClientElement;
			if (clientElement == null) {
				Log.Error ("[ClientAutomationSource.AddAutomationPropertyChangedEventHandler] Not ClientElement");
				return;
			}
			int [] propertyIds = Array.ConvertAll (properties, p => p.Id);
			ClientEventManager.AddAutomationPropertyChangedEventHandler (
				clientElement.Provider, scope, eventHandler, propertyIds);
		}
 /// <summary>
 /// Add an AutomationProperty to this CacheRequest
 /// </summary>
 /// <param name="property">The identifier of the property to add to this CacheRequest</param>
 public void Add(AutomationProperty property)
 {
     Misc.ValidateArgumentNonNull(property, "property");
     lock (_instanceLock)
     {
         CheckAccess();
         if (!_properties.Contains(property))
         {
             _properties.Add(property);
             Invalidate();
         }
     }
 }
        public AutomationElement GetElement(AutomationElement rootElement, AutomationProperty property, object value, TreeScope searchScope)
        {
            AutomationElement aeMainWindow = null;

            int numWaits = 0;
            do
            {
                aeMainWindow = rootElement.FindFirst(searchScope, new PropertyCondition(property, value));
                ++numWaits;
                Thread.Sleep(200);
            } while (aeMainWindow == null && numWaits < 50);
            return aeMainWindow;
        }
Esempio n. 41
0
        //------------------------------------------------------
        //
        //  Private Methods
        //
        //------------------------------------------------------

        #region Private Methods

        private object PropertyValueValidateAndMap(AutomationProperty property, object value)
        {
            AutomationPropertyInfo info;

            if (!Schema.GetPropertyInfo(property, out info))
            {
                throw new ArgumentException(SR.Get(SRID.UnsupportedProperty));
            }

            // Check type is appropriate: NotSupported is allowed against any property,
            // null is allowed for any reference type (ie not for value types), otherwise
            // type must be assignable from expected type.
            Type expectedType = info.Type;

            if (value != AutomationElement.NotSupported &&
                ((value == null && expectedType.IsValueType) ||
                 (value != null && !expectedType.IsAssignableFrom(value.GetType()))))
            {
                throw new ArgumentException(SR.Get(SRID.PropertyConditionIncorrectType, property.ProgrammaticName, expectedType.Name));
            }

            // Some types are handled differently in managed vs unmanaged - handle those here...
            if (value is AutomationElement)
            {
                // If this is a comparison against a Raw/LogicalElement,
                // save the runtime ID instead of the element so that we
                // can take it cross-proc if needed.
                value = ((AutomationElement)value).GetRuntimeId();
            }
            else if (value is ControlType)
            {
                // If this is a control type, use the ID, not the CLR object
                value = ((ControlType)value).Id;
            }
            else if (value is Rect)
            {
                Rect rc = (Rect)value;
                value = new double[] { rc.Left, rc.Top, rc.Width, rc.Height };
            }
            else if (value is Point)
            {
                Point pt = (Point)value;
                value = new double[] { pt.X, pt.Y };
            }
            else if (value is CultureInfo)
            {
                value = ((CultureInfo)value).LCID;
            }

            return(value);
        }
		static MultipleViewPatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "MultipleViewPatternIdentifiers.Pattern");
			
			CurrentViewProperty =
				new AutomationProperty (CurrentViewPropertyId,
				                        "MultipleViewPatternIdentifiers.CurrentViewProperty");

			SupportedViewsProperty =
				new AutomationProperty (SupportedViewsPropertyId,
				                        "MultipleViewPatternIdentifiers.SupportedViewsProperty");
		}
Esempio n. 43
0
		static ValuePatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId, 
				                       "ValuePatternIdentifiers.Pattern");

			IsReadOnlyProperty = 
				new AutomationProperty (IsReadOnlyPropertyId,
				                        "ValuePatternIdentifiers.IsReadOnlyProperty");
			
			ValueProperty = 
				new AutomationProperty (ValuePropertyId,
				                        "ValuePatternIdentifiers.ValueProperty");
		}
Esempio n. 44
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------
 
        #region Internal Methods

        // look up information on the specified property, returns true if found, else false
        internal static bool GetPropertyInfo( AutomationProperty id, out AutomationPropertyInfo info )
        {
            foreach( AutomationPropertyInfo pi in _propertyInfoTable )
            {
                if( pi.ID == id )
                {
                    info = pi;
                    return true;
                }
            }
            info = null;
            Debug.Assert( false, "GetPropertyInfo failed " + id );
            return false;
        }
        static MultipleViewPatternIdentifiers()
        {
            Pattern =
                new AutomationPattern(PatternId,
                                      "MultipleViewPatternIdentifiers.Pattern");

            CurrentViewProperty =
                new AutomationProperty(CurrentViewPropertyId,
                                       "MultipleViewPatternIdentifiers.CurrentViewProperty");

            SupportedViewsProperty =
                new AutomationProperty(SupportedViewsPropertyId,
                                       "MultipleViewPatternIdentifiers.SupportedViewsProperty");
        }
Esempio n. 46
0
		static TableItemPatternIdentifiers()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "TableItemPatternIdentifiers.Pattern");

			ColumnHeaderItemsProperty =
				new AutomationProperty (ColumnHeaderItemsPropertyId,
						"TableItemPatternIdentifiers.ColumnHeaderItemsProperty");

			RowHeaderItemsProperty =
				new AutomationProperty (RowHeaderItemsPropertyId,
						"TableItemPatternIdentifiers.RowHeaderItemsProperty");
		}
Esempio n. 47
0
        static TableItemPatternIdentifiers()
        {
            Pattern =
                new AutomationPattern(PatternId,
                                      "TableItemPatternIdentifiers.Pattern");

            ColumnHeaderItemsProperty =
                new AutomationProperty(ColumnHeaderItemsPropertyId,
                                       "TableItemPatternIdentifiers.ColumnHeaderItemsProperty");

            RowHeaderItemsProperty =
                new AutomationProperty(RowHeaderItemsPropertyId,
                                       "TableItemPatternIdentifiers.RowHeaderItemsProperty");
        }
Esempio n. 48
0
        static ValuePatternIdentifiers()
        {
            Pattern =
                new AutomationPattern(PatternId,
                                      "ValuePatternIdentifiers.Pattern");

            IsReadOnlyProperty =
                new AutomationProperty(IsReadOnlyPropertyId,
                                       "ValuePatternIdentifiers.IsReadOnlyProperty");

            ValueProperty =
                new AutomationProperty(ValuePropertyId,
                                       "ValuePatternIdentifiers.ValueProperty");
        }
Esempio n. 49
0
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        // full ctor
        internal EventListener(
            AutomationEvent eventId, 
            TreeScope scope, 
            AutomationProperty [] properties,
            UiaCoreApi.UiaCacheRequest cacheRequest
            )
        {
            _eventId = eventId;
            _scope = scope;
            if (properties != null)
                _properties = (AutomationProperty[])properties.Clone();
            else
                _properties = null;
            _cacheRequest = cacheRequest;
        }
Esempio n. 50
0
 static TransformPatternIdentifiers()
 {
     Pattern =
         new AutomationPattern(PatternId,
                               "TransformPatternIdentifiers.Pattern");
     CanMoveProperty =
         new AutomationProperty(CanMovePropertyId,
                                "TransformPatternIdentifiers.CanMoveProperty");
     CanResizeProperty =
         new AutomationProperty(CanResizePropertyId,
                                "TransformPatternIdentifiers.CanResizeProperty");
     CanRotateProperty =
         new AutomationProperty(CanRotatePropertyId,
                                "TransformPatternIdentifiers.CanRotateProperty");
 }
Esempio n. 51
0
        static GridPatternIdentifiers()
        {
            Pattern =
                new AutomationPattern(PatternId,
                                      "GridPatternIdentifiers.Pattern");

            RowCountProperty =
                new AutomationProperty(RowCountPropertyId,
                                       "GridPatternIdentifiers.RowCountProperty");

            ColumnCountProperty =
                new AutomationProperty(ColumnCountPropertyId,
                                       "GridPatternIdentifiers.ColumnCountProperty");
            ColumnReorderedEvent =
                new AutomationEvent(ColumnReorderedEventId,
                                    "GridPatternIdentifiers.ColumnReorderedEvent");
        }
Esempio n. 52
0
        public Object GetCachedPropertyValue(AutomationProperty property,
                                             bool ignoreDefaultValue)
        {
            CachedValue val   = null;
            bool        found = propertyCache.TryGetValue(property.Id,
                                                          out val);

            if (!found)
            {
                throw new InvalidOperationException("Cannot request a property or pattern that is not cached");
            }
            if (ignoreDefaultValue && !val.IsSupported)
            {
                return(NotSupported);
            }
            return(val.Value);
        }
 static SelectionPatternIdentifiers()
 {
     Pattern =
         new AutomationPattern(PatternId,
                               "SelectionPatternIdentifiers.Pattern");
     CanSelectMultipleProperty =
         new AutomationProperty(CanSelectMultiplePropertyId,
                                "SelectionPatternIdentifiers.CanSelectMultipleProperty");
     IsSelectionRequiredProperty =
         new AutomationProperty(IsSelectionRequiredPropertyId,
                                "SelectionPatternIdentifiers.IsSelectionRequiredProperty");
     SelectionProperty =
         new AutomationProperty(SelectionPropertyId,
                                "SelectionPatternIdentifiers.SelectionProperty");
     InvalidatedEvent =
         new AutomationEvent(InvalidatedEventId,
                             "SelectionPatternIdentifiers.InvalidatedEvent");
 }
        static LegacyIAccessiblePatternIdentifiers()
        {
            Pattern =
                new AutomationPattern(PatternId,
                                      "LegacyIAccessiblePatternIdentifiers.Pattern");

            ChildIdProperty =
                new AutomationProperty(ChildIdPropertyId,
                                       "LegacyIAccessiblePatternIdentifiers.ChildIdProperty");

            DefaultActionProperty =
                new AutomationProperty(DefaultActionPropertyId,
                                       "LegacyIAccessiblePatternIdentifiers.DefaultActionProperty");

            DescriptionProperty =
                new AutomationProperty(DescriptionPropertyId,
                                       "LegacyIAccessiblePatternIdentifiers.DescriptionProperty");

            HelpProperty =
                new AutomationProperty(HelpPropertyId,
                                       "LegacyIAccessiblePatternIdentifiers.HelpProperty");

            KeyboardShortcutProperty =
                new AutomationProperty(KeyboardShortcutPropertyId,
                                       "LegacyIAccessiblePatternIdentifiers.KeyboardShortcutProperty");

            NameProperty =
                new AutomationProperty(NamePropertyId,
                                       "LegacyIAccessiblePatternIdentifiers.NameProperty");

            RoleProperty =
                new AutomationProperty(RolePropertyId,
                                       "LegacyIAccessiblePatternIdentifiers.RoleProperty");

            StateProperty =
                new AutomationProperty(StatePropertyId,
                                       "LegacyIAccessiblePatternIdentifiers.StateProperty");

            ValueProperty =
                new AutomationProperty(ValuePropertyId,
                                       "LegacyIAccessiblePatternIdentifiers.ValueProperty");
        }
Esempio n. 55
0
        public AutomationProperty[] GetSupportedProperties()
        {
            int[] propertyIds;
            Automation.AutomationClass.PollForPotentialSupportedProperties(pElement: IUIAutomationElement, propertyIds: out propertyIds, propertyNames: out var _);
            var automationPropertyList = new List <AutomationProperty>();

            for (var index = 0; index < propertyIds.Length; ++index)
            {
                if (propertyIds[index] != 0)
                {
                    try {
                        var automationProperty = AutomationProperty.LookupById(id: propertyIds[index]);
                        automationPropertyList.Add(item: automationProperty);
                    } catch (KeyNotFoundException ex) {
                    }
                }
            }

            return(automationPropertyList.ToArray());
        }
Esempio n. 56
0
 public object GetCurrentPropertyValue(AutomationProperty property, bool ignoreDefaultValue)
 {
     Utility.ValidateArgumentNonNull(property, "property");
     try
     {
         object obj = this._obj.GetCurrentPropertyValueEx(property.Id, (ignoreDefaultValue) ? 1 : 0);
         return(Utility.WrapObjectAsProperty(property, obj));
     }
     catch (System.Runtime.InteropServices.COMException e)
     {
         Exception newEx; if (Utility.ConvertException(e, out newEx))
         {
             throw newEx;
         }
         else
         {
             throw;
         }
     }
 }
 static SelectionItemPatternIdentifiers()
 {
     Pattern =
         new AutomationPattern(PatternId,
                               "SelectionItemPatternIdentifiers.Pattern");
     ElementAddedToSelectionEvent =
         new AutomationEvent(ElementAddedToSelectionEventId,
                             "SelectionItemPatternIdentifiers.ElementAddedToSelectionEvent");
     ElementRemovedFromSelectionEvent =
         new AutomationEvent(ElementRemovedFromSelectionEventId,
                             "SelectionItemPatternIdentifiers.ElementRemovedFromSelectionEvent");
     ElementSelectedEvent =
         new AutomationEvent(ElementSelectedEventId,
                             "SelectionItemPatternIdentifiers.ElementSelectedEvent");
     IsSelectedProperty =
         new AutomationProperty(IsSelectedPropertyId,
                                "SelectionItemPatternIdentifiers.IsSelectedProperty");
     SelectionContainerProperty =
         new AutomationProperty(SelectionContainerPropertyId,
                                "SelectionItemPatternIdentifiers.SelectionContainerProperty");
 }
Esempio n. 58
0
 public AutomationElement FindItemByProperty(AutomationElement startAfter, AutomationProperty property, object value)
 {
     try
     {
         return(AutomationElement.Wrap(
                    this._pattern.FindItemByProperty(
                        (startAfter == null) ? null : startAfter.NativeElement,
                        (property == null) ? 0 : property.Id,
                        Utility.UnwrapObject(value))));
     }
     catch (System.Runtime.InteropServices.COMException e)
     {
         Exception newEx; if (Utility.ConvertException(e, out newEx))
         {
             throw newEx;
         }
         else
         {
             throw;
         }
     }
 }
Esempio n. 59
0
        //------------------------------------------------------
        //
        //  Public Methods
        //
        //------------------------------------------------------

        #region Public Methods

        /// <summary>
        /// Find item by specified property/value. It will return
        /// placeholder which depending upon it's virtualization state may
        /// or may not have the information of the complete peer/Wrapper.
        ///
        /// Throws ArgumentException if the property requested is not one that the
        /// container supports searching over. Supports Name property, AutomationId,
        /// IsSelected and ControlType.
        ///
        /// This method is expected to be relatively slow, since it may need to
        /// traverse multiple objects in order to find a matching one.
        /// When used in a loop to return multiple items, no specific order is
        /// defined so long as each item is returned only once (ie. loop should
        /// terminate). This method is also item-centric, not UI-centric, so items
        /// with multiple UI representations need only be returned once.
        ///
        /// A special propertyId of 0 means ‘match all items’. This can be used
        /// with startAfter=NULL to get the first item, and then to get successive
        /// items.
        /// </summary>
        /// <param name="startAfter">this represents the item after which the container wants to begin search</param>
        /// <param name="property">corresponds to property for whose value it want to search over.</param>
        /// <param name="value">value to be searched for, for specified property</param>
        /// <returns>The first item which matches the searched criterion, if no item matches, it returns null  </returns>
        public AutomationElement FindItemByProperty(AutomationElement startAfter, AutomationProperty property, object value)
        {
            SafeNodeHandle hNode;

            // Invalidate the "value" passed against the "property" before passing it to UIACore, Don't invalidate if search is being done for "null" property
            // FindItemByProperty supports find for null property.
            if (property != null)
            {
                value = PropertyValueValidateAndMap(property, value);
            }

            if (startAfter != null)
            {
                if (property != null)
                {
                    hNode = UiaCoreApi.ItemContainerPattern_FindItemByProperty(_hPattern, startAfter.RawNode, property.Id, value);
                }
                else
                {
                    hNode = UiaCoreApi.ItemContainerPattern_FindItemByProperty(_hPattern, startAfter.RawNode, 0, null);
                }
            }
            else
            {
                if (property != null)
                {
                    hNode = UiaCoreApi.ItemContainerPattern_FindItemByProperty(_hPattern, new SafeNodeHandle(), property.Id, value);
                }
                else
                {
                    hNode = UiaCoreApi.ItemContainerPattern_FindItemByProperty(_hPattern, new SafeNodeHandle(), 0, null);
                }
            }


            AutomationElement wrappedElement = AutomationElement.Wrap(hNode);

            return(wrappedElement);
        }
Esempio n. 60
0
        public Condition[] GetConditions()
        {
            if (!(IUIAutomationCondition is IUIAutomationAndCondition automationCondition))
            {
                return(null);
            }
            var typedArray     = automationCondition.GetChildren().ToTypedArray <IUIAutomationCondition>();
            var conditionArray = new Condition[typedArray.Length];

            for (var index = 0; index < conditionArray.Length; ++index)
            {
                if (typedArray[index] is IUIAutomationPropertyCondition)
                {
                    var propertyCondition = typedArray[index] as IUIAutomationPropertyCondition;
                    conditionArray[index] = new PropertyCondition(property: AutomationProperty.LookupById(id: propertyCondition.propertyId), value: propertyCondition.PropertyValue);
                }
                else if (typedArray[index] is IUIAutomationAndCondition)
                {
                    var automationAndCondition = typedArray[index] as IUIAutomationAndCondition;
                    conditionArray[index] = new AndCondition(iUIAConditions: automationAndCondition.GetChildren().ToTypedArray <IUIAutomationCondition>());
                }
                else if (typedArray[index] is IUIAutomationOrCondition)
                {
                    var automationOrCondition = typedArray[index] as IUIAutomationOrCondition;
                    conditionArray[index] = new OrCondition(iUIAConditions: automationOrCondition.GetChildren().ToTypedArray <IUIAutomationCondition>());
                }
                else if (typedArray[index] is IUIAutomationNotCondition)
                {
                    conditionArray[index] = new NotCondition(condition: new Condition(condition: typedArray[index]));
                }
                else if (typedArray[index] != null)
                {
                    conditionArray[index] = new Condition(condition: typedArray[index]);
                }
            }

            return(conditionArray);
        }