/* * public ListInstanceForm() * { * initializeComponent(); * } */ public ListInstanceForm(ApplicationMediator pMediator, NumberBoxForm pParent, LPS_LotteryPointSale pPointSale, LDT_LotteryDrawType pDrawType, DateTime pDrawDate) { this.optionMenuEnabled = true; this.numberBoxFormParent = pParent; this.listSelectorFormParent = null; this.pointSale = pPointSale; this.drawType = pDrawType; this.drawDate = pDrawDate; //this.numberDetail = null; initializeComponent(); // Establecer el ApplicationMediator this.appMediator = pMediator; this.ticketPrintService = new TicketPrintService(); //this.lotteryListControl.resetCurrentCell(); }
public void showFormInMainPanel(MainModuleForm pForm, DateTime? pDrawDate = null, long pGroupId = 0, bool pUpdateBox=false) { MainModuleForm existingForm = getExistingForm(pForm); // Validar si existe o no el formulario if (existingForm == null) { this.centerBoxPanel.Hide(); // Agregar BoxNumber al AppMediator if (pForm.type == SystemConstants.NUMBER_BOX_CODE) { this.mediator.appNumberBox = (NumberBoxForm) pForm; } // Agregar a la aplicación el nuevo formulario si no existe MainModuleForm formToAdd = pForm as MainModuleForm; formToAdd.TopLevel = false; formToAdd.Dock = DockStyle.Fill; this.centerBoxPanel.Controls.Add(formToAdd); this.centerBoxPanel.Tag = formToAdd; formToAdd.Show(); formToAdd.BringToFront(); this.mediator.updateBoxNumber(0, DateTime.Today); this.centerBoxPanel.Show(); } else { // Destruir el formulario nuevo y mostrar el existente pForm.Dispose(); if (this.activeFormType != existingForm.type || pUpdateBox) //if(true) { this.centerBoxPanel.Hide(); existingForm.BringToFront(); // Si se trae al frente un NumberBoxForm, se debe actualizar if (existingForm.type == SystemConstants.NUMBER_BOX_CODE) { NumberBoxForm numberBox = (NumberBoxForm)existingForm; numberBox.updateNumberBox(pDrawDate, pGroupId); } else { this.mediator.updateBoxNumber(0, DateTime.Today); } this.centerBoxPanel.Show(); } } this.activeFormType = pForm.type; }