private async void loadData() { ques = await itemsTable.ToListAsync(); total = ques.Count; curQuestion = ques[curIndex]; setData(curQuestion, (curIndex + 1), total); }
private void setData(IQ Cques, int c, int t) { question.Text = Cques.question; Opt1.Content = Cques.opt1; Opt2.Content = Cques.opt2; Opt3.Content = Cques.opt3; Opt4.Content = Cques.opt4; Opt5.Content = Cques.opt5; if (Cques.UserAns == 1) Opt1.IsChecked = true; else if (Cques.UserAns == 2) Opt2.IsChecked = true; else if (Cques.UserAns == 3) Opt3.IsChecked = true; else if (Cques.UserAns == 4) Opt4.IsChecked = true; else if (Cques.UserAns == 5) Opt5.IsChecked = true; else Opt1.IsChecked = true; questionNo.Text = c + "/" + t; }
private async void load() { try { await LocalStorage.Restore<IQ>(); ques = LocalStorage.Data; } catch { } total = ques.Count; curQuestion = ques[curIndex]; setData(curQuestion, (curIndex + 1), total); }
private void setData(IQ Cques, int c, int t) { question.Text = Cques.question; Opt1.Content = Cques.opt1; Opt2.Content = Cques.opt2; Opt3.Content = Cques.opt3; Opt4.Content = Cques.opt4; Opt5.Content = Cques.opt5; if (Cques.ans == 1) { Opt1.IsChecked = true; imgAns.Source = Cques.UserAns == 1 ? new BitmapImage(new Uri("ms-appx:/Assets/c.png", UriKind.RelativeOrAbsolute)) : new BitmapImage(new Uri("ms-appx:/Assets/w.png", UriKind.RelativeOrAbsolute)); } else if (Cques.ans == 2) { Opt2.IsChecked = true; imgAns.Source = Cques.UserAns == 2 ? new BitmapImage(new Uri("ms-appx:/Assets/c.png", UriKind.RelativeOrAbsolute)) : new BitmapImage(new Uri("ms-appx:/Assets/w.png", UriKind.RelativeOrAbsolute)); } else if (Cques.ans == 3) { Opt3.IsChecked = true; imgAns.Source = Cques.UserAns == 3 ? new BitmapImage(new Uri("ms-appx:/Assets/c.png", UriKind.RelativeOrAbsolute)) : new BitmapImage(new Uri("ms-appx:/Assets/w.png", UriKind.RelativeOrAbsolute)); } else if (Cques.ans == 4) { Opt4.IsChecked = true; imgAns.Source = Cques.UserAns == 4 ? new BitmapImage(new Uri("ms-appx:/Assets/c.png", UriKind.RelativeOrAbsolute)) : new BitmapImage(new Uri("ms-appx:/Assets/w.png", UriKind.RelativeOrAbsolute)); } else if (Cques.ans == 5) { Opt5.IsChecked = true; imgAns.Source = Cques.UserAns == 5 ? new BitmapImage(new Uri("ms-appx:/Assets/c.png", UriKind.RelativeOrAbsolute)) : new BitmapImage(new Uri("ms-appx:/Assets/w.png", UriKind.RelativeOrAbsolute)); } questionNo.Text = c + "/" + t; }
private void Prev_OnClick(object sender, RoutedEventArgs e) { if (curIndex > 0) { curIndex--; curQuestion = ques[curIndex]; setData(curQuestion, (curIndex + 1), total); } }
private void Next_OnClick(object sender, RoutedEventArgs e) { if ((curIndex + 1) < total) { curIndex++; curQuestion = ques[curIndex]; setData(curQuestion, (curIndex + 1), total); } }