コード例 #1
0
        public ScrollChangedEventWaiter(IScroll root, ScrollProperty scrollProperty, double expectedValue)
            : base(new PropertyChangedEventSource(root as UIObject, Scope.Element, UIProperty.Get("Scroll." + scrollProperty.ToString())))
        {
            Log.Comment("ScrollChangedEventWaiter - Constructor for scrollProperty={0} and expectedValue={1}.",
                        scrollProperty.ToString(), expectedValue.ToString());

            this.root                = root as UIObject;
            this.scrollProperty      = scrollProperty;
            this.expectedDoubleValue = expectedValue;

            if (!double.IsNaN(this.expectedDoubleValue))
            {
                switch (this.scrollProperty)
                {
                case ScrollProperty.HorizontalScrollPercent:
                    this.AddFilter(new Predicate <WaiterEventArgs>(args => root.HorizontalScrollPercent == expectedValue));
                    break;

                case ScrollProperty.HorizontalViewSize:
                    this.AddFilter(new Predicate <WaiterEventArgs>(args => root.HorizontalViewSize == expectedValue));
                    break;

                case ScrollProperty.VerticalScrollPercent:
                    this.AddFilter(new Predicate <WaiterEventArgs>(args => root.VerticalScrollPercent == expectedValue));
                    break;

                case ScrollProperty.VerticalViewSize:
                    this.AddFilter(new Predicate <WaiterEventArgs>(args => root.VerticalViewSize == expectedValue));
                    break;
                }
            }
            this.Reset();
        }
コード例 #2
0
ファイル: WaitHelper.cs プロジェクト: ziyic/microsoft-ui-xaml
        public static bool ForScrollChanged(Scroller scroller, ScrollProperty scrollProperty)
        {
            Log.Comment("Wait.ForScrollChanged call for {0}.", scrollProperty.ToString());

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

            return(true);
        }
コード例 #3
0
        public ScrollChangedEventWaiter(IScroll root, ScrollProperty scrollProperty, bool?expectedValue)
            : base(new PropertyChangedEventSource(root as UIObject, Scope.Element, UIProperty.Get("Scroll." + scrollProperty.ToString())))
        {
            Log.Comment("ScrollChangedEventWaiter - Constructor for scrollProperty={0} and expectedValue={1}.",
                        scrollProperty.ToString(), expectedValue == null ? "null" : expectedValue.ToString());

            this.root              = root as UIObject;
            this.scrollProperty    = scrollProperty;
            this.expectedBoolValue = expectedValue;

            if (this.expectedBoolValue != null)
            {
                switch (this.scrollProperty)
                {
                case ScrollProperty.HorizontallyScrollable:
                    this.AddFilter(new Predicate <WaiterEventArgs>(args => root.HorizontallyScrollable == expectedValue));
                    break;

                case ScrollProperty.VerticallyScrollable:
                    this.AddFilter(new Predicate <WaiterEventArgs>(args => root.VerticallyScrollable == expectedValue));
                    break;
                }
            }
        }
コード例 #4
0
 public ScrollChangedEventWaiter GetScrollChangedWaiter(ScrollProperty scrollProperty, double expectedValue)
 {
     Log.Comment("Scroller.GetScrollChangedWaiter call for scrollProperty={0} and expectedValue={1}.",
                 scrollProperty.ToString(), expectedValue.ToString());
     return(new ScrollChangedEventWaiter(this, scrollProperty, expectedValue));
 }