コード例 #1
0
        private void RenderCurrentPage()
        {
            // Get Layers of the current page from Lesson model
            // to expose them to the view model of the LayerStack
            LayerStack.SetLayers();

            var currentPagePath = Data.GetPageFile(Data.Instance.Lesson.Name, CurrentPageIndex);

            CurrentPage = BitmapHelper.Load(currentPagePath);
        }
コード例 #2
0
        internal override void ChangeCurrentPage(int newPageIndex = -1)
        {
            if (newPageIndex == -1)
            {
                newPageIndex = LayerStack.holderModel.Contents.Count - 1;
            }

            if (CurrentPageIndex == newPageIndex || newPageIndex < 0 || newPageIndex >= PageCount)
            {
                return;
            }

            if (Data.Instance.Lesson.Exercises.Contents[newPageIndex].Layers.Count > 1 &&
                Data.Instance.Lesson.Exercises.Contents[newPageIndex].GetType() == typeof(ExerciseContent) &&
                Data.Instance.Lesson.Exercises.Contents[newPageIndex].GetType() != typeof(QuizContent) &&
                !Data.Instance.User.IsTeacher)
            {
                LayerStack.CurrentLayerIndex = 1;
            }
            else
            {
                LayerStack.CurrentLayerIndex = 0;
            }

            CurrentPageIndex = newPageIndex;
            LayerStack.SetLayers();

            // Scrolls to current thumb inside the SideBar
            var currentThumb =
                thumbsContainerComponent.ItemContainerGenerator.ContainerFromIndex(CurrentPageIndex) as ContentPresenter;

            if (currentThumb == null)
            {
                return;
            }

            currentThumb.BringIntoView();

            RaisePropertyChanged("CanCollect");
            RaisePropertyChanged("CanAnswer");
            RaisePropertyChanged("CanBeStart");
        }