public ExamModeRandomConfigPage()
 {
     InitializeComponent();
     var list = AppCache.GetData(null, null);
     DataContextType = new ExamModeQuestionNo();
     this.BindingContext = DataContextType;
 }
        public ExamModeConfigPage()
        {
            InitializeComponent();
            GetQuestionMasterList();
            DataContextType = new ExamModeQuestionNo();
            SelectedCategories = new List<QuestionTemplateCategory>();
            this.BindingContext = DataContextType;
            StartButton.Clicked += async (sender, e) =>
            {
                StringBuilder thisCompose = new StringBuilder();
                const string display = "Exam Session Details:";
                thisCompose.AppendLine();
                thisCompose.Append("Total Questions -  ");
                thisCompose.Append(DataContextType.NoOfQuestions.ToString());
                thisCompose.AppendLine();
                if (this.TimeSwitch.IsToggled)
                {
                    thisCompose.Append("Session Duration -  ");
                    thisCompose.Append(DataContextType.NoOfQuestions.ToString());
                    thisCompose.Append(" mins");
                    thisCompose.AppendLine();
                }
                if (DataContextType.NoOfQuestions == 0)
                {
                    await DisplayAlert("Alert", "Unable to proceed with 0 question", "OK");
                    return;
                }

               var action = await  DisplayAlert(display, thisCompose.ToString(), "Start Test", "Cancel");
                if (action)
                {
                    var ctx = AllStudyPlan.BindingContext;
                    if (ctx != null)
                    {
                        var selct = SelectedCategories;
                        if (QuestionList == null)
                        {
                            GetQuestionMasterList();
                        }
                        var quesBuild = new List<Question>();
                        foreach (var questionTemplateCategory in SelectedCategories)
                        {
                            quesBuild.AddRange(QuestionList.Where(x => x.StudyPlan.Equals(questionTemplateCategory.CategoryName)).ToList());
                        }
                        if (quesBuild.Count == 0) return;
                        foreach (var ert in QuestionList)
                        {
                            if (ert != null) ert.RefreshForRandom();
                        }
                        var dataCtx = new QuestionSessionManager(AppCache.AssignNumberToQuestion(quesBuild, SessionType.ExamMode).ToList(), SessionType.ExamMode);
                       await Navigation.PushModalAsync(new ExamQuestionPage(dataCtx, 0));
                    }
                }
            };
        }