Exemple #1
0
        // Wrap pattern interface on client side, before handing to client - ie. create a client-side pattern wrapper
        internal static object WrapInterfaceOnClientSide(AutomationElement el, SafePatternHandle hPattern, AutomationPattern pattern)
        {
            if (hPattern.IsInvalid)
            {
                return(null);
            }

            AutomationPatternInfo pi;

            if (!Schema.GetPatternInfo(pattern, out pi))
            {
                throw new ArgumentException(SR.Get(SRID.UnsupportedPattern));
            }

            if (pi.ClientSideWrapper == null)
            {
                Debug.Assert(false, "missing client-side pattern wrapper");
                return(null);
            }
            else
            {
                // false -> not cached. (Cached goes via AutomationElement.GetCachedPattern, not here)
                return(pi.ClientSideWrapper(el, hPattern, false));
            }
        }
Exemple #2
0
        internal BasePattern( AutomationElement el, SafePatternHandle hPattern )
        {
            Debug.Assert(el != null);

            _el = el;
            _hPattern = hPattern;
        }
Exemple #3
0
 // Called by the patterns before accessing .Current
 internal static void ValidateCurrent(SafePatternHandle hPattern)
 {
     if (hPattern.IsInvalid)
     {
         throw new InvalidOperationException(SR.Get(SRID.CacheRequestNeedLiveForProperties));
     }
 }
        internal TextPattern(AutomationElement el, SafePatternHandle hPattern)
            : base(el, hPattern)
        {
            Debug.Assert(el != null);
            Debug.Assert(!hPattern.IsInvalid);

            _hPattern = hPattern;
            _element = el;
        }
Exemple #5
0
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        private ScrollItemPattern(AutomationElement el, SafePatternHandle hPattern)
            : base(el, hPattern)
        {
            _hPattern = hPattern;
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        internal GridItemPattern(AutomationElement el, SafePatternHandle hPattern, bool cached)
            : base(el, hPattern)
        {
            _hPattern = hPattern;
            _cached = cached;
        }
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------
 
        #region Internal Methods

        static internal object Wrap(AutomationElement el, SafePatternHandle hPattern, bool cached)
        {
            return new VirtualizedItemPattern(el, hPattern);
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        private VirtualizedItemPattern(AutomationElement el, SafePatternHandle hPattern)
            : base(el, hPattern)
        {
            _hPattern = hPattern;
        }
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------
 
        #region Internal Methods
        static internal object Wrap(AutomationElement el, SafePatternHandle hPattern, bool cached)
        {
            if (hPattern.IsInvalid)
            {
                throw new InvalidOperationException(SR.Get(SRID.CantPrefetchTextPattern));
            }

            return new TextPattern(el, hPattern);
        }
Exemple #10
0
 // Called by the patterns before accessing .Current
 internal static void ValidateCurrent(SafePatternHandle hPattern)
 {
     if (hPattern.IsInvalid)
     {
         throw new InvalidOperationException(SR.Get(SRID.CacheRequestNeedLiveForProperties));
     }
 }
Exemple #11
0
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        private DockPattern(AutomationElement el, SafePatternHandle hPattern, bool cached)
            : base(el, hPattern)
        {
            _hPattern = hPattern;
            _cached = cached;
        }
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        static internal object Wrap(AutomationElement el, SafePatternHandle hPattern, bool cached)
        {
            return new ItemContainerPattern(el, hPattern);
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        private ItemContainerPattern(AutomationElement el, SafePatternHandle hPattern)
            : base(el, hPattern)
        {
            _hPattern = hPattern;
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        private TableItemPattern(AutomationElement el, SafePatternHandle hPattern, bool cached)
            : base(el, hPattern, cached)
        {
            _hPattern = hPattern;
        }
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------
 
        #region Internal Methods

        internal static new object Wrap(AutomationElement el, SafePatternHandle hPattern, bool cached)
        {
            return new TableItemPattern(el, hPattern, cached);
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        private SynchronizedInputPattern(AutomationElement el, SafePatternHandle hPattern)
            : base(el, hPattern)
        {
            _hPattern = hPattern;
        }
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------
 
        #region Internal Methods

        internal static object Wrap(AutomationElement el, SafePatternHandle hPattern, bool cached)
        {
            return new SynchronizedInputPattern(el, hPattern);
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        private InvokePattern(AutomationElement el, SafePatternHandle hPattern)
            : base(el, hPattern)
        {
            _hPattern = hPattern;
        }
Exemple #19
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------
 
        #region Internal Methods

        internal static object Wrap(AutomationElement el, SafePatternHandle hPattern, bool cached)
        {
            return new DockPattern(el, hPattern, cached);
        }
        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------
 
        #region Constructors

        private TablePattern(AutomationElement el, SafePatternHandle hPattern, bool cached)
            : base(el, hPattern, cached)
        {
            // Done
        }
Exemple #21
0
        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------
 
        #region Internal Methods

        static internal object Wrap(AutomationElement el, SafePatternHandle hPattern, bool cached)
        {
            return new RangeValuePattern(el, hPattern, cached);
        }
Exemple #22
0
        // Wrap pattern interface on client side, before handing to client - ie. create a client-side pattern wrapper
        internal static object WrapInterfaceOnClientSide(AutomationElement el, SafePatternHandle hPattern, AutomationPattern pattern)
        {
            if (hPattern.IsInvalid)
                return null;

            AutomationPatternInfo pi;

            if (!Schema.GetPatternInfo(pattern, out pi))
            {
                throw new ArgumentException(SR.Get(SRID.UnsupportedPattern));
            }

            if (pi.ClientSideWrapper == null)
            {
                Debug.Assert(false, "missing client-side pattern wrapper");
                return null;
            }
            else
            {
                // false -> not cached. (Cached goes via AutomationElement.GetCachedPattern, not here)
                return pi.ClientSideWrapper(el, hPattern, false);
            }
        }