// invisible next button public void CheckNextButton(string categoryName) { if (_pageControl.Page.Equals(_model.GetMaxPage(categoryName))) { _isNextButtonVisible = false; } else { _isNextButtonVisible = true; } }
// create and change buttons & page public void DisplayTabPageContent(string categoryName) { ShowPageButton(); List <Meal> mealList = _mealControl.GetMealOfCategory(categoryName); for (int index = (_pageControl.Page - 1) * MAX_BUTTONS; index < _pageControl.Page * MAX_BUTTONS; index++) { if (index >= mealList.Count) { break; } int columnIndex = index / MAX_COLUMNS - (_pageControl.Page - 1) * MAX_COLUMNS; int rowIndex = index % MAX_COLUMNS; Meal mealButton = mealList[index]; CreateMealButton(mealButton, rowIndex, columnIndex); } _pageLabel.Text = "Page : " + _pageControl.Page + " / " + _model.GetMaxPage(categoryName); }