상속: AutomationIdentifier
예제 #1
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");
		}
예제 #2
0
        // ------------------------------------------------------
        //
        // Patterns Implementation
        //
        // ------------------------------------------------------

        #region ProxySimple Interface

        // Returns a pattern interface if supported.
        internal override object GetPatternProvider (AutomationPattern iid)
        {
            // Treate these toolbar items as menuitems and only support Invoke or Expand/Collapse patterns.
            // Invoke Pattern needs to be supported when the item has no children.  When the item does have
            // children it needs to support ExpandCollapse Pattern.

            // Check if button is a separator
            if (IsSeparator())
            {
                return null;
            }

            // Check if button is disabled
            if (Misc.ProxySendMessageInt(_hwnd, NativeMethods.TB_ISBUTTONENABLED, new IntPtr(_idCommand), IntPtr.Zero) == 0)
            {
                return null;
            }

            // Check if button is hidden
            if (Misc.ProxySendMessageInt(_hwnd, NativeMethods.TB_ISBUTTONHIDDEN, new IntPtr(_idCommand), IntPtr.Zero) != 0)
            {
                return null;
            }

            // 
            if (iid == InvokePattern.Pattern)
            {
                // button is enabled and not hidden and not a separator
                return this;
            }

            //

            return null;
        }
예제 #3
0
        private T GetNativePatternAs <T>(UIA.AutomationPattern pattern) where T : UIA.BasePattern
        {
            object nativePattern;

            BasicAutomationElement.NativeElement.TryGetCurrentPattern(pattern, out nativePattern);
            return((T)nativePattern);
        }
        //------------------------------------------------------
        //
        //  Patterns Implementation
        //
        //------------------------------------------------------

        #region ProxySimple Interface

        // Returns a pattern interface if supported.
        internal override object GetPatternProvider (AutomationPattern iid)
        {
            if (iid == InvokePattern.Pattern && WindowsListView.ListViewInvokable(_hwnd))
            {
                return this;
            }

            if (iid == SelectionItemPattern.Pattern)
            {
                return this;
            }

            if (iid == ValuePattern.Pattern && WindowsListView.ListViewEditable (_hwnd))
            {
                return this;
            }

            if (iid == GridItemPattern.Pattern && IsImplementingGrid (_hwnd))
            {
                return this;
            }

            if (iid == TogglePattern.Pattern && IsItemWithCheckbox(_hwnd, _item))
            {
                return CreateListViewItemCheckbox();
            }

            if (iid == ScrollItemPattern.Pattern && WindowScroll.IsScrollable(_hwnd))
            {
                return this;
            }

            return null;
        }
예제 #5
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");
		}
		protected override bool IsBehaviorEnabled (AutomationPattern pattern)
		{
			object behavior = GetPatternProvider (pattern.Id);
			if (behavior != null)
				return true;
			return base.IsBehaviorEnabled (pattern);
		}
예제 #7
0
 protected object TryGetPattern(AutomationPattern pattern,AutomationElement elementNeedToGet = null)
 {
     elementNeedToGet = elementNeedToGet ?? this.self;
     object returnPattern;
     elementNeedToGet.TryGetCurrentPattern(pattern, out returnPattern);
     return returnPattern ?? null;
 }
예제 #8
0
 public void executePattern(AutomationElement subject, AutomationPattern inPattern)
 {
     switch (inPattern.ProgrammaticName)
     {
         case "InvokePatternIdentifiers.Pattern":
             {
                 InvokePattern invoke = (InvokePattern)subject.GetCurrentPattern(InvokePattern.Pattern);
                 invoke.Invoke();
                 break;
             }
         case "SelectionItemPatternIdentifiers.Pattern":
             {
                 SelectionItemPattern select = (SelectionItemPattern)subject.GetCurrentPattern(SelectionItemPattern.Pattern);
                 select.Select();
                 break;
             }
         case "TogglePatternIdentifiers.Pattern":
             {
                 TogglePattern toggle = (TogglePattern)subject.GetCurrentPattern(TogglePattern.Pattern);
                 toggle.Toggle();
                 break;
             }
         case "ExpandCollapsePatternIdentifiers.Pattern":
             {
                 ExpandCollapsePattern exColPat = (ExpandCollapsePattern)subject.GetCurrentPattern(ExpandCollapsePattern.Pattern);
                 // exColPat.Expand();
                 break;
             }
     }
 }
예제 #9
0
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        internal AutomationPatternInfo( 
            AutomationPattern id,
            WrapObject wcpWrapper)
        {
            _id = id;
            _wcpWrapper = wcpWrapper;
        }
예제 #10
0
		public ProviderBehaviorEventArgs (IProviderBehavior behavior,
		                                  AutomationPattern pattern,
		                                  bool replaced)
		{
			this.replaced = replaced;
			this.behavior = behavior;
			this.pattern = pattern;
		}
예제 #11
0
파일: Element.cs 프로젝트: kevtham/twin
 private object Pattern(AutomationPattern pattern) {
     try {
         return element.GetCurrentPattern(pattern);
     } catch (InvalidOperationException e) {
         ControlType type = (ControlType)element.GetCurrentPropertyValue(AutomationElement.ControlTypeProperty);
         throw new InvalidOperationException(type.ProgrammaticName + " does not support " + pattern.ProgrammaticName, e);
     }
 }
예제 #12
0
		public override IProviderBehavior GetListItemBehaviorRealization (AutomationPattern behavior,
		                                                                  ListItemProvider listItem)
		{
			if (behavior == TogglePatternIdentifiers.Pattern)
				return new ListItemToggleProviderBehavior (listItem);	
			else
				return base.GetListItemBehaviorRealization (behavior, listItem);
		}
예제 #13
0
		static DockPatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "DockPatternIdentifiers.Pattern");
			DockPositionProperty = 
				new AutomationProperty (DockPositionPropertyId,
				                        "DockPatternIdentifiers.DockPositionProperty");
		}
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        public AutomationPatternInfo( 
            AutomationPattern id,
            AutomationProperty [ ] properties,
            WrapObjectClientSide clientSideWrapper )
        {
            _id = id;
            _properties = properties;
            _clientSideWrapper = clientSideWrapper;
        }
예제 #15
0
		static InvokePatternIdentifiers ()
		{
			InvokedEvent =
				new AutomationEvent (InvokedEventId, 
				                     "InvokePatternIdentifiers.InvokedEvent");
			Pattern =
				new AutomationPattern (PatternId,
				                       "InvokePatternIdentifiers.Pattern");
		}
예제 #16
0
		static TogglePatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "TogglePatternIdentifiers.Pattern");
			ToggleStateProperty =
				new AutomationProperty (ToggleStatePropertyId,
				                        "TogglePatternIdentifiers.ToggleStateProperty");
		}
예제 #17
0
 public void Add(AutomationPattern pattern)
 {
     Utility.ValidateArgumentNonNull(pattern, "pattern");
     lock (this._lock)
     {
         this.CheckAccess();
         this._obj.AddPattern(pattern.Id);
     }
 }
            //------------------------------------------------------
            //
            //  Pattern Implementation
            //
            //------------------------------------------------------

            #region ProxySimple Interface

            // Returns a pattern interface if supported.
            internal override object GetPatternProvider (AutomationPattern iid)
            {
                if (iid == InvokePattern.Pattern)
                {
                    return this;
                }

                return null;
            }
		static ExpandCollapsePatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "ExpandCollapsePatternIdentifiers.Pattern");
			
			ExpandCollapseStateProperty =
				new AutomationProperty (ExpandCollapseStatePropertyId, 
			                        "ExpandCollapsePatternIdentifiers.ExpandCollapseStateProperty");
		}
        //------------------------------------------------------
        //
        //  Patterns Implementation
        //
        //------------------------------------------------------

        #region ProxySimple Interface

        // Returns a pattern interface if supported.
        internal override object GetPatternProvider(AutomationPattern iid)
        {
            if (iid == GridPattern.Pattern)
            {
                return this;
            }
            else if (iid == ExpandCollapsePattern.Pattern && WindowsListView.IsGroupViewEnabled(_hwnd))
            {
                return this;
            }

            return null;
        }
예제 #21
0
		static ValuePatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId, 
				                       "ValuePatternIdentifiers.Pattern");

			IsReadOnlyProperty = 
				new AutomationProperty (IsReadOnlyPropertyId,
				                        "ValuePatternIdentifiers.IsReadOnlyProperty");
			
			ValueProperty = 
				new AutomationProperty (ValuePropertyId,
				                        "ValuePatternIdentifiers.ValueProperty");
		}
예제 #22
0
		static MultipleViewPatternIdentifiers ()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "MultipleViewPatternIdentifiers.Pattern");
			
			CurrentViewProperty =
				new AutomationProperty (CurrentViewPropertyId,
				                        "MultipleViewPatternIdentifiers.CurrentViewProperty");

			SupportedViewsProperty =
				new AutomationProperty (SupportedViewsPropertyId,
				                        "MultipleViewPatternIdentifiers.SupportedViewsProperty");
		}
예제 #23
0
		static TableItemPatternIdentifiers()
		{
			Pattern =
				new AutomationPattern (PatternId,
				                       "TableItemPatternIdentifiers.Pattern");

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

			RowHeaderItemsProperty =
				new AutomationProperty (RowHeaderItemsPropertyId,
						"TableItemPatternIdentifiers.RowHeaderItemsProperty");
		}
        //------------------------------------------------------
        //
        //  Patterns Implementation
        //
        //------------------------------------------------------

        #region ProxySimple Interface

        // Returns a pattern interface if supported.
        internal override object GetPatternProvider(AutomationPattern iid)
        {
            // Treate these listview items as menuitems and only support Invoke or Expand/Collapse patterns.
            // Invoke Pattern needs to be supported when the item has no children.  When the item does have
            // children it needs to support ExpandCollapse Pattern.

            if (iid == InvokePattern.Pattern)
            {
                return this;
            }

            // 

            return null;
        }
예제 #25
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");
		}
예제 #26
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");
		}
예제 #27
0
		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");
		}
예제 #28
0
파일: Automation.cs 프로젝트: mono/uia2atk
		public static string PatternName (AutomationPattern pattern)
		{
			if (pattern == null)
				throw new ArgumentNullException ("pattern");

			if (pattern == DockPatternIdentifiers.Pattern)
				return "Dock";
			else if (pattern == ExpandCollapsePatternIdentifiers.Pattern)
				return "ExpandCollapse";
			else if (pattern == GridItemPatternIdentifiers.Pattern)
				return "GridItem";
			else if (pattern == GridPatternIdentifiers.Pattern)
				return "Grid";
			else if (pattern == InvokePatternIdentifiers.Pattern)
				return "Invoke";
			else if (pattern == MultipleViewPatternIdentifiers.Pattern)
				return "MultipleView";
			else if (pattern == RangeValuePatternIdentifiers.Pattern)
				return "RangeValue";
			else if (pattern == ScrollItemPatternIdentifiers.Pattern)
				return "ScrollItem";
			else if (pattern == ScrollPatternIdentifiers.Pattern)
				return "Scroll";
			else if (pattern == SelectionItemPatternIdentifiers.Pattern)
				return "SelectionItem";
			else if (pattern == SelectionPatternIdentifiers.Pattern)
				return "Selection";
			else if (pattern == TableItemPatternIdentifiers.Pattern)
				return "TableItem";
			else if (pattern == TablePatternIdentifiers.Pattern)
				return "Table";
			else if (pattern == TextPatternIdentifiers.Pattern)
				return "Text";
			else if (pattern == TogglePatternIdentifiers.Pattern)
				return "Toggle";
			else if (pattern == TransformPatternIdentifiers.Pattern)
				return "Transform";
			else if (pattern == ValuePatternIdentifiers.Pattern)
				return "Value";
			else if (pattern == WindowPatternIdentifiers.Pattern)
				return "Window";

			return null;
		}
예제 #29
0
파일: Helper.cs 프로젝트: mono/uia2atk
		//Check the patterns that a control must support according to MSDN.
		public void PatternChcek (Element e, AutomationElement ae, AutomationPattern[] addStates, AutomationPattern[] invalidState)
		{
			procedureLogger.Action (string.Format ("Check {0}'s supported patterns.", e));
			
			//Remove the extra patterns from supported patterns list
			for (int i = 0; i < invalidState.Length; i++)
				if(((System.Collections.IList)e.SupportedPatterns).Contains(invalidState [i]))
					e.SupportedPatterns.Remove(invalidState[i]);
					
			//Add necessary patterns to the supported patterns list		
			for (int j = 0; j < addStates.Length; j++)
				e.SupportedPatterns.Add(addStates [j]);

			//Get list of actual patterns of this control
			AutomationPattern[] actualPatterns = ae.GetSupportedPatterns ();
			procedureLogger.ExpectedResult (string.Format ("supported patterns :"));
			for (int k = 0; k < actualPatterns.Length; k++)
				procedureLogger.ExpectedResult (string.Format ("{0} ", actualPatterns [k]));
			
			//get a list of actual patterns that are missing or extraneous
			List<AutomationPattern> missPattern = new List<AutomationPattern>();
			List<AutomationPattern> extraPattern = new List<AutomationPattern>();
			for (int p = 0; p < e.SupportedPatterns.Count; p++)
				if(!(actualPatterns.Contains (e.SupportedPatterns[p])))
					missPattern.Add(e.SupportedPatterns[p]);

			for (int q = 0; q < actualPatterns.Length; q++)
				if(!(e.SupportedPatterns.Contains (actualPatterns[q])))
					extraPattern.Add(actualPatterns[q]);

			//If missingPatterns and extraPatterns are empty, the test case passes
			//otherwise, throw an exception
			if(0 != missPattern.Count)
					Console.WriteLine("Missing miss actions: ");
					for (int n = 0; n < missPattern.Count; n++)
						Console.WriteLine(" {0}", missPattern[n]);	
			Assert.AreEqual(0, missPattern.Count);
				
			if(0 != actualPatterns.Length)
					Console.WriteLine("Missing actual actions: ");
					for (int m = 0; m < actualPatterns.Length; m++)
						Console.WriteLine(" {0}", actualPatterns[m]);
		}
예제 #30
0
        //------------------------------------------------------
        //
        //  Patterns Implementation
        //
        //------------------------------------------------------

        #region ProxySimple Interface

        // Returns a pattern interface if supported.
        internal override object GetPatternProvider (AutomationPattern iid)
        {
            if (iid == GridItemPattern.Pattern)
            {
                return this;
            }

            // Only the first element is editable
            if (iid == ValuePattern.Pattern && _item == 0 && WindowsListView.ListViewEditable (_hwnd))
            {
                return this;
            }

            if (iid == TableItemPattern.Pattern)
            {
                return this;
            }

            return null;
        }
		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");
		}
예제 #32
0
 public static string PatternName(AutomationPattern pattern)
 {
     return(Boundary.UIAutomation(f: () => AutomationClass.GetPatternProgrammaticName(pattern: pattern.Id)));
 }
 static EditableRangePatternIdentifiers()
 {
     Pattern =
         new AutomationPattern(PatternId,
                               "EditableRangePatternIdentifiers.Pattern");
 }
예제 #34
0
        internal static AutomationIdentifier Register(UiaCoreTypesApi.AutomationIdType type, Guid guid, string programmaticName)
        {
            int num = UiaCoreTypesApi.UiaLookupId(type, ref guid);

            if (num == 0)
            {
                if ((!AutomationIdentifier.IsWin7OnlyPatternGuid(guid) && Environment.OSVersion.Version.Major <= 6) || Environment.OSVersion.Version.Major >= 7)
                {
                    int num2 = 1;
                    while (num == 0 && num2 < 1000)
                    {
                        Thread.Sleep(num2);
                        num   = UiaCoreTypesApi.UiaLookupId(type, ref guid);
                        num2 *= 2;
                    }
                }
                if (num == 0)
                {
                    return(null);
                }
            }
            Hashtable            idTable = AutomationIdentifier._idTable;
            AutomationIdentifier result;

            lock (idTable)
            {
                AutomationIdentifier automationIdentifier = (AutomationIdentifier)AutomationIdentifier._idTable[guid];
                if (automationIdentifier != null)
                {
                    result = automationIdentifier;
                }
                else
                {
                    switch (type)
                    {
                    case UiaCoreTypesApi.AutomationIdType.Property:
                        automationIdentifier = new AutomationProperty(num, guid, programmaticName);
                        break;

                    case UiaCoreTypesApi.AutomationIdType.Pattern:
                        automationIdentifier = new AutomationPattern(num, guid, programmaticName);
                        break;

                    case UiaCoreTypesApi.AutomationIdType.Event:
                        automationIdentifier = new AutomationEvent(num, guid, programmaticName);
                        break;

                    case UiaCoreTypesApi.AutomationIdType.ControlType:
                        automationIdentifier = new ControlType(num, guid, programmaticName);
                        break;

                    case UiaCoreTypesApi.AutomationIdType.TextAttribute:
                        automationIdentifier = new AutomationTextAttribute(num, guid, programmaticName);
                        break;

                    default:
                        throw new InvalidOperationException("Invalid type specified for AutomationIdentifier");
                    }
                    AutomationIdentifier._idTable[num] = automationIdentifier;
                    result = automationIdentifier;
                }
            }
            return(result);
        }
예제 #35
0
 static CaretPatternIdentifiers()
 {
     Pattern =
         new AutomationPattern(PatternId,
                               "CaretPatternIdentifiers.Pattern");
 }
예제 #36
0
 public static string PatternName(AutomationPattern pattern)
 {
     Utility.ValidateArgumentNonNull(pattern, "pattern");
     return(Factory.GetPatternProgrammaticName(pattern.Id));
 }