Example #1
0
        public CoreApp(IChapterHeading chapterHeading, IVerseView verseView, ISimpleStorage simpleStorage,
                       IHistoryControls historyControls, int initialJump)
        {
            _chapterHeading  = chapterHeading;
            _verseView       = verseView;
            _historyControls = historyControls;

            // Load history.
            _history = new History(simpleStorage);

            // Keep track of changes to the verse view.
            verseView.OnScroll     += UpdateCurrentLocation;
            verseView.OnSwipeLeft  += MoveNextChapter;
            verseView.OnSwipeRight += MovePreviousChapter;

            // Wire up history to the history controls.
            historyControls.BackClick    += MoveBack;
            historyControls.ForwardClick += MoveForward;
            _history.CanMoveChanged      += EnableDisableHistoryButtons;

            // If the app has to jump to a verse, then insert it into the history.
            if (initialJump != Bible.InvalidAbsoluteVerseNumber)
            {
                _history.AddJump(_history.CurrentAbsoluteVerseNumber, initialJump);
            }

            // Pick up where we left off.
            verseView.Jump(Location.Create(_history.CurrentAbsoluteVerseNumber));

            EnableDisableHistoryButtons();
        }
Example #2
0
 public StubbedApp(IChapterHeading chapterHeading = null, IVerseView verseView             = null,
                   ISimpleStorage simpleStorage   = null, IHistoryControls historyControls = null,
                   int initialJump = Bible.InvalidAbsoluteVerseNumber)
 {
     ChapterHeading  = chapterHeading ?? new StubChapterHeading();
     VerseView       = verseView ?? new StubVerseView();
     SimpleStorage   = simpleStorage ?? new StubSimpleStorage();
     HistoryControls = historyControls ?? new StubHistoryControls();
     InitialJump     = initialJump;
     App             = new CoreApp(ChapterHeading, VerseView, SimpleStorage, HistoryControls, InitialJump);
 }