Esempio n. 1
0
            public override void Scrolled(UIScrollView scrollView)
            {
                UISecondScrollView tmp = (UISecondScrollView)scrollView;

                if (!chapterIsScrolling)
                {
                    if (pagesAreScrolling)
                    {
                        tmp.checkLeftOrRightMost(scrollView);
                        if (tmp.currentPageScrollIsLeftMost || tmp.currentPageScrollIsRightMost)
                        {
                            tmp.secondScrollDelegate.secondScrollDidScroll(tmp);
                            alignChapter = true;
                        }
                        else if (alignChapter)
                        {
                            alignChapter = false;
                            tmp.secondScrollDelegate.alignChapterScrollView();
                        }
                        tmp.evaluateChapterBounds(scrollView);
                        if (!tmp.Tracking)
                        {
                            if (tmp.moveToRight || tmp.moveToLeft)
                            {
                                tmp.secondScrollDelegate.updateChapterScroll(tmp);
                            }
                        }
                    }
                }
            }
Esempio n. 2
0
            public override void DecelerationEnded(UIScrollView scrollView)
            {
                UISecondScrollView tmp = (UISecondScrollView)scrollView;

                pagesAreScrolling = false;
                tmp.secondScrollDelegate.secondScrollDidEndDragging(tmp);
            }
Esempio n. 3
0
 public void updateChapterScroll(UISecondScrollView scrollView)
 {
     if (scrollView.moveToLeft)
     {
         if (this.currentPage == 0)
         {
             return;
         }
         else
         {
             this.currentPage--;
             this.pageControl.CurrentPage = this.currentPage;
             this.currentChapter          = this.chaptersController[this.currentPage];
             drawCurrentChapter();
             scrollView.moveToLeft = false;
         }
     }
     else if (scrollView.moveToRight)
     {
         if (this.currentPage == this.chaptersController.Count - 1)
         {
             return;
         }
         else
         {
             this.currentPage++;
             this.pageControl.CurrentPage = this.currentPage;
             this.currentChapter          = this.chaptersController[this.currentPage];
             drawCurrentChapter();
             scrollView.moveToRight = false;
         }
     }
 }
Esempio n. 4
0
            public override void DraggingStarted(UIScrollView scrollView)
            {
                UISecondScrollView tmp = (UISecondScrollView)scrollView;

                chapterIsScrolling = false;
                pagesAreScrolling  = true;
                tmp.checkLeftOrRightMost(tmp);
                tmp.secondScrollDelegate.secondScrollWillBeginDragging(tmp);
            }
Esempio n. 5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.

            try
            {
                chaptersController = new List <ChapterController> ();

                //loadPropertiesFile ();
                loadPropertiesFileFromPList();


                chapterChanged                = false;
                setOffsetForChange            = false;
                secondScrollIsScrolling       = false;
                canBeginGestures              = true;
                isPossibleBigToSmallAnimation = true;

                List <PageController> allPagesController = new List <PageController> ();
                foreach (ChapterController chapter in this.chaptersController)
                {
                    foreach (PageController page in chapter.pagesController)
                    {
                        page.gesturesDelegate = this;
                        allPagesController.Add(page);
                    }
                }

                this.secondScroll = new UISecondScrollView(allPagesController);

                this.chapterScroll.Frame = new CGRect(Constants.MAIN_ORIGIN_X, Constants.MAIN_ORIGIN_Y,
                                                      Constants.MAIN_WIDTH, Constants.MAIN_HEIGHT);

                this.secondScroll.Frame = new RectangleF(Constants.SECOND_ORIGIN_X, Constants.SECOND_ORIGIN_Y,
                                                         Constants.SECOND_WIDTH, Constants.SECOND_HEIGHT);

                this.pageControl.Pages       = this.chaptersController.Count;
                this.currentPage             = 0;
                this.pageControl.CurrentPage = this.currentPage;
                this.currentChapter          = this.chaptersController[this.currentPage];

                //initial properties for second scroll
                this.secondScroll.currentChapter       = this.currentPage;
                this.chapterScroll.WeakDelegate        = this;
                this.secondScroll.secondScrollDelegate = this;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.WriteLine("file bookInfo.plist could not be opened");
            }
        }
Esempio n. 6
0
 public void secondScrollDidScroll(UISecondScrollView scrollView)
 {
     if (scrollView.currentPageScrollIsLeftMost && scrollView.ContentOffset.X < 0)
     {
         CGPoint offset = this.chapterScroll.ContentOffset;
         offset.X = scrollView.ContentOffset.X + this.currentPage * Constants.MAIN_WIDTH;
         this.chapterScroll.ContentOffset = offset;
     }
     else if (scrollView.currentPageScrollIsRightMost && scrollView.ContentOffset.X >
              scrollView.ContentSize.Width - scrollView.Frame.Width)
     {
         nfloat  diff   = scrollView.ContentOffset.X - scrollView.ContentSize.Width;
         CGPoint offset = this.chapterScroll.ContentOffset;
         offset.X = (this.currentPage + 1) * Constants.MAIN_WIDTH + diff;
         this.chapterScroll.ContentOffset = offset;
     }
     this.chapterScroll.SetNeedsDisplay();
 }
Esempio n. 7
0
            public override void DraggingEnded(UIScrollView scrollView, bool willDecelerate)
            {
                UISecondScrollView tmp = (UISecondScrollView)scrollView;

                tmp.secondScrollDelegate.secondScrollDidEndDragging(tmp);
            }
Esempio n. 8
0
 public void secondScrollDidEndDragging(UISecondScrollView scrollView)
 {
     this.chapterScroll.UserInteractionEnabled = true;
     this.secondScroll.evaluateChapterBounds(scrollView);
 }
Esempio n. 9
0
 public void secondScrollWillBeginDragging(UISecondScrollView scrollView)
 {
     secondScrollIsScrolling = true;
     this.chapterScroll.UserInteractionEnabled = false;
 }