예제 #1
0
 ScrollItemPattern(
     AutomationElement element,
     IUIAutomationScrollItemPattern scrollItemPattern)
     : base(el: element)
 {
     this._scrollItemPattern = scrollItemPattern;
 }
예제 #2
0
        protected override void Dispose(bool disposing)
        {
            if (Pattern != null)
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(Pattern);
                this.Pattern = null;
            }

            base.Dispose(disposing);
        }
예제 #3
0
        /// <summary>
        /// <para>Sets/Resets the Pattern and its properties.</para>
        /// <para>Useful in this class for resetting the Pattern's properties after an action is performed on the Element.</para>
        /// </summary>
        private void Initialize(Element element)
        {
            this._element = element;

            int counter = 0;

            do
            {
                try { _ScrollItemPattern = (IUIAutomationScrollItemPattern)_element.IUIElement.GetCurrentPattern(UIA_PatternIds.UIA_ScrollItemPatternId); }
                catch (COMException e) { }
            } while (_ScrollItemPattern == null && counter++ < 10);

            if (_ScrollItemPattern == null)
            {
                throw new Exception($"Pattern is not available for Element where Name=[{_element.Name}] - AutomationId=[{_element.AutomationId}] - ClassName=[{_element.ClassName}].");
            }
        }
예제 #4
0
 public ScrollItemPattern(A11yElement e, IUIAutomationScrollItemPattern p) : base(e, PatternType.UIA_ScrollItemPatternId)
 {
     Pattern = p;
 }
 public static void xtScrollIntoView(this IUIAutomationElement element)
 {
     _ScrollItemPattern = (IUIAutomationScrollItemPattern)element.GetCurrentPattern(UIA_PatternIds.UIA_ScrollItemPatternId);
     _ScrollItemPattern.ScrollIntoView();
 }
예제 #6
0
 private ScrollItemPattern(AutomationElement el, IUIAutomationScrollItemPattern pattern, bool cached)
     : base(el, cached)
 {
     Debug.Assert(pattern != null);
     this._pattern = pattern;
 }
예제 #7
0
 internal static ScrollItemPattern Wrap(
     AutomationElement element,
     IUIAutomationScrollItemPattern scrollItemPattern)
 {
     return(new ScrollItemPattern(element: element, scrollItemPattern: scrollItemPattern));
 }