public void OnCompleteAnimation()
        {
            try
            {
                if (!BookLoader.Instance().CanTurnLeft)
                {
                    leftPage.IsBottomLeftCornerEnabled = false;
                    leftPage.IsTopLeftCornerEnabled    = false;
                }
                else
                {
                    leftPage.IsBottomLeftCornerEnabled = true;
                    leftPage.IsTopLeftCornerEnabled    = true;
                }

                if (!BookLoader.Instance().CanTurnRight)
                {
                    rightPage.IsBottomRightCornerEnabled = false;
                    rightPage.IsTopRightCornerEnabled    = false;
                }
                else
                {
                    rightPage.IsBottomRightCornerEnabled = true;
                    rightPage.IsTopRightCornerEnabled    = true;
                }

                BookLoader.Instance().UpdatePrePageToCurrentPage();

                UpdateLeftRightPage(BookLoader.Instance().PreviousPageLeftPart, BookLoader.Instance().PreviousPageRightPart, BookLoader.Instance().CurrentPageLeftPage, BookLoader.Instance().CurrentPageRightPage, BookLoader.Instance().NextPageLeftPart, BookLoader.Instance().NextPageRightPart);
            }
            catch (Exception ex)
            {
                MessageBox.Show("OnCompleteAnimation: " + ex.Message);
            }
        }
        public void UpdateInterface(UpdateInterfaceParams pars)
        {
            switch (pars.Type)
            {
            case TurnType.TurnFromRight:
            {
                UpdateLeftRightPage(BookLoader.Instance().PreviousPageLeftPart, BookLoader.Instance().PreviousPageRightPart, BookLoader.Instance().CurrentPageLeftPage, BookLoader.Instance().CurrentPageRightPage, BookLoader.Instance().NextPageLeftPart, BookLoader.Instance().NextPageRightPart);
                this.AnimateToNextPage(500);
                break;
            }

            case TurnType.TurnFromLeft:
            {
                UpdateLeftRightPage(BookLoader.Instance().PreviousPageLeftPart, BookLoader.Instance().PreviousPageRightPart, BookLoader.Instance().CurrentPageLeftPage, BookLoader.Instance().CurrentPageRightPage, BookLoader.Instance().NextPageLeftPart, BookLoader.Instance().NextPageRightPart);
                this.AnimateToPreviousPage(500);
                break;
            }

            case TurnType.NoTurn:
            {
                UpdateLeftRightPage(BookLoader.Instance().PreviousPageLeftPart, BookLoader.Instance().PreviousPageRightPart, BookLoader.Instance().CurrentPageLeftPage, BookLoader.Instance().CurrentPageRightPage, BookLoader.Instance().NextPageLeftPart, BookLoader.Instance().NextPageRightPart);
                break;
            }

            default:
            {
                break;
            }
            }
        }
        private void setupUI()
        {
            mainMask.Visibility = Visibility.Collapsed;
            Page1Sheet.curlShadow.Visibility = Visibility.Collapsed;
            //BookData = new BookLoader();
            BookLoader.Instance();//force init data, and download menudata.xml
            BookLoader.Instance().Attach(this);

            this.pageWidth  = 1200;// 900;
            this.pageHeight = 600;

            this.pageHalfWidth  = this.pageWidth * 0.5;
            this.pageHalfHeight = this.pageHeight * 0.5;

            BookSizes bs = new BookSizes()
            {
                layoutRootW     = pageWidth,
                layoutRootH     = pageHeight,
                layoutRootHalfH = pageHeight / 2,
                layoutRootHalfW = pageHalfWidth
            };

            this.LayoutRoot.DataContext = bs;

            this.rutieow.SetValue(Canvas.LeftProperty, this.pageHalfWidth);
            this.rutieow.SetValue(Canvas.TopProperty, this.pageHalfHeight);

            this.PageCorner.SetValue(Canvas.LeftProperty, this.pageHalfWidth - 100.0);
            this.PageCorner.SetValue(Canvas.TopProperty, this.pageHalfHeight - 100.0);

            this.spineTop = new Point(0.0, -this.pageHalfHeight);


            this.spineBottom = new Point(0.0, this.pageHalfHeight);
            this.fixedRadius = this.pageHalfWidth;

            this.maskSize.X      = this.pageHalfWidth;
            this.maskSize.Y      = this.pageHeight * 1.6;
            this.mainMask.Width  = this.maskSize.X;
            this.mainMask.Height = this.maskSize.Y;
            this.mainMask.SetValue(Canvas.TopProperty, this.pageHeight - (this.maskSize.Y * 0.8));

            this.mouse.X = this.pageHalfWidth - 1.0;
            this.mouse.Y = this.pageHalfHeight - 1.0;

            this.follow.X = this.mouse.X;
            this.follow.Y = this.mouse.Y;
            this.corner.X = this.mouse.X;
            this.corner.Y = this.mouse.Y;

            this.PageCorner.MouseLeftButtonDown += new MouseButtonEventHandler(this.PageCorner_MouseLeftButtonDown);
            this.PageCorner.MouseMove           += new MouseEventHandler(this.PageCorner_MouseMove);
            this.PageCorner.MouseLeftButtonUp   += new MouseButtonEventHandler(this.PageCorner_MouseLeftButtonUp);
            this.PageCorner.MouseLeave          += new MouseEventHandler(this.PageCorner_MouseLeave);

            this.Page1Sheet.Effect         = new CustomPixelShader.Effects.GutterBookEffect();
            this.Page2SheetSection2.Effect = new CustomPixelShader.Effects.GutterBookEffect();
            this.Page1TraceSheet.Effect    = new CustomPixelShader.Effects.GutterBookEffect();
        }
        public MasterPage()
        {
            InitializeComponent();
            _timer.Duration   = TimeSpan.FromMilliseconds(30);
            _timer.Completed += new EventHandler(_timer_Completed);
            _timer.Begin();

            BookLoader.Instance().Attach(this);
        }
Esempio n. 5
0
        public UCBook()
        {
            InitializeComponent();
            leftPage.Attach(this);
            rightPage.Attach(this);

            BookLoader.Instance();//force init data, and download menudata.xml
            BookLoader.Instance().Attach(this);

            this.Loaded += new RoutedEventHandler(UCBook_Loaded);
        }
Esempio n. 6
0
        public void OnCompleteAnimation()
        {
            try
            {
                BookLoader.Instance().UpdatePrePageToCurrentPage();

                UpdateLeftRightPage(BookLoader.Instance().PreviousPageLeftPart, BookLoader.Instance().PreviousPageRightPart, BookLoader.Instance().CurrentPageLeftPage, BookLoader.Instance().CurrentPageRightPage, BookLoader.Instance().NextPageLeftPart, BookLoader.Instance().NextPageRightPart);
            }
            catch (Exception ex)
            {
                MessageBox.Show("OnCompleteAnimation: " + ex.Message);
            }
        }
        void _timer_Completed(object sender, EventArgs e)
        {
            if (pbar.Value < pbar.Maximum)
            {
                //pbar.Value++;
                pbar.Value += 10;
                _timer.Begin();
            }
            else
            {
                containerContent.RenderTransform = new CompositeTransform();
                VisualStateManager.GoToState(this, "Right", true);
                pbar.Opacity = 0;

                /*MessageBox.Show("asdf");
                 * MainPage2 page = FindControl<MainPage2>(containerContent, typeof(MainPage2),"");
                 * page.MoveRight();*/
                BookLoader.Instance().GoToFirstMenuPage();
            }
        }
        private void ChangePageBeforeTransition(object sender, EventArgs e)
        {
            try
            {
                this.Page2SheetSection2.sheetImage.Children.Clear();
                this.Page1TraceSheet.sheetImage.Children.Clear();

                if (BookLoader.Instance().NextPageLeftPart != null)
                {
                    this.Page2SheetSection2.sheetImage.Children.Add(BookLoader.Instance().NextPageLeftPart);
                }
                if (BookLoader.Instance().NextPageRightPart != null)
                {
                    this.Page1TraceSheet.sheetImage.Children.Add(BookLoader.Instance().NextPageRightPart);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("ChangePageBeforeTransition: " + ex.Message);
            }
        }
        private void ChangePageAfterTransition(object sender, EventArgs e)
        {
            try
            {
                BookLoader.Instance().UpdatePrePageToCurrentPage();
                //bCanTransitionRight = BookLoader.Instance().IsCanTransitionRight();

                this.Page1Sheet.sheetImage.Children.Clear();
                this.Page2SheetSection2.sheetImage.Children.Clear();
                this.Page1TraceSheet.sheetImage.Children.Clear();

                if (BookLoader.Instance().CurrentPageRightPage != null)
                {
                    this.Page1Sheet.sheetImage.Children.Add(BookLoader.Instance().CurrentPageRightPage);
                }
                if (BookLoader.Instance().NextPageLeftPart != null)
                {
                    this.Page2SheetSection2.sheetImage.Children.Add(BookLoader.Instance().NextPageLeftPart);
                }
                if (BookLoader.Instance().NextPageRightPart != null)
                {
                    this.Page1TraceSheet.sheetImage.Children.Add(BookLoader.Instance().NextPageRightPart);
                }

                //TypeTransition = UpdatePageTransition.Default;

                this.mouse  = new Point(this.pageHalfWidth - 1.0, this.pageHalfHeight - 1.0);
                this.follow = new Point(this.pageHalfWidth - 1.0, this.pageHalfHeight - 1.0);

                mainMask.Visibility = Visibility.Collapsed;
                Page1Sheet.curlShadow.Visibility = Visibility.Collapsed;
            }
            catch (Exception ex)
            {
                MessageBox.Show("ChangePageAfterTransition: " + ex.Message);
            }
        }
 private void btPrevious_Click(object sender, RoutedEventArgs e)
 {
     BookLoader.Instance().OnPreviousPage();
 }
 private void btNext_Click(object sender, RoutedEventArgs e)
 {
     BookLoader.Instance().OnNextPage();
 }
 private void btBack_Click(object sender, RoutedEventArgs e)
 {
     BookLoader.Instance().OnBack();
 }
 void UCBook_Loaded(object sender, RoutedEventArgs e)
 {
     //MessageBox.Show("asd");
     BookLoader.Instance().FirstCover();
 }
 private void rightPage_PageTurnedByConner(object sender, RoutedEventArgs e)
 {
     //CurrentSheetIndex++;
     BookLoader.Instance().OnNextPage(true);
     OnCompleteAnimation();
 }
Esempio n. 15
0
        //#region IDataProvider Members

        //public object GetItem(int index)
        //{
        //    return pages[index];
        //}

        //public int GetCount()
        //{
        //    return pages.Count;
        //}

        //#endregion

        //private void Button_Click(object sender, RoutedEventArgs e)
        //{
        //    book.AnimateToNextPage(500);
        //}

        //private void Button_Click_1(object sender, RoutedEventArgs e)
        //{
        //    book.AnimateToPreviousPage(500);
        //}

        private void book_Loaded(object sender, RoutedEventArgs e)
        {
            book.UpdateLeftRightPage(BookLoader.Instance().PreviousPageLeftPart, BookLoader.Instance().PreviousPageRightPart, BookLoader.Instance().CurrentPageLeftPage, BookLoader.Instance().CurrentPageRightPage, BookLoader.Instance().NextPageLeftPart, BookLoader.Instance().NextPageRightPart);
        }