예제 #1
0
 private void nextButton_Click(object sender, RoutedEventArgs e)
 {
     if (string.IsNullOrEmpty(searchBox.Text) &&
         classificationListView.SelectedIndex == -1 &&
         showFavoriteCheckBox.IsChecked == false)
     {
         if (PageInfomation.currentPage != PageInfomation.total())
         {
             PageInfomation.currentPage += 1;
             updatePageInfomation();
             dataListView.ItemsSource = Global.data.recipes.Skip((PageInfomation.currentPage - 1) * PageInfomation.pageSize).Take(PageInfomation.pageSize);
         }
     }
     else
     {
         if (filterResultRecipes.Count() != 0)
         {
             if (PageInfomation.currentPage != PageInfomation.total())
             {
                 PageInfomation.currentPage += 1;
                 updatePageInfomation();
                 dataListView.ItemsSource = filterResultRecipes.Skip((PageInfomation.currentPage - 1) * PageInfomation.pageSize).Take(PageInfomation.pageSize);
             }
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Cập nhật thông tin phân trang
        /// </summary>
        private void updatePageInfomation()
        {
            pageInfomationText.Text = $"{PageInfomation.currentPage} / {PageInfomation.total()}";

            if (PageInfomation.currentPage == PageInfomation.total())
            {
                nextButton.IsEnabled = false;
            }
            else
            {
                nextButton.IsEnabled = true;
            }

            if (PageInfomation.currentPage == 1 ||
                PageInfomation.currentPage == 0)
            {
                previousButton.IsEnabled = false;
            }
            else
            {
                previousButton.IsEnabled = true;
            }
        }