예제 #1
0
 public CustomerSide(FormData formData, SetUpForm setUpForm)
 {
     InitializeComponent();
     _setUpForm = setUpForm;
     _customerForm.ReadFile(_formData);
     this._formData = formData;
     #region Meal Button init
     #region Create Button List
     for (int i = 0; i < _customerForm.ReadFile(_formData).Count; i++)
     {
         _mealButtonList.Add(new Button());
         _mealGroupBox.Controls.Add(_mealButtonList[i]);
         _mealButtonList[i].Text      = _customerForm.SetMealButtonText(i, _formData);
         _mealButtonList[i].Size      = new Size(Constant.BUTTON_SIZE, Constant.BUTTON_SIZE);
         _mealButtonList[i].Name      = i.ToString();
         _mealButtonList[i].Click    += new EventHandler(this.MealButtonClick);
         _mealButtonList[i].Image     = System.Drawing.Image.FromFile(@"..\..\..\img\MealButtonImg\" + i + Constant.GET_PICTURE);
         _mealButtonList[i].TextAlign = ContentAlignment.BottomLeft;
         _mealButtonList[i].ForeColor = Color.White;
     }
     MealButtonOption mealButtonOption = new MealButtonOption();
     SetMealButtonLocation(_customerForm.ReadFile(_formData));
     #endregion
     SetMealButtonOption();
     SetPageButtonEnable();
     SetPageButtonEnable();
     #endregion
     _pageLabel.Text  = _customerForm.SetPageLabelText(_formData.nowPage, _formData.totalPage);
     _totalLabel.Text = _customerForm.SetTotalPriceLabel(_formData);
     //this.FormClosing();
 }
 public CustomerSide(FormData formData)
 {
     InitializeComponent();
     _customerModel = _customerPresentationModel.GetCustomerModelInstance();
     this._formData = formData;
     _customerPresentationModel.GetMealList();
     _customerPresentationModel.SetTotalPage(_formData);
     #region Meal Button init
     #region Create Button List
     for (int i = 0; i < _customerPresentationModel.GetMealList().Count; i++)
     {
         _mealButtonList.Add(new Button());
         _mealGroupBox.Controls.Add(_mealButtonList[i]);
         _mealButtonList[i].Text      = _customerPresentationModel.SetMealButtonText(i);
         _mealButtonList[i].Size      = new Size(Constant.BUTTON_SIZE, Constant.BUTTON_SIZE);
         _mealButtonList[i].Name      = i.ToString();
         _mealButtonList[i].Click    += new EventHandler(this.MealButtonClick);
         _mealButtonList[i].Image     = System.Drawing.Image.FromFile(@"..\..\..\img\MealButtonImg\" + i + Constant.GET_PICTURE);
         _mealButtonList[i].TextAlign = ContentAlignment.BottomLeft;
         _mealButtonList[i].ForeColor = Color.White;
     }
     MealButtonOption mealButtonOption = new MealButtonOption();
     SetMealButtonLocation(_customerPresentationModel.GetMealList());
     #endregion
     SetMealButtonOption();
     SetPageButtonEnable();
     SetPageButtonEnable();
     #endregion
     _pageLabel.Text  = _customerPresentationModel.SetPageLabelText(_formData.nowPage, _formData.totalPage);
     _totalLabel.Text = _customerPresentationModel.SetTotalPriceLabel(_formData);
     this._orderDataGridView.AllowUserToAddRows = false;
     _addButton.Enabled = false;
 }
예제 #3
0
        /// <summary>
        /// 設定按鈕顯示
        /// </summary>
        public void SetMealButtonOption()
        {
            MealButtonOption mealButtonOption = new MealButtonOption();

            for (int i = 0; i < _mealButtonList.Count; i++)
            {
                if (mealButtonOption.GetButtonOption(_mealButtonList.Count, i, _formData))
                {
                    _mealButtonList[i].Visible = true;
                    _mealButtonList[i].Enabled = true;
                }
                else
                {
                    _mealButtonList[i].Visible = false;
                    _mealButtonList[i].Enabled = false;
                }
            }
        }
예제 #4
0
        /// <summary>
        /// 設定MealButton位置
        /// </summary>
        public void SetMealButtonLocation(List <Homework1.Model.Meal> mealList)
        {
            MealButtonOption mealButtonOption = new MealButtonOption();

            for (int i = 0; i < mealList.Count; i++)
            {
                if (i % Constant.MAX_ROW_NUMBER == 0)
                {
                    _mealButtonList[i].Location = new System.Drawing.Point(Constant.INITIAL_X, Constant.INITIAL_Y + mealButtonOption.GetVariable(i));
                }
                else if (i % Constant.MAX_ROW_NUMBER == 1)
                {
                    _mealButtonList[i].Location = new System.Drawing.Point(Constant.INITIAL_X + Constant.SPACING, Constant.INITIAL_Y + mealButtonOption.GetVariable(i));
                }
                else
                {
                    _mealButtonList[i].Location = new System.Drawing.Point(Constant.INITIAL_X + Constant.SPACING + Constant.SPACING, Constant.INITIAL_Y + mealButtonOption.GetVariable(i));
                }
            }
        }