コード例 #1
0
ファイル: HocDaiSo.xaml.cs プロジェクト: truongngoctuan/toan8
        protected void KhoiTaoCuonSach()
        {
            listDSBaiHoc = new List <BaiHoc>();

            LoadDanhSachBaiHoc();
            for (int i = 1; i < listDSBaiHoc.Count - 1; i++)//bỏ qua trang bìa và trang cuối
            {
                // tạo một trang sách lý thuyết
                TrangLyThuyet temp = new TrangLyThuyet();
                // TrangLyThuyet temp = new TrangLyThuyet(System.IO.Directory.GetCurrentDirectory()+ listDSBaiHoc[i].StrDuongDan);
                this.myBook.Items.Add(temp);
                // trang bài tập: Có truyền tham số vào. đây chỉ là vi dụ
                //UCTrangBaiTap trangBaiTap = new UCTrangBaiTap(listDSBaiHoc[i].IChuong, listDSBaiHoc[i].IBai);
                UCTrangBaiTap trangBaiTap = new UCTrangBaiTap();
                this.myBook.Items.Add(trangBaiTap);
            }
            //thêm trang cuối
            this.myBook.Items.Add(new UCTheEnd());
            //Khỏi tạo cờ đánh dấu trang nào đã được tạo
            listTrangSachDaDuocTao = new List <bool>();
            for (int i = 0; i < listDSBaiHoc.Count * 2 + 2; i++)
            {
                listTrangSachDaDuocTao.Add(false);
            }
            // listTrangSachDaDuocTao
            this.cbDanhSachBai.ItemsSource       = listDSBaiHoc;
            this.cbDanhSachBai.DisplayMemberPath = "StrName";
            cbDanhSachBai.SelectedIndex          = 0;
            this.cbDanhSachBai.SelectionChanged += new SelectionChangedEventHandler(cbDanhSachBai_SelectionChanged);
        }
コード例 #2
0
ファイル: HocDaiSo.xaml.cs プロジェクト: truongngoctuan/toan8
        protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
        {
            int iTrangHienTai = this.myBook.CurrentSheetIndex;

            if (iTrangHienTai + 1 < listDSBaiHoc.Count - 1)
            {
                if (listTrangSachDaDuocTao[(iTrangHienTai + 1) * 2] == false)
                {
                    UCTrangBaiTap trangBaiTap = new UCTrangBaiTap(_mpathSach, listDSBaiHoc[iTrangHienTai + 1].IChuong, listDSBaiHoc[iTrangHienTai + 1].IBai);
                    myBook.Items[(iTrangHienTai + 1) * 2] = trangBaiTap;
                }
                if (listTrangSachDaDuocTao[(iTrangHienTai + 1) * 2 - 1] == false)
                {
                    TrangLyThuyet trangLyThuyet = new TrangLyThuyet(System.IO.Directory.GetCurrentDirectory() + listDSBaiHoc[iTrangHienTai + 1].StrDuongDan);
                    myBook.Items[(iTrangHienTai + 1) * 2 - 1] = trangLyThuyet;
                }
            }
            // Nếu trang chưa được tạo thì tạo mới
            if (iTrangHienTai - 1 > 0)
            {
                if (listTrangSachDaDuocTao[(iTrangHienTai - 1) * 2] == false)
                {
                    UCTrangBaiTap trangBaiTap = new UCTrangBaiTap(_mpathSach, listDSBaiHoc[iTrangHienTai - 1].IChuong, listDSBaiHoc[iTrangHienTai - 1].IBai);
                    myBook.Items[(iTrangHienTai - 1) * 2] = trangBaiTap;
                }
                if (listTrangSachDaDuocTao[(iTrangHienTai - 1) * 2 - 1] == false)
                {
                    TrangLyThuyet trangLyThuyet = new TrangLyThuyet(System.IO.Directory.GetCurrentDirectory() + listDSBaiHoc[iTrangHienTai - 1].StrDuongDan);
                    myBook.Items[(iTrangHienTai - 1) * 2 - 1] = trangLyThuyet;
                }
            }
        }
コード例 #3
0
ファイル: HocDaiSo.xaml.cs プロジェクト: truongngoctuan/toan8
        void cbDanhSachBai_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int iTrangHienTai = this.cbDanhSachBai.SelectedIndex;

            if (iTrangHienTai != -1)
            {
                //if (iTrangHienTai > myBook.CurrentSheetIndex  )
                //   myBook.AnimateToLeftSheet();
                //else
                //   myBook.AnimateToRightSheet();
                myBook.CurrentSheetIndex = iTrangHienTai;
                if (iTrangHienTai > 0 && iTrangHienTai < listDSBaiHoc.Count - 1 && listTrangSachDaDuocTao[iTrangHienTai * 2] == false)
                {
                    UCTrangBaiTap trangBaiTap = new UCTrangBaiTap(_mpathSach, listDSBaiHoc[iTrangHienTai].IChuong, listDSBaiHoc[iTrangHienTai].IBai);
                    myBook.Items[iTrangHienTai * 2] = trangBaiTap;
                }
                // Nếu trang chưa được tạo thì tạo mới
                if (iTrangHienTai > 0 && iTrangHienTai < listDSBaiHoc.Count - 1 && listTrangSachDaDuocTao[iTrangHienTai * 2 - 1] == false)
                {
                    TrangLyThuyet trangLyThuyet = new TrangLyThuyet(System.IO.Directory.GetCurrentDirectory() + listDSBaiHoc[iTrangHienTai].StrDuongDan);
                    myBook.Items[iTrangHienTai * 2 - 1] = trangLyThuyet;
                }


                myBook.Focus();
            }
        }