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); } } }
protected override void Dispose(bool disposing) { if (Pattern != null) { System.Runtime.InteropServices.Marshal.ReleaseComObject(Pattern); this.Pattern = null; } base.Dispose(disposing); }
public ScrollPattern(A11yElement e, IUIAutomationScrollPattern p) : base(e, PatternType.UIA_ScrollPatternId) { Pattern = p; PopulateProperties(); }
internal static ScrollPattern Wrap( AutomationElement element, IUIAutomationScrollPattern scrollPattern) { return(new ScrollPattern(element: element, scrollPattern: scrollPattern)); }
ScrollPattern(AutomationElement element, IUIAutomationScrollPattern scrollPattern) : base(el: element) { this._scrollPattern = scrollPattern; }
private ScrollPattern(AutomationElement el, IUIAutomationScrollPattern pattern, bool cached) : base(el, cached) { Debug.Assert(pattern != null); this._pattern = pattern; }