//Nút đăng xuất private void btnDangXuat_Click(object sender, RoutedEventArgs e) { BatDauUPresentation _bd = new BatDauUPresentation(); _bd._DangNhap = _DangNhap; _bd._ChonChucNang += new EventHandler(ChonChucNang_WPFBatDau); gdContentMain.Children.Clear(); gdContentMain.Children.Add(_bd); btnBack.Visibility = System.Windows.Visibility.Collapsed; lbTitle.Visibility = System.Windows.Visibility.Collapsed; }
//Nút back private void btnBack_Click(object sender, RoutedEventArgs e) { switch (_menu) { case 0: //Giao diện bắt đầu BatDauUPresentation _wpfBatdau = new BatDauUPresentation(); _wpfBatdau._ChonChucNang += new EventHandler(ChonChucNang_WPFBatDau); gdContentMain.Children.Clear(); gdContentMain.Children.Add(_wpfBatdau); break; case 1: //Trang chủ TrangChuUPresentation wpf_Home = new TrangChuUPresentation(); wpf_Home._lstQuyen = _lstQuyen; wpf_Home._ChonChucNang += new EventHandler(ChonChucNang_TrangChu); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_Home); break; case 2: //Kho KhoUPresentation wpf_kho = new KhoUPresentation(); wpf_kho._lstQuyen = _lstQuyen; wpf_kho._ChonChucNang += new EventHandler(ChonChucNang_KHO); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_kho); break; case 3: //Báo cáo ThongKeBaoCaoUPresentation wpf_baocao = new ThongKeBaoCaoUPresentation(); wpf_baocao._lstQuyen = _lstQuyen; wpf_baocao._ChonChucNang += new EventHandler(ChonChucNang_ThongKeBaoCao); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_baocao); break; case 4: //Thiết lập ThietLapUPresentation wpf_thietlap = new ThietLapUPresentation(); wpf_thietlap._lstQuyen = _lstQuyen; wpf_thietlap.evChonChucNang += new EventHandler(evMoChucNang); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_thietlap); break; } lbTitle.Visibility = System.Windows.Visibility.Collapsed; btnBack.Visibility = System.Windows.Visibility.Collapsed; }
//LOADED private void Window_Loaded(object sender, RoutedEventArgs e) { //Hiển thị tên cửa hàng // _thietLap = ThietLapHeThongBusiness.LayThietLapHeThong(); //HienThiCuaHang(); //Hiển thị wpf bắt đầu khi vào chương trình BatDauUPresentation wpf = new BatDauUPresentation(); wpf._DangNhap = _DangNhap; wpf._ChonChucNang += new EventHandler(ChonChucNang_WPFBatDau); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf); //Chưa đăng nhập gdMenu.IsEnabled = _DangNhap; }
//Phương thức chọn chức năng - Wpf bắt đầu private void ChonChucNang_WPFBatDau(object sender, EventArgs e) { //Lấy thông tin BatDauUPresentation _wpfBatDau = (BatDauUPresentation)sender; int _ChucNang = _wpfBatDau._ChucNang; switch (_ChucNang) { case 1: //Đăng nhập btnBack.Visibility = System.Windows.Visibility.Visible; _menu = 0; DangNhapUPresentation wpf_DangNhap = new DangNhapUPresentation(); wpf_DangNhap.DangNhap += new EventHandler(DangNhap); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_DangNhap); break; case 2: //Đăng xuất _NhanVien = null; _lstQuyen = null; gdMenu.IsEnabled = false; _DangNhap = false; BatDauUPresentation wpf_bd = new BatDauUPresentation(); wpf_bd._DangNhap = _DangNhap; wpf_bd._ChonChucNang += new EventHandler(ChonChucNang_WPFBatDau); gdContentMain.Children.Clear(); gdContentMain.Children.Add(wpf_bd); HienThiNhanVien(); break; default: break; } }