예제 #1
0
 //右翻动画
 private void sboardRightBegin(double formX, double toX, double time)
 {
     sboard            = ShareClass.CeaterAnimation_Xmove(wrapPanelPages, formX, toX, time, 0);
     sboard.Completed += sboardRight_Completed;
     sboard.Begin();
 }
예제 #2
0
        private void changePos()
        {
            double pageWidth = canvasPageContent.ActualWidth;

            isDown     = false;
            isMoveSure = false;
            double listLeft_now = Canvas.GetLeft(wrapPanelPages);
            double listLeft_sur = -(pageSelect - 1) * pageWidth;

            //右翻页动作
            if (listLeft_now < listLeft_sur)
            {
                if (pageSelect == pageCount)
                {
                    //已经达到最大页面-回滚
                    isInMove = true;
                    double formX = listLeft_now + (pageSelect - 1) * pageWidth;
                    double toX   = 0;
                    double time  = 1000 * Math.Abs(formX) / pageWidth;
                    Canvas.SetLeft(wrapPanelPages, listLeft_sur);
                    sboard            = ShareClass.CeaterAnimation_Xmove(wrapPanelPages, formX, toX, time, 0);
                    sboard.Completed += sboardNoChange_Completed;
                    sboard.Begin();
                }
                else
                {
                    bool SureRight = false;
                    //移动距离
                    double dis = Math.Abs(listLeft_now - listLeft_sur);
                    //达到翻页确认标准
                    if (dis >= 150)
                    {
                        SureRight = true;
                    }
                    if (SureRight)
                    {
                        //启动右翻动画-翻页
                        isInMove = true;
                        double formX = listLeft_now + (pageSelect - 1) * pageWidth;
                        double toX   = -pageWidth;
                        double time  = 1000 * Math.Abs(Math.Abs(toX) - Math.Abs(formX)) / pageWidth;
                        Canvas.SetLeft(wrapPanelPages, listLeft_sur);
                        sboard            = ShareClass.CeaterAnimation_Xmove(wrapPanelPages, formX, toX, time, 0);
                        sboard.Completed += sboardRight_Completed;
                        sboard.Begin();
                    }
                    else
                    {
                        //未达到翻页要求-回滚
                        isInMove = true;
                        double formX = listLeft_now + (pageSelect - 1) * pageWidth;
                        double toX   = 0;
                        double time  = 1000 * Math.Abs(formX) / pageWidth;
                        Canvas.SetLeft(wrapPanelPages, listLeft_sur);
                        sboard            = ShareClass.CeaterAnimation_Xmove(wrapPanelPages, formX, toX, time, 0);
                        sboard.Completed += sboardNoChange_Completed;
                        sboard.Begin();
                    }
                }
            }
            //左翻页确认
            else
            {
                //第一页左翻-回滚
                if (pageSelect == 1)
                {
                    isInMove = true;
                    double formX = listLeft_now + (pageSelect - 1) * pageWidth;
                    double toX   = 0;
                    double time  = 1000 * Math.Abs(formX) / pageWidth;
                    Canvas.SetLeft(wrapPanelPages, listLeft_sur);
                    sboard            = ShareClass.CeaterAnimation_Xmove(wrapPanelPages, formX, toX, time, 0);
                    sboard.Completed += sboardNoChange_Completed;
                    sboard.Begin();
                }
                else
                {
                    //确认翻页参数
                    bool SureLeft = false;
                    //移动距离
                    double dis = Math.Abs(listLeft_now - listLeft_sur);
                    //达到翻页确认标准
                    if (dis >= 150)
                    {
                        SureLeft = true;
                    }
                    if (SureLeft)
                    {
                        isInMove = true;
                        //启动左翻动画-翻页
                        double formX = listLeft_now + (pageSelect - 1) * pageWidth;
                        double toX   = pageWidth;
                        double time  = 1000 * Math.Abs(Math.Abs(toX) - Math.Abs(formX)) / pageWidth;
                        Canvas.SetLeft(wrapPanelPages, listLeft_sur);
                        sboard            = ShareClass.CeaterAnimation_Xmove(wrapPanelPages, formX, toX, time, 0);
                        sboard.Completed += sboardLeft_Completed;
                        sboard.Begin();
                    }
                    else
                    {
                        isInMove = true;
                        //未达到翻页要求-回滚
                        double formX = listLeft_now + (pageSelect - 1) * pageWidth;
                        double toX   = 0;
                        double time  = 1000 * Math.Abs(formX) / pageWidth;
                        Canvas.SetLeft(wrapPanelPages, listLeft_sur);
                        sboard            = ShareClass.CeaterAnimation_Xmove(wrapPanelPages, formX, toX, time, 0);
                        sboard.Completed += sboardNoChange_Completed;
                        sboard.Begin();
                    }
                }
            }
        }