async void UpBlue_Tapped(object sender, System.EventArgs e)
        {
            //show answer.

            PageDown.IsVisible = false;
            await PageDown.TranslateTo(0, 0, 500, Easing.SinIn);

            var a = answerList.Where(item => item.IsSelected == item.IsCorrect).Select(wrappedItem => new { wrappedItem.Answer, wrappedItem.IsCorrect, wrappedItem.IsSelected }).ToList();
            var b = answerList.Where(item => item.IsSelected == true).Select(wrappedItem => new { wrappedItem.Answer, wrappedItem.IsCorrect, wrappedItem.IsSelected }).ToList();

            if (b.Count != 0)
            {
                if (a.Count == answerList.Count)
                {
                    rightAns.IsVisible  = true;
                    wrongAns.IsVisible  = false;
                    PageDown.IsVisible  = true;
                    stackMain.IsEnabled = false;
                    txtrightAns.Text    = "Congrats Your Answer Is Right";
                }
                else
                {
                    var correctAns = answerList.Where(item => item.IsCorrect == true).Select(wrappedItem => wrappedItem.Answer).ToList();

                    string answer = "";
                    for (int x = 0; x < correctAns.Count(); x++)
                    {
                        answer = answer + correctAns[x] + ", ";
                    }

                    rightAns.IsVisible  = false;
                    wrongAns.IsVisible  = true;
                    PageDown.IsVisible  = true;
                    stackMain.IsEnabled = false;
                    txtwrongAns.Text    = "Your Right Answer Is :" + answer;
                }
            }

            else
            {
                PageDown.IsVisible = false;
                if (Device.OS == TargetPlatform.iOS)
                {
                    await DisplayAlert("Message", "Select any answer", "Ok");
                }
                else
                {
                    XFToast.ShortMessage("Select any answer");
                }
            }
        }
示例#2
0
 async void DownWhite_Tapped(object sender, System.EventArgs e, double translatedX, double translatedY)
 {
     await PageDown.TranslateTo(0, Page.Height, 500, Easing.SinOut);
 }
 async void DownWhite_Tapped(object sender, System.EventArgs e)
 {
     await PageDown.TranslateTo(0, Page.Height, 500, Easing.SinIn);
 }
 async void UpBlue_Tapped(object sender, System.EventArgs e)
 {
     await PageDown.TranslateTo(0, 0, 500, Easing.SinIn);
 }
        async void DownWhite_Tapped(object sender, System.EventArgs e)
        {
            //change question
            stackMain.IsEnabled = true;
            await PageDown.TranslateTo(0, Page.Height, 500, Easing.SinIn);

            var a = answerList.Where(item => item.IsSelected == item.IsCorrect).Select(wrappedItem => new { wrappedItem.Answer, wrappedItem.IsCorrect, wrappedItem.IsSelected }).ToList();
            var b = answerList.Where(item => item.IsSelected == true).Select(wrappedItem => new { wrappedItem.Answer, wrappedItem.IsCorrect, wrappedItem.IsSelected }).ToList();

            if (b.Count != 0)
            {
                quesNo++;
                if (a.Count == answerList.Count)
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        for (int j = 0; j < list[i].listQuestion.Count; j++)
                        {
                            if (i == 0 && j == 0)
                            {
                            }
                            else
                            {
                                lstCnt++;
                                if (quesNo == lstCnt)
                                {
                                    lblQuestion.Text    = list[i].listQuestion[j].Question;
                                    lblquesNo.Text      = "Q." + quesNo;
                                    listAns.ItemsSource = list[i].listQuestion[j].listAnswer;
                                    answerList          = list[i].listQuestion[j].listAnswer;
                                    var multiPage = new SelectMultipleBasePage <AnswerInfo>(answerList);
                                    SetBusyIndicator(false);
                                }
                            }
                        }
                    }
                    if (Qcount == quesNo)
                    {
                        var result = await DisplayAlert("Message", "Quiz Completed", "ok", "");

                        if (result == true)
                        {
                            await Navigation.PushAsync(new MasterPage());

                            SetBusyIndicator(false);
                        }
                        else
                        {
                            return;
                        }
                    }
                    lstCnt = 1;
                    SetBusyIndicator(false);
                }

                else
                {
                    for (int i = 0; i < list.Count; i++)
                    {
                        for (int j = 0; j < list[i].listQuestion.Count; j++)
                        {
                            if (i == 0 && j == 0)
                            {
                            }
                            else
                            {
                                lstCnt++;
                                if (quesNo == lstCnt)
                                {
                                    lblQuestion.Text    = list[i].listQuestion[j].Question;
                                    lblquesNo.Text      = "Q." + quesNo;
                                    listAns.ItemsSource = list[i].listQuestion[j].listAnswer;
                                    answerList          = list[i].listQuestion[j].listAnswer;
                                    var multiPage = new SelectMultipleBasePage <AnswerInfo>(answerList);
                                    SetBusyIndicator(false);
                                }
                            }
                        }
                    }

                    if (Qcount == quesNo)
                    {
                        var result = await DisplayAlert("Message", "Quiz Completed", "ok", "cancel");

                        if (result == true)
                        {
                            await Navigation.PushAsync(new MasterPage());

                            SetBusyIndicator(false);
                        }
                        else
                        {
                            return;
                        }
                    }
                    lstCnt = 1;
                    SetBusyIndicator(false);
                }
            }
            else
            {
                if (Device.OS == TargetPlatform.iOS)
                {
                    await DisplayAlert("Message", "Select any answer", "Ok");
                }
                else
                {
                    XFToast.ShortMessage("Select any answer");
                }
            }
        }