Example #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
        }
Example #2
0
        public void IMultipleViewProvider_Methods()
        {
            Calendar              calendar          = CreateConcreteFrameworkElement() as Calendar;
            AutomationPeer        peer              = FrameworkElementAutomationPeer.CreatePeerForElement(calendar);
            IMultipleViewProvider multiViewProvider = null;

            CreateAsyncTest(calendar,
                            () => {
                Assert.IsNotNull(peer, "#0");
                multiViewProvider = peer.GetPattern(PatternInterface.MultipleView) as IMultipleViewProvider;
                Assert.IsNotNull(multiViewProvider, "#1");

                // IMultipleViewProvider.GetSupportedViews

                int[] views = multiViewProvider.GetSupportedViews();
                Assert.IsNotNull(views, "GetSupportedViews #0");
                Assert.AreEqual((int)CalendarMode.Month, views[0], "GetSupportedViews #1");
                Assert.AreEqual((int)CalendarMode.Year, views[1], "GetSupportedViews #2");
                Assert.AreEqual((int)CalendarMode.Decade, views[2], "GetSupportedViews #3");

                // IMultipleViewProvider.GetViewName

                Assert.AreEqual(CalendarMode.Month.ToString(), multiViewProvider.GetViewName(0), "GetViewName #0");
                Assert.AreEqual(CalendarMode.Year.ToString(), multiViewProvider.GetViewName(1), "GetViewName #1");
                Assert.AreEqual(CalendarMode.Decade.ToString(), multiViewProvider.GetViewName(2), "GetViewName #2");

                // IMultipleViewProvider.CurrentView
                calendar.DisplayMode = CalendarMode.Month;
                Assert.AreEqual((int)CalendarMode.Month, multiViewProvider.CurrentView, "CurrentView #0");
                calendar.DisplayMode = CalendarMode.Year;
                Assert.AreEqual((int)CalendarMode.Year, multiViewProvider.CurrentView, "CurrentView #1");
                calendar.DisplayMode = CalendarMode.Decade;
                Assert.AreEqual((int)CalendarMode.Decade, multiViewProvider.CurrentView, "CurrentView #2");
                // IMultipleViewProvider.SetCurrentView
                multiViewProvider.SetCurrentView(0);

                Assert.AreEqual(CalendarMode.Month, calendar.DisplayMode, "SetCurrentView #0");
                Assert.AreEqual((int)CalendarMode.Month, multiViewProvider.CurrentView, "SetCurrentView #1");

                multiViewProvider.SetCurrentView(1);

                Assert.AreEqual(CalendarMode.Year, calendar.DisplayMode, "SetCurrentView #2");
                Assert.AreEqual((int)CalendarMode.Year, multiViewProvider.CurrentView, "SetCurrentView #3");

                multiViewProvider.SetCurrentView(2);

                Assert.AreEqual(CalendarMode.Decade, calendar.DisplayMode, "SetCurrentView #4");
                Assert.AreEqual((int)CalendarMode.Decade, multiViewProvider.CurrentView, "SetCurrentView #5");

                Assert.Throws <ArgumentOutOfRangeException> (() => multiViewProvider.SetCurrentView(3));
            });
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        private MultipleViewProviderWrapper( AutomationPeer peer, IMultipleViewProvider iface )
        {
            _peer = peer;
            _iface = iface;
        }
Example #4
0
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        private MultipleViewProviderWrapper(AutomationPeer peer, IMultipleViewProvider iface)
        {
            _peer  = peer;
            _iface = iface;
        }
		public MultipleViewPatternWrapper (IMultipleViewProvider provider)
		{
			this.provider = provider;
		}
 public MultipleViewPatternWrapper(IMultipleViewProvider provider)
 {
     this.provider = provider;
 }