private void SetItemPage(LoaiMenu loaiMenu) { btnItemBack.Tag = loaiMenu; btnItemNext.Tag = loaiMenu; switch (loaiMenu) { case LoaiMenu.None: break; case LoaiMenu.Nhom: break; case LoaiMenu.Mon: case LoaiMenu.KichThuocMon: btnItemBack.Content = "Trờ Về"; var uriSource = new Uri(@"/SystemImages;component/Images/Back.png", UriKind.Relative); btnItemBack.Background = System.Windows.Media.Brushes.White; btnItemBack.Image = new BitmapImage(uriSource); btnItemNext.Content = "Tiếp Theo"; uriSource = new Uri(@"/SystemImages;component/Images/Forward.png", UriKind.Relative); btnItemNext.Background = System.Windows.Media.Brushes.White; btnItemNext.Image = new BitmapImage(uriSource); btnItemBack.Visibility = System.Windows.Visibility.Visible; btnItemNext.Visibility = System.Windows.Visibility.Visible; btnItemBack.IsEnabled = true; btnItemNext.IsEnabled = true; btnItemNext.Click += new RoutedEventHandler(btnItemNext_Click); btnItemBack.Click += new RoutedEventHandler(btnItemBack_Click); break; default: break; } }
private void btnItemBack_Click(object sender, RoutedEventArgs e) { LoaiMenu lm = (LoaiMenu)btnItemBack.Tag; switch (lm) { case LoaiMenu.None: btnItems_Click(sender, e); break; case LoaiMenu.Nhom: break; case LoaiMenu.Mon: if (PageItems > 1) { PageItems--; LoadMon(MenuNhomIndex.MenuNhom.NhomID); } break; case LoaiMenu.KichThuocMon: if (PageKichThuocMon > 1) { PageKichThuocMon--; LoadKichThuocMon(MenuMonIndex); } break; default: break; } }
private void btnItemNext_Click(object sender, RoutedEventArgs e) { LoaiMenu lm = (LoaiMenu)btnItemNext.Tag; switch (lm) { case LoaiMenu.None: btnItems_Click(sender, e); break; case LoaiMenu.Nhom: break; case LoaiMenu.Mon: if (MenuNhomIndex != null) { if (PageItems < lsMenuMon.Count / (gridItems.Children.Count - 2) + 1) { PageItems++; LoadMon(MenuNhomIndex.MenuNhom.NhomID); } } break; case LoaiMenu.KichThuocMon: if (MenuNhomIndex != null) { if (PageKichThuocMon < lsMenuKichThuocMon.Count / (gridItems.Children.Count - 2) + 1) { PageKichThuocMon++; LoadKichThuocMon(MenuMonIndex); } } break; default: break; } }
private void SetItemPage(LoaiMenu loaiMenu) { btnItemBack.Tag = loaiMenu; btnItemNext.Tag = loaiMenu; switch (loaiMenu) { case LoaiMenu.None: break; case LoaiMenu.Nhom: break; case LoaiMenu.Mon: case LoaiMenu.KichThuocMon: btnItemBack.Content = "Trờ Về"; var uriSource = new Uri(@"/SystemImages;component/Images/Back.png", UriKind.Relative); btnItemBack.Background = System.Windows.Media.Brushes.White; btnItemBack.Image = new BitmapImage(uriSource); btnItemNext.Content = "Tiếp Theo"; uriSource = new Uri(@"/SystemImages;component/Images/Forward.png", UriKind.Relative); btnItemNext.Background = System.Windows.Media.Brushes.White; btnItemNext.Image = new BitmapImage(uriSource); btnItemBack.Visibility = System.Windows.Visibility.Visible; btnItemNext.Visibility = System.Windows.Visibility.Visible; btnItemBack.IsEnabled = true; btnItemNext.IsEnabled = true; btnItemNext.Click += new RoutedEventHandler(btnItemNext_Click); btnItemBack.Click += new RoutedEventHandler(btnItemBack_Click); break; default: break; } }