public void ActivateSessionIfExists()
        {
            var slideSessionModel = PresentationInformationStore.GetStoredSlideSessionModel();

            if (slideSessionModel != null)
            {
                this.sessionManager.ActivateSession(slideSessionModel);
            }
        }
        public void RemoveClickQuizDataOnServer()
        {
            var slideSessionModel = PresentationInformationStore.GetStoredSlideSessionModel();

            if (slideSessionModel != null)
            {
                this.sessionManager.RemoveClickQuizDataFromServer(slideSessionModel);
            }
        }
        public void HideOrShowQuizFromSelectedSlide(Slide slide)
        {
            var slideSessionModel = this.GetSlideSessionModel();

            var slideQuestionModel = slideSessionModel.Questions.First(q => q.QuestionInfoSlideId == slide.SlideID ||
                                                                       q.QuestionTimerSlideId == slide.SlideID ||
                                                                       q.ResultsSlideId == slide.SlideID);

            if (slideQuestionModel == null)
            {
                throw new Exception("No existing arsnova question on slide.");
            }

            var questionInfoSlide  = SlideTracker.GetSlideById(slideQuestionModel.QuestionInfoSlideId);
            var questionTimerSlide = SlideTracker.GetSlideById(slideQuestionModel.QuestionTimerSlideId.Value);
            var resultsSlide       = SlideTracker.GetSlideById(slideQuestionModel.ResultsSlideId.Value);

            if (slideQuestionModel.Hidden)
            {
                questionInfoSlide.SlideShowTransition.Hidden  = MsoTriState.msoFalse;
                questionTimerSlide.SlideShowTransition.Hidden = MsoTriState.msoFalse;
                resultsSlide.SlideShowTransition.Hidden       = MsoTriState.msoFalse;
            }
            else
            {
                questionInfoSlide.SlideShowTransition.Hidden  = MsoTriState.msoTrue;
                questionTimerSlide.SlideShowTransition.Hidden = MsoTriState.msoTrue;
                resultsSlide.SlideShowTransition.Hidden       = MsoTriState.msoTrue;
            }

            slideQuestionModel.Hidden = !slideQuestionModel.Hidden;

            // recalculate question index: asrnova.click index needs to start with 0 and should not leave out any number!
            var ignoredQuestions = 0;

            for (var i = 0; i < slideSessionModel.Questions.Count; i++)
            {
                var question = slideSessionModel.Questions.FirstOrDefault(q => q.Index == i);

                if (question == null)
                {
                    continue;
                }

                if (question.Hidden)
                {
                    ignoredQuestions++;
                }
                else
                {
                    question.RecalculatedOnlineIndex = question.Index - ignoredQuestions;
                }
            }

            PresentationInformationStore.StoreSlideSessionModel(slideSessionModel);
        }
예제 #4
0
        public static bool IsArsnovaSlide(Slide slide)
        {
            if (slide == null)
            {
                return(false);
            }

            var slideSessionModel = PresentationInformationStore.GetStoredSlideSessionModel();

            return(slideSessionModel != null &&
                   slideSessionModel.Questions.Any(questionModel => questionModel.QuestionInfoSlideId == slide.SlideID ||
                                                   questionModel.QuestionTimerSlideId == slide.SlideID ||
                                                   questionModel.ResultsSlideId == slide.SlideID));
        }
예제 #5
0
        public static Tuple <bool, SlideQuestionModel> IsPresentationOnResultsArsnovaVotingSlide()
        {
            var currentShowedSlidePosition = CurrentShowedPresentationSlidePosition;

            var slideSessionModel = PresentationInformationStore.GetStoredSlideSessionModel();

            if (slideSessionModel == null || slideSessionModel.SessionType == SessionType.ArsnovaClick)
            {
                return(new Tuple <bool, SlideQuestionModel>(false, null));
            }

            foreach (var slideQuestionModel in slideSessionModel.Questions)
            {
                if (slideQuestionModel.ResultsSlideId.HasValue &&
                    GetSlideById(slideQuestionModel.ResultsSlideId.Value).SlideNumber == currentShowedSlidePosition)
                {
                    return(new Tuple <bool, SlideQuestionModel>(true, slideQuestionModel));
                }
            }

            return(new Tuple <bool, SlideQuestionModel>(false, null));
        }
예제 #6
0
        public static Tuple <bool, SlideQuestionModel> IsPresentationOnStartArsnovaSlide()
        {
            var currentShowedSlidePosition = CurrentShowedPresentationSlidePosition;

            var slideSessionModel = PresentationInformationStore.GetStoredSlideSessionModel();

            if (slideSessionModel == null)
            {
                return(new Tuple <bool, SlideQuestionModel>(false, null));
            }

            foreach (var slideQuestionModel in slideSessionModel.Questions)
            {
                var slide = GetSlideById(slideQuestionModel.QuestionTimerSlideId.Value);
                if (slideQuestionModel.QuestionTimerSlideId.HasValue &&
                    slide != null && slide.SlideNumber == currentShowedSlidePosition)
                {
                    return(new Tuple <bool, SlideQuestionModel>(true, slideQuestionModel));
                }
            }

            return(new Tuple <bool, SlideQuestionModel>(false, null));
        }
        public void CleanUpOnStart()
        {
            var slideSessionModel = PresentationInformationStore.GetStoredSlideSessionModel();

            if (slideSessionModel != null)
            {
                foreach (var slideQuestionModel in slideSessionModel.Questions)
                {
                    if (slideQuestionModel.QuestionTimerSlideId.HasValue)
                    {
                        this.slideManipulator.SetTimerOnSlide(
                            slideQuestionModel,
                            SlideTracker.GetSlideById(slideQuestionModel.QuestionTimerSlideId.Value),
                            slideQuestionModel.Countdown);
                    }

                    if (slideQuestionModel.ResultsSlideId.HasValue)
                    {
                        this.slideManipulator.CleanResultsPage(SlideTracker.GetSlideById(slideQuestionModel.ResultsSlideId.Value));
                    }
                }
            }
        }
예제 #8
0
        public static SlideQuestionModel GetQuestionModelFromSlide(Slide slide)
        {
            var slideSessionModel = PresentationInformationStore.GetStoredSlideSessionModel();

            return(slideSessionModel.Questions.First(questionModel => questionModel.QuestionInfoSlideId == slide.SlideID));
        }
        public bool IsARSnovaClickSession()
        {
            var slideSessionModel = PresentationInformationStore.GetStoredSlideSessionModel();

            return(slideSessionModel != null && slideSessionModel.SessionType == SessionType.ArsnovaClick);
        }
        private SlideSessionModel GetSlideSessionModel()
        {
            var slideSessionModel = PresentationInformationStore.GetStoredSlideSessionModel();

            return(slideSessionModel ?? new SlideSessionModel());
        }