Exemple #1
0
        private readonly ITextProvider2 publicITextProvider2;                                      // AccessibleObject as ITextProvider2

        /// <summary>
        ///  Create a new wrapper.
        /// </summary>
        internal InternalAccessibleObject(AccessibleObject accessibleImplemention)
        {
            // Get all the casts done here to catch any issues early
            publicIAccessible                     = (IAccessible)accessibleImplemention;
            publicIEnumVariant                    = (Oleaut32.IEnumVariant)accessibleImplemention;
            publicIOleWindow                      = (Ole32.IOleWindow)accessibleImplemention;
            publicIReflect                        = (IReflect)accessibleImplemention;
            publicIServiceProvider                = (Ole32.IServiceProvider)accessibleImplemention;
            publicIAccessibleEx                   = (IAccessibleEx)accessibleImplemention;
            publicIRawElementProviderSimple       = (IRawElementProviderSimple)accessibleImplemention;
            publicIRawElementProviderFragment     = (IRawElementProviderFragment)accessibleImplemention;
            publicIRawElementProviderFragmentRoot = (IRawElementProviderFragmentRoot)accessibleImplemention;
            publicIInvokeProvider                 = (IInvokeProvider)accessibleImplemention;
            publicIValueProvider                  = (IValueProvider)accessibleImplemention;
            publicIRangeValueProvider             = (IRangeValueProvider)accessibleImplemention;
            publicIExpandCollapseProvider         = (IExpandCollapseProvider)accessibleImplemention;
            publicIToggleProvider                 = (IToggleProvider)accessibleImplemention;
            publicITableProvider                  = (ITableProvider)accessibleImplemention;
            publicITableItemProvider              = (ITableItemProvider)accessibleImplemention;
            publicIGridProvider                   = (IGridProvider)accessibleImplemention;
            publicIGridItemProvider               = (IGridItemProvider)accessibleImplemention;
            publicILegacyIAccessibleProvider      = (ILegacyIAccessibleProvider)accessibleImplemention;
            publicISelectionProvider              = (ISelectionProvider)accessibleImplemention;
            publicISelectionItemProvider          = (ISelectionItemProvider)accessibleImplemention;
            publicIScrollItemProvider             = (IScrollItemProvider)accessibleImplemention;
            publicIRawElementProviderHwndOverride = (IRawElementProviderHwndOverride)accessibleImplemention;
            publicIMultiViewProvider              = (IMultipleViewProvider)accessibleImplemention;
            publicITextProvider                   = (ITextProvider)accessibleImplemention;
            publicITextProvider2                  = (ITextProvider2)accessibleImplemention;
            // Note: Deliberately not holding onto AccessibleObject to enforce all access through the interfaces
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        private TableItemProviderWrapper(AutomationPeer peer, ITableItemProvider iface)
        {
            _peer  = peer;
            _iface = iface;
        }
 public TableItemPatternWrapper(ITableItemProvider provider)
     : base(provider)
 {
     this.provider = provider;
 }
        //-----------------------------------------------------
        // 
        //  Constructors
        // 
        //----------------------------------------------------- 

        #region Constructors 

        private TableItemProviderWrapper( AutomationPeer peer, ITableItemProvider iface )
        {
            _peer = peer; 
            _iface = iface;
        } 
		public TableItemPatternWrapper (ITableItemProvider provider)
			: base (provider)
		{
			this.provider = provider;
		}
        public void ListItemITableItemProviderTest()
        {
            IRawElementProviderFragmentRoot dataGridProvider;
            IRawElementProviderFragment     child;

            GetDataGridAndFirstListItem(out dataGridProvider, out child);

            ITableProvider tableProvider
                = (ITableProvider)dataGridProvider.GetPatternProvider(
                      TablePatternIdentifiers.Pattern.Id);

            IRawElementProviderSimple[] headerItems
                = tableProvider.GetColumnHeaders();

            SelectionRange range = calendar.GetDisplayRange(false);

            int numChildren = (range.End - range.Start).Days;

            for (int i = 0; i < numChildren && child != null; i++)
            {
                TestProperty(child,
                             AutomationElementIdentifiers.ControlTypeProperty,
                             ControlType.ListItem.Id);

                ITableItemProvider itemProvider = child.GetPatternProvider(
                    TableItemPatternIdentifiers.Pattern.Id) as ITableItemProvider;
                Assert.IsNotNull(itemProvider,
                                 "Does not implement ITableItemProvider");

                // GetColumnHeaderItems
                IRawElementProviderSimple [] itemHeaderItems
                    = itemProvider.GetColumnHeaderItems();

                Assert.IsNotNull(itemHeaderItems,
                                 "No header items returned");
                Assert.AreEqual(1, itemHeaderItems.Length,
                                "Too many or too few header items returned");

                MonthCalendarHeaderItemProvider headerItem
                    = itemHeaderItems[0] as MonthCalendarHeaderItemProvider;

                Assert.IsNotNull(headerItem,
                                 "Header item is not a MonthCalendarHeaderItemProvider");
                Assert.AreEqual(itemProvider.Column, headerItem.Index,
                                "Header item returned does not have the same index as item's column");
                Assert.AreEqual(headerItems[itemProvider.Column], headerItem,
                                "Header item and header item at that index are not equal");

                // GetRowHeaderItems
                IRawElementProviderSimple[] itemRowHeaderItems
                    = itemProvider.GetRowHeaderItems();

                Assert.IsNotNull(itemRowHeaderItems,
                                 "Item provider is returning null for row headers");
                Assert.AreEqual(0, itemRowHeaderItems.Length,
                                "Item provider is returning more than 0 row headers");

                child = ((IRawElementProviderFragment)child)
                        .Navigate(NavigateDirection.NextSibling);
            }
        }