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 selectionchange_dsbaitrong1chuong(object sender, SelectionChangedEventArgs e)
        {
            bai selectedbai = ListView_dsbai.SelectedItem as bai;

            baiduocchon = selectedbai;

            if (selectedbai != null || videoduocchon != null)
            {
                ws                      = new kidmathwebserviceSoapClient();
                videoduocchon           = (ws.getDatavideoAsync().Result.Body.getDatavideoResult.ToList <video>()).Find(video => video.maBai == baiduocchon.maBai);
                txtblock_linkVideo.Text = videoduocchon.linkvideo;
                txtblock_tenVideo.Text  = videoduocchon.tenBai;
                txtblock_maVideo.Text   = videoduocchon.maBai;
            }
            else
            {
                txtblock_linkVideo.Text = " Trống !";
                txtblock_tenVideo.Text  = " Trống !";
                txtblock_maVideo.Text   = " Trống !";
            }
        }
        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 = "";
            }
        }