Esempio n. 1
0
        public async void AutoAdvance(Question question)
        {
            List <Question> questions = section.AllScorableQuestions();

            if (question.Id == questions.Last().Id)
            {
                if (!(section.Id == inspection.Checklist.Sections.Last().Id))
                {
                    bool accept = await DisplayAlert("End of Section", "You have reached the end of this section.  Would you like to continue to the next?", "Yes", "No");

                    if (accept)
                    {
                        parentPage.CurrentPage = parentPage.Children.ElementAt(parentPage.Children.IndexOf(parentPage.CurrentPage) + 1);
                    }
                }
                else
                {
                    //report that this is the end of the checklist
                    await DisplayAlert("End of Checklist", "You have reached the end of the checklist.", "OK");
                }
            }
            else
            {
                int          index = questions.IndexOf(question);
                QuestionPage page  = this.Children.ElementAt(index + 1) as QuestionPage;
                page.Initialize();
                this.CurrentPage = page;
            }
        }
Esempio n. 2
0
        protected override void OnCurrentPageChanged()
        {
            QuestionPage page = CurrentPage as QuestionPage;

            if (page != null)
            {
                page.Initialize();
                int index = Children.IndexOf(CurrentPage);
                if (index > 0)
                {
                    (Children.ElementAt(index - 1) as QuestionPage).Initialize();
                }
                if (index < Children.Count - 1)
                {
                    (Children.ElementAt(index + 1) as QuestionPage).Initialize();
                }
            }
            base.OnCurrentPageChanged();
        }