コード例 #1
0
        public static void SetVerticalScrollPercent(ScrollPresenter scrollPresenter, double verticalPercent)
        {
            Verify.IsNotNull(scrollPresenter);
            Verify.AreNotEqual(verticalPercent, 0.0);
            Log.Comment("ScrollHelper.SetVerticalScrollPercent scrollPresenter={0}, verticalPercent={1}, before-vertical-offset={2}.",
                        string.IsNullOrWhiteSpace(scrollPresenter.AutomationId) ? scrollPresenter.Name : scrollPresenter.AutomationId,
                        verticalPercent,
                        scrollPresenter.VerticalScrollPercent);

            scrollPresenter.SetScrollPercent(-1 /*NoScroll*/, verticalPercent);
            Wait.ForScrollChanged(scrollPresenter, ScrollProperty.VerticalScrollPercent);

            Log.Comment("ScrollHelper.SetVerticalScrollPercent after-vertical-offset={0}.",
                        scrollPresenter.VerticalScrollPercent);
        }
コード例 #2
0
        public static void ScrollVertically(ScrollPresenter scrollPresenter, ScrollAmount amount)
        {
            Verify.IsNotNull(scrollPresenter);
            Verify.AreNotEqual(amount, ScrollAmount.NoAmount);
            Log.Comment("ScrollHelper.ScrollVertically scrollPresenter={0}, amount={1}, before-offset={2}.",
                        string.IsNullOrWhiteSpace(scrollPresenter.AutomationId) ? scrollPresenter.Name : scrollPresenter.AutomationId,
                        amount,
                        scrollPresenter.VerticalScrollPercent);

            scrollPresenter.ScrollVertical(amount);
            Wait.ForScrollChanged(scrollPresenter, ScrollProperty.VerticalScrollPercent);

            Log.Comment("ScrollHelper.ScrollVertically after-offset={0}.",
                        scrollPresenter.VerticalScrollPercent);
        }
コード例 #3
0
        public static bool ForScrollChanged(ScrollPresenter scrollPresenter, ScrollProperty scrollProperty)
        {
            Log.Comment("Wait.ForScrollChanged call for {0}.", scrollProperty.ToString());

            using (UIEventWaiter scrollChangedWaiter =
                       (scrollProperty == ScrollProperty.HorizontallyScrollable || scrollProperty == ScrollProperty.VerticallyScrollable) ?
                       scrollPresenter.GetScrollChangedWaiter(scrollProperty, null) :
                       scrollPresenter.GetScrollChangedWaiter(scrollProperty, double.NaN))
            {
                if (!scrollChangedWaiter.TryWait(TimeSpan.FromSeconds(5)))
                {
                    Log.Comment("Timeout expired.");
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
        public static void Scroll(ScrollPresenter scrollPresenter, ScrollAmount horizontalAmount, ScrollAmount verticalAmount)
        {
            Verify.IsNotNull(scrollPresenter);
            Verify.AreNotEqual(horizontalAmount, ScrollAmount.NoAmount);
            Verify.AreNotEqual(verticalAmount, ScrollAmount.NoAmount);
            Log.Comment("ScrollHelper.Scroll scrollPresenter={0}, horizontalAmount={1}, verticalAmount={2}, before-horizontal-offset={3}, before-vertical-offset={4}.",
                        string.IsNullOrWhiteSpace(scrollPresenter.AutomationId) ? scrollPresenter.Name : scrollPresenter.AutomationId,
                        horizontalAmount,
                        verticalAmount,
                        scrollPresenter.HorizontalScrollPercent,
                        scrollPresenter.VerticalScrollPercent);

            scrollPresenter.Scroll(horizontalAmount, verticalAmount);
            Wait.ForScrollChanged(scrollPresenter, ScrollProperty.HorizontalScrollPercent);

            Log.Comment("ScrollHelper.Scroll after-horizontal-offset={0}, after-vertical-offset={1}.",
                        scrollPresenter.HorizontalScrollPercent,
                        scrollPresenter.VerticalScrollPercent);
        }