/// <summary> /// Instantiates a template object and adds the control to the active page panel for loading/viewing /// </summary> private void CreateKpiFollowUpTwoTemplate() { topHandleBarModel.Section = "Follow Up II"; KPIFollowUpTwoTemplate kpiFollowUpTwoTemplate = new KPIFollowUpTwoTemplate() { Name = "FollowUp", Dock = DockStyle.Fill }; pnl_activePage.Controls.Add(kpiFollowUpTwoTemplate); kpiFollowUpTwoTemplate.BringToFront(); }
/// <summary> /// Refreshes the active template that is within pnl_activePage. This is called when the /// application is made full screen and normal size. This is for the column chart located /// on each template. /// </summary> public void RefreshTemplate() { if (navigationController.MainTag == Navigation.MainNavigationTag.KPA) { switch (navigationController.SectionTag) { case Navigation.SectionNavigationTag.Plan: KPAPlanTemplate kpaPlan = (KPAPlanTemplate)activeTemplate; kpaPlan.RefreshTemplate(); break; case Navigation.SectionNavigationTag.Purch: KPAPurchTemplate kpaPurch = (KPAPurchTemplate)activeTemplate; kpaPurch.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchSub: KPAPurchSubTemplate kpaPurchSub = (KPAPurchSubTemplate)activeTemplate; kpaPurchSub.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchTotal: KPAPurchTotalTemplate kpaPurchTotal = (KPAPurchTotalTemplate)activeTemplate; kpaPurchTotal.RefreshTemplate(); break; case Navigation.SectionNavigationTag.FollowUp: KPAFollowUpTemplate kpaFollowUp = (KPAFollowUpTemplate)activeTemplate; kpaFollowUp.RefreshTemplate(); break; case Navigation.SectionNavigationTag.HotJobs: KPAHotJobsTemplate kpaHotJobs = (KPAHotJobsTemplate)activeTemplate; kpaHotJobs.RefreshTemplate(); break; case Navigation.SectionNavigationTag.ExcessStockStock: KPAExcessStockStock kapExcessStockStock = (KPAExcessStockStock)activeTemplate; kapExcessStockStock.RefreshTemplate(); break; case Navigation.SectionNavigationTag.ExcessStockOpenOrders: KPAExcessStockOpenOrders kpaExcessStockOpenOrders = (KPAExcessStockOpenOrders)activeTemplate; kpaExcessStockOpenOrders.RefreshTemplate(); break; case Navigation.SectionNavigationTag.CurrentPlanVsActual: KPACurrentPlanActualTemplate kpaCurrPlanActual = (KPACurrentPlanActualTemplate)activeTemplate; kpaCurrPlanActual.RefreshTemplate(); break; default: break; } } else // The has KPI currently loaded { switch (navigationController.SectionTag) { case Navigation.SectionNavigationTag.Plan: KPIPlanTemplate kpiPlan = (KPIPlanTemplate)activeTemplate; kpiPlan.RefreshTemplate(); break; case Navigation.SectionNavigationTag.Purch: KPIPurchTemplate kpiPurch = (KPIPurchTemplate)activeTemplate; kpiPurch.RefreshTemplate(); break; case Navigation.SectionNavigationTag.FollowUp: KPIFollowUpTemplate kpiFollowUp = (KPIFollowUpTemplate)activeTemplate; kpiFollowUp.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PlanII: KPIPlanTwoTemplate kpiPlanTwo = (KPIPlanTwoTemplate)activeTemplate; kpiPlanTwo.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchII: KPIPurchTwoTemplate kpiPurchTwo = (KPIPurchTwoTemplate)activeTemplate; kpiPurchTwo.RefreshTemplate(); break; case Navigation.SectionNavigationTag.FollowUpTwo: KPIFollowUpTwoTemplate kpiFollowUpTwo = (KPIFollowUpTwoTemplate)activeTemplate; kpiFollowUpTwo.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchSub: KPIPurchSubTemplate kpiPurchSub = (KPIPurchSubTemplate)activeTemplate; kpiPurchSub.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchTotal: KPIPurchTotalTemplate kpiPurchTotal = (KPIPurchTotalTemplate)activeTemplate; kpiPurchTotal.RefreshTemplate(); break; case Navigation.SectionNavigationTag.PurchPlan: KPIPurchPlanTemplate kpiPurchPlan = (KPIPurchPlanTemplate)activeTemplate; kpiPurchPlan.RefreshTemplate(); break; case Navigation.SectionNavigationTag.Other: KPIOtherTemplate kpiOther = (KPIOtherTemplate)activeTemplate; kpiOther.RefreshTemplate(); break; default: break; } } }
/// <summary> /// Triggered when a controls is added to the active page panel (pnl_activePage). depending on /// what control was added, that templates data will be loaded. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void pnl_activePage_ControlAdded(object sender, ControlEventArgs e) { if (e.Control is Correlation.CorrelationControl) { return; } if (e.Control is UserControl) { if (navigationController.MainTag == Navigation.MainNavigationTag.KPA) { switch (navigationController.SectionTag) { case Navigation.SectionNavigationTag.Plan: KPAPlanTemplate kpaPlan = (KPAPlanTemplate)e.Control; kpaPlan.LoadPanel(); activeTemplate = kpaPlan; break; case Navigation.SectionNavigationTag.Purch: KPAPurchTemplate kpaPurch = (KPAPurchTemplate)e.Control; kpaPurch.LoadPanel(); activeTemplate = kpaPurch; break; case Navigation.SectionNavigationTag.PurchSub: KPAPurchSubTemplate kpaPurchSub = (KPAPurchSubTemplate)e.Control; kpaPurchSub.LoadPanel(); activeTemplate = kpaPurchSub; break; case Navigation.SectionNavigationTag.PurchTotal: KPAPurchTotalTemplate kpaPurchTotal = (KPAPurchTotalTemplate)e.Control; kpaPurchTotal.LoadPanel(); activeTemplate = kpaPurchTotal; break; case Navigation.SectionNavigationTag.FollowUp: KPAFollowUpTemplate kpaFollowUp = (KPAFollowUpTemplate)e.Control; kpaFollowUp.LoadPanel(); activeTemplate = kpaFollowUp; break; case Navigation.SectionNavigationTag.HotJobs: KPAHotJobsTemplate kpaHotJobs = (KPAHotJobsTemplate)e.Control; kpaHotJobs.LoadPanel(); activeTemplate = kpaHotJobs; break; case Navigation.SectionNavigationTag.ExcessStockStock: KPAExcessStockStock kpaExcessStockStock = (KPAExcessStockStock)e.Control; kpaExcessStockStock.LoadPanel(); activeTemplate = kpaExcessStockStock; break; case Navigation.SectionNavigationTag.ExcessStockOpenOrders: KPAExcessStockOpenOrders kpaExcessStockOpenOrders = (KPAExcessStockOpenOrders)e.Control; kpaExcessStockOpenOrders.LoadPanel(); activeTemplate = kpaExcessStockOpenOrders; break; case Navigation.SectionNavigationTag.CurrentPlanVsActual: KPACurrentPlanActualTemplate kpaCurrPlanActual = (KPACurrentPlanActualTemplate)e.Control; kpaCurrPlanActual.LoadPanel(); activeTemplate = kpaCurrPlanActual; break; default: break; } } else // the user is interacting with the KPIs { switch (navigationController.SectionTag) { case Navigation.SectionNavigationTag.Plan: KPIPlanTemplate kpiPlan = (KPIPlanTemplate)e.Control; kpiPlan.LoadPanel(); activeTemplate = kpiPlan; break; case Navigation.SectionNavigationTag.Purch: KPIPurchTemplate kpiPurch = (KPIPurchTemplate)e.Control; kpiPurch.LoadPanel(); activeTemplate = kpiPurch; break; case Navigation.SectionNavigationTag.FollowUp: KPIFollowUpTemplate kpiFollowUp = (KPIFollowUpTemplate)e.Control; kpiFollowUp.LoadPanel(); activeTemplate = kpiFollowUp; break; case Navigation.SectionNavigationTag.PlanII: KPIPlanTwoTemplate kpiPlanTwo = (KPIPlanTwoTemplate)e.Control; kpiPlanTwo.LoadPanel(); activeTemplate = kpiPlanTwo; break; case Navigation.SectionNavigationTag.PurchII: KPIPurchTwoTemplate kpiPurchTwo = (KPIPurchTwoTemplate)e.Control; kpiPurchTwo.LoadPanel(); activeTemplate = kpiPurchTwo; break; case Navigation.SectionNavigationTag.FollowUpTwo: KPIFollowUpTwoTemplate kpiFollowUpTwo = (KPIFollowUpTwoTemplate)e.Control; kpiFollowUpTwo.LoadPanel(); activeTemplate = kpiFollowUpTwo; break; case Navigation.SectionNavigationTag.PurchSub: KPIPurchSubTemplate kpiPurchSub = (KPIPurchSubTemplate)e.Control; kpiPurchSub.LoadPanel(); activeTemplate = kpiPurchSub; break; case Navigation.SectionNavigationTag.PurchTotal: KPIPurchTotalTemplate kpiPurchTotal = (KPIPurchTotalTemplate)e.Control; kpiPurchTotal.LoadPanel(); activeTemplate = kpiPurchTotal; break; case Navigation.SectionNavigationTag.PurchPlan: KPIPurchPlanTemplate kpiPurchPlan = (KPIPurchPlanTemplate)e.Control; kpiPurchPlan.LoadPanel(); activeTemplate = kpiPurchPlan; break; case Navigation.SectionNavigationTag.Other: KPIOtherTemplate kpiOther = (KPIOtherTemplate)e.Control; kpiOther.LoadPanel(); activeTemplate = kpiOther; break; default: break; } } } }