예제 #1
0
 // 設定button的屬性
 private void SetButtonDetail(ProductButton productButton, int tabCount, int buttonCount)
 {
     productButton.Size = new Size(BUTTON_EDGE, BUTTON_EDGE);
     SetButtonPosition(productButton, buttonCount);
     productButton.TabCount    = tabCount;
     productButton.ButtonCount = _presentationModel.GetProductButtonCount(tabCount) - 1;
     SetButtonImage(productButton, tabCount, productButton.ButtonCount);
 }
예제 #2
0
        // 產品button被按下
        private void ClickProductButton(object sender, EventArgs e)
        {
            ProductButton productButton = sender as ProductButton;

            _productDetailRichTextBox.Text = _model.GetProductIntroduce(productButton.TabCount, productButton.ButtonCount);
            _productPriceLabel.Text        = _presentationModel.GetProductPrice(productButton.TabCount, productButton.ButtonCount);
            _productStockLabel.Text        = _presentationModel.GetProductStock(productButton.TabCount, productButton.ButtonCount);
            _presentationModel.ClickProductButton(productButton.TabCount, productButton.ButtonCount);
        }
예제 #3
0
        // 創建一個新的productButton
        private void CreateSingleProductButton(int tabCount, int buttonCount)
        {
            _presentationModel.CreateProductButton(tabCount);
            ProductButton productButton = new ProductButton();

            SetButtonDetail(productButton, tabCount, buttonCount);
            GiveProductButtonEvents(productButton);
            _productButton[tabCount].Add(productButton);
            _categoryTabPage[tabCount].Controls.Add(productButton);
        }
예제 #4
0
 // 設定button的圖片
 private void SetButtonImage(ProductButton productButton, int tabCount, int buttonCount)
 {
     productButton.BackgroundImageLayout = ImageLayout.Stretch;
     productButton.BackgroundImage       = Image.FromFile(_model.GetImagePath(tabCount, buttonCount));
 }
예제 #5
0
 // 設定button的位置
 private void SetButtonPosition(ProductButton productButton, int buttonCount)
 {
     productButton.Location = new System.Drawing.Point(OrderForm.BUTTON_INTERVAL + (buttonCount % OrderForm.BUTTON_ROW_COUNT) * (OrderForm.BUTTON_EDGE + OrderForm.BUTTON_INTERVAL), OrderForm.BUTTON_INTERVAL + (buttonCount / OrderForm.BUTTON_ROW_COUNT) * (OrderForm.BUTTON_EDGE + OrderForm.BUTTON_INTERVAL));
 }