private void LopvaChuongPage_AfterLogin_Loaded(object sender, RoutedEventArgs e)
        {
            txtblock_tenKhoaHoc.Text = "Bạn đang xem khóa học: " + khoahocdangxem.tenKhoaHoc;
            User_btn.Content         = "Xin chào, " + UserSession.userlogined.tenNguoiDung;


            ws       = new kidmathwebserviceSoapClient();
            dschuong = ws.getDataChuongAsync().Result.Body.getDataChuongResult.ToList <chuong>();
            dschuong = dschuong.FindAll(chuong => chuong.maKhoaHoc == khoahocdangxem.maKhoaHoc);
            dstenchuong.ItemsSource = dschuong;
            chuongduocchon          = dschuong[0];


            ws    = new kidmathwebserviceSoapClient();
            dsbai = ws.getDataBaiAsync().Result.Body.getDataBaiResult.ToList <bai>();
            dsbai = dsbai.FindAll(bai => bai.maChuong == chuongduocchon.maChuong);
            listbox_dsbaihoctrong1chuong.ItemsSource = dsbai;
            baiduocchon        = dsbai[0];
            tenbaihienthi.Text = baiduocchon.tenBai;

            ws                      = new kidmathwebserviceSoapClient();
            videoduocchon           = (ws.getDatavideoAsync().Result.Body.getDatavideoResult.ToList <video>()).Find(video => video.maBai == baiduocchon.maBai);
            VideoPage.videoduocchon = videoduocchon;
            Active_frame.Navigate((typeof(VideoPage)));

            ws       = new kidmathwebserviceSoapClient();
            dsbaithi = ws.getDataDanhSachCauHoiAsync().Result.Body.getDataDanhSachCauHoiResult.ToList <danhSachCauHoi>();
            dsbaithi = dsbaithi.FindAll(baithi => baithi.maBai == baiduocchon.maBai);
        }
Пример #2
0
 private void btnclick_cauhoi(string buttonnumber)
 {
     if (btn_batdauthi.IsEnabled == false)
     {
         caudangchon           = int.Parse(buttonnumber) - 1;
         namedapanA.Visibility = Visibility.Visible;
         namedapanB.Visibility = Visibility.Visible;
         namedapanC.Visibility = Visibility.Visible;
         namedapanD.Visibility = Visibility.Visible;
         daa.Visibility        = Visibility.Visible;
         dab.Visibility        = Visibility.Visible;
         dac.Visibility        = Visibility.Visible;
         dad.Visibility        = Visibility.Visible;
         ws = new kidmathwebserviceSoapClient();
         List <danhSachCauHoi> dscauhoi = new List <danhSachCauHoi>();
         dscauhoi = ws.getDataDanhSachCauHoiAsync().Result.Body.getDataDanhSachCauHoiResult.ToList <danhSachCauHoi>();
         danhSachCauHoi cauhoi = new danhSachCauHoi();
         cauhoi = dscauhoi.Find(quest => quest.maCauHoi == buttonnumber && quest.maBai == mabaihocdangthi);
         txtblock_Cauhoi.Text = cauhoi.tenCauHoi;
         txtblock_A.Text      = cauhoi.A;
         txtblock_B.Text      = cauhoi.B;
         txtblock_C.Text      = cauhoi.C;
         txtblock_D.Text      = cauhoi.D;
         if (ketquabaithi[caudangchon] == 'A')
         {
             namedapanA.IsChecked = true;
         }
         else if (ketquabaithi[caudangchon] == 'B')
         {
             namedapanB.IsChecked = true;
         }
         else if (ketquabaithi[caudangchon] == 'C')
         {
             namedapanC.IsChecked = true;
         }
         else if (ketquabaithi[caudangchon] == 'D')
         {
             namedapanD.IsChecked = true;
         }
         dapandung[caudangchon] = cauhoi.dapAnDung;
     }
     else
     {
         var msgerr = new MessageDialog("Lỗi xảy ra khi chọn câu hỏi. Hãy chắc chắn rằng bạn đã chọn bài và ấn vào nút Bắt đầu thi").ShowAsync();
     };
 }
        private async void  selectionchange_dsbaitrong1chuong(object sender, SelectionChangedEventArgs e)
        {
            bai selectedbai = listbox_dsbaihoctrong1chuong.SelectedItem as bai;

            baiduocchon        = selectedbai;
            tenbaihienthi.Text = baiduocchon.tenBai;

            if (selectedbai != null)
            {
                ws       = new kidmathwebserviceSoapClient();
                dsbaithi = ws.getDataDanhSachCauHoiAsync().Result.Body.getDataDanhSachCauHoiResult.ToList <danhSachCauHoi>();
                dsbaithi = dsbaithi.FindAll(baithi => baithi.maBai == baiduocchon.maBai);


                switch (loadFrameStatus)
                {
                case "video":
                    ws                      = new kidmathwebserviceSoapClient();
                    videoduocchon           = (ws.getDatavideoAsync().Result.Body.getDatavideoResult.ToList <video>()).Find(video => video.maBai == baiduocchon.maBai);
                    loadFrameStatus         = "video";
                    VideoPage.videoduocchon = videoduocchon;
                    Active_frame.Navigate(typeof(VideoPage));
                    break;

                case "test":
                    if (checkbuy == "buy")
                    {
                        BaithiPage.mabaihocdangthi = baiduocchon.maBai;
                        loadFrameStatus            = "test";
                        Active_frame.Navigate(typeof(BaithiPage));
                    }
                    else if (checkbuy == "notbuy")
                    {
                        var msg = new MessageDialog("Bạn chưa mua khóa học này");
                        msg.Commands.Add(new UICommand()
                        {
                            Id = 0, Label = "Mua khóa học này"
                        });
                        msg.Commands.Add(new UICommand()
                        {
                            Id = 1, Label = "Tiếp tục học thử"
                        });

                        var rs = await msg.ShowAsync();

                        if ((int)rs.Id == 0)
                        {
                            BuyCoursePage.khoahocduocmua = khoahocdangxem;
                            this.Frame.Navigate(typeof(BuyCoursePage));
                        }
                        else if ((int)rs.Id == 1)
                        {
                            loadFrameStatus = "video";
                            this.Frame.Navigate(typeof(VideoPage));
                        }
                    }
                    break;

                case "download":
                    Active_frame.Navigate(typeof(BaitapPage));
                    break;

                default:
                    break;
                }
            }
            else
            {
                //  mabai = "";
            }
        }