Esempio n. 1
0
        public void Scroll(ScrollAmount horizontal, int hTimes, ScrollAmount vertical, int vTimes)
        {
            object obj;

            pElement.GetCurrentPattern(UIA_ScrollPatternId, out obj);
            try {
                if (obj == null)
                {
                    return;
                }
                IUIAutomationScrollPattern scrollPattern = obj as IUIAutomationScrollPattern;
                while (hTimes > 0 || vTimes > 0)
                {
                    scrollPattern.Scroll(
                        hTimes > 0 ? horizontal : ScrollAmount.NoAmount,
                        vTimes > 0 ? vertical : ScrollAmount.NoAmount);
                    --hTimes;
                    --vTimes;
                }
            }
            catch (COMException) {
            }
            finally {
                if (obj != null)
                {
                    Marshal.ReleaseComObject(obj);
                }
            }
        }
Esempio n. 2
0
        protected override void Dispose(bool disposing)
        {
            if (Pattern != null)
            {
                System.Runtime.InteropServices.Marshal.ReleaseComObject(Pattern);
                this.Pattern = null;
            }

            base.Dispose(disposing);
        }
Esempio n. 3
0
        public ScrollPattern(A11yElement e, IUIAutomationScrollPattern p) : base(e, PatternType.UIA_ScrollPatternId)
        {
            Pattern = p;

            PopulateProperties();
        }
Esempio n. 4
0
 internal static ScrollPattern Wrap(
     AutomationElement element,
     IUIAutomationScrollPattern scrollPattern)
 {
     return(new ScrollPattern(element: element, scrollPattern: scrollPattern));
 }
Esempio n. 5
0
 ScrollPattern(AutomationElement element, IUIAutomationScrollPattern scrollPattern)
     : base(el: element)
 {
     this._scrollPattern = scrollPattern;
 }
Esempio n. 6
0
 private ScrollPattern(AutomationElement el, IUIAutomationScrollPattern pattern, bool cached)
     : base(el, cached)
 {
     Debug.Assert(pattern != null);
     this._pattern = pattern;
 }