예제 #1
0
        private void Timer_Tick(object sender, EventArgs e)
        {
            double num   = this.easingFunction.Ease(this.GetNormalizedTime());
            Point  delta = PageTurner.GetDelta(this.mouseStart, this.mouseEnd);

            this.currentMousePossition.X = this.mouseStart.X + delta.X * num;
            this.currentMousePossition.Y = this.mouseStart.Y + delta.Y * num;
            if (this.pageTurning != null)
            {
                this.pageTurning((object)this, new PageTurnEventArgs(this.currentMousePossition));
            }
            if (this.endTime.Subtract(DateTime.Now).TotalMilliseconds < 0.0)
            {
                this.timer.Stop();
                this.IsAvailable = true;
                if (this.pageTurned != null)
                {
                    this.pageTurned((object)this, new PageTurnEventArgs(this.currentMousePossition));
                }
                if (this.isAvailableChanged == null)
                {
                    return;
                }
                this.isAvailableChanged((object)this, new IsAvailableChangedEventArgs(true));
            }
            else
            {
                this.timer.Start();
            }
        }
예제 #2
0
        private double GetNormalizedTime()
        {
            double num1 = (double)this.beginTime.Ticks;
            double num2 = (double)DateTime.Now.Ticks;
            double num3 = (double)this.endTime.Ticks;

            return(PageTurner.Clamp((num2 - num1) / (num3 - num1), 0.0, 1.0));
        }
예제 #3
0
        public PageTurner(RadBook book)
        {
            PageTurner pageTurner  = this;
            CircleEase circleEase1 = new CircleEase();

            circleEase1.EasingMode = EasingMode.EaseOut;
            CircleEase circleEase2 = circleEase1;

            pageTurner.easingFunction = (IEasingFunction)circleEase2;
            this.timer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromMilliseconds(1.0)
            };
            // ISSUE: explicit constructor call
            // base.\u002Ector();
            this.book        = book;
            this.IsAvailable = true;
            this.timer.Tick += new EventHandler(this.Timer_Tick);
        }