/// <summary>
        /// Update enabled states of page navigation buttons.
        /// </summary>
        private void UpdatePageNavigationButtons()
        {
            int humanIndex = AppDefinition.GetHumanIndex(_currentProductPageIndex);

            if (humanIndex == 1)
            {
                _leftArrowButton.Enabled = false;
            }
            else
            {
                _leftArrowButton.Enabled = true;
            }
            if (humanIndex == _orderModel.GetTabPageProductPagesCount(_currentTabPageIndex))
            {
                _rightArrowButton.Enabled = false;
            }
            else
            {
                _rightArrowButton.Enabled = true;
            }
        }
예제 #2
0
 /// <summary>
 /// Get the page label text.
 /// </summary>
 public string GetPageLabelText()
 {
     return(AppDefinition.PAGE_LABEL_TEXT + AppDefinition.GetHumanIndex(_currentProductPageIndex) + AppDefinition.PAGE_LABEL_DELIMITER + _model.GetTabPageProductPagesCount(_currentTabPageIndex));
 }
예제 #3
0
        /// <summary>
        /// Get product by storageDataGridViewRowIndex.
        /// </summary>
        public Product GetProduct(int storageDataGridViewRowIndex)
        {
            int productId = AppDefinition.GetHumanIndex(storageDataGridViewRowIndex);

            return(_model.GetProduct(productId));
        }
 /// <summary>
 /// Update current product page.
 /// </summary>
 private void UpdateCurrentProductPage()
 {
     _pageLabel.Text = AppDefinition.PAGE_LABEL_TEXT + AppDefinition.GetHumanIndex(_currentProductPageIndex) + AppDefinition.PAGE_LABEL_DELIMITER + _orderModel.GetTabPageProductPagesCount(_currentTabPageIndex);
     UpdatePageNavigationButtons();
     SelectNoProduct();
 }
예제 #5
0
 public void TestGetHumanIndex()
 {
     Assert.ThrowsException <ArgumentException>(() => AppDefinition.GetHumanIndex(-1));
     Assert.AreEqual(AppDefinition.GetHumanIndex(0), 1);
     Assert.AreEqual(AppDefinition.GetHumanIndex(5), 6);
 }