Example #1
0
 public MenuForm(OrderFormPresentationModel orderFormPresentationModel, InventoryFormPresentationModel inventoryFormPresentationModel, ProductManagementPresentationModel productManagementPresentationModel)
 {
     InitializeComponent();
     _orderSystemButton.Click         += ClickOrderSystemButton;
     _inventorySystemButton.Click     += ClickInventorySystemButton;
     _productManageSystemButton.Click += ClickProductManageSystemButton;
     _exitButton.Click                  += ClickExitButton;
     _orderFormPresentationModel         = orderFormPresentationModel;
     _inventoryFormPresentationModel     = inventoryFormPresentationModel;
     _productManagementPresentationModel = productManagementPresentationModel;
     _inventoryForm                      = new InventoryForm(_inventoryFormPresentationModel);
     _orderForm                          = new OrderForm(_orderFormPresentationModel);
     _productManagementForm              = new ProductManagementForm(_productManagementPresentationModel);
     _inventoryForm.FormClosing         += HandleInventoryFormFormClosing;
     _orderForm.FormClosing             += HandleOrderFormFormClosing;
     _productManagementForm.FormClosing += HandleProductManagementFormFormClosing;
 }
Example #2
0
 public ProductManagementForm(ProductManagementPresentationModel productManagementPresentationModel)
 {
     InitializeComponent();
     // every event
     _productManagementPresentationModel = productManagementPresentationModel;
     _tabControl.Selected                       += HandleTabControlSelectedEvent;
     _addNewProductButton.Click                 += HandleAddNewButtonClick;
     _buttonNewCategory.Click                   += HandleAddNewButtonClick;
     _productListBox.SelectedIndexChanged       += HandleProductListBoxSelectedIndexChanged;
     _listBoxCategory.SelectedIndexChanged      += HandleCategoryListBoxSelectedIndexChanged;
     _productNameTextBox.TextChanged            += HandleProductInformationChangedEvent;
     _priceTextBox.TextChanged                  += HandleProductInformationChangedEvent;
     _picturePathTextBox.TextChanged            += HandleProductInformationChangedEvent;
     _descriptionRichTextBox.TextChanged        += HandleProductInformationChangedEvent;
     _categoryComboBox.SelectionChangeCommitted += HandleProductInformationChangedEvent;
     _textBoxCategoryName.TextChanged           += HandleCategoryInformationChangedEvent;
     _button.Click          += HandleButtonClick;
     _buttonNew.Click       += HandleButtonNewClick;
     _browseButton.Click    += HandleBrowseButtonClick;
     _priceTextBox.KeyPress += HandleTextBoxKeyPress;
     FormClosing            += HandleFormClosing;
     _productManagementPresentationModel._clearAllDataEvent += CleanAllData;
     // databiding product management
     _button.DataBindings.Add(Constant.ENABLED, _productManagementPresentationModel, IS_BUTTON_PRODUCT_SAVE_ENABLE);
     _addNewProductButton.DataBindings.Add(Constant.ENABLED, _productManagementPresentationModel, IS_BUTTON_ADD_ENABLE);
     _button.DataBindings.Add(Constant.TEXT, _productManagementPresentationModel, BUTTON_SAVE_ADD_TEXT);
     _groupBox.DataBindings.Add(Constant.TEXT, _productManagementPresentationModel, GROUP_BOX_PRODUCT_TEXT);
     // databiding category management
     _buttonNew.DataBindings.Add(Constant.ENABLED, _productManagementPresentationModel, IS_BUTTON_PRODUCT_SAVE_ENABLE);
     _buttonNewCategory.DataBindings.Add(Constant.ENABLED, _productManagementPresentationModel, IS_BUTTON_ADD_ENABLE);
     _groupBoxCategory.DataBindings.Add(Constant.TEXT, _productManagementPresentationModel, GROUP_BOX_CATEGORY_TEXT);
     // initialize function
     InitializeTabPage();
     RefreshListBox();
     RefreshCategoryInformation();
 }