private void button1_Click(object sender, EventArgs e) { LoadingInfo.InfoText = "Loading efficiency..."; LoadingInfo.ShowLoading(); btnBack.Enabled = true; SuspendLayout(); foreach (Form frm in MdiChildren) { frm.Hide(); } ResumeLayout(true); Efficiency frmEfficiency = new Efficiency() { MdiParent = this }; frmEfficiency.WindowState = FormWindowState.Maximized; frmEfficiency.Show(); if (!firstTimeClicked && history[currentPosition + 1] != null) { btnForward.Enabled = false; numOfOpenedForms = currentPosition + 1; history[numOfOpenedForms++] = frmEfficiency; for (var i = numOfOpenedForms; i < history.Count() - 1; i++) { history[i] = null; } } else { history[numOfOpenedForms++] = frmEfficiency; } currentPosition = numOfOpenedForms - 1; LoadingInfo.CloseLoading(); }
private void pbReload_Click(object sender, EventArgs e) { switch (history[currentPosition].Name) { case "Reports": { LoadingInfo.InfoText = "Loading reports..."; LoadingInfo.ShowLoading(); SuspendLayout(); foreach (Form frm in MdiChildren) { frm.Hide(); } ResumeLayout(true); var frmReports = new Reports() { MdiParent = this }; history[currentPosition] = null; history[currentPosition] = frmReports; frmReports.WindowState = FormWindowState.Maximized; history[currentPosition].Show(); LoadingInfo.CloseLoading(); break; } case "Production": { LoadingInfo.InfoText = "Loading production..."; LoadingInfo.ShowLoading(); SuspendLayout(); foreach (Form frm in MdiChildren) { frm.Hide(); } ResumeLayout(true); var frmProduction = new Production() { MdiParent = this }; history[currentPosition] = null; history[currentPosition] = frmProduction; frmProduction.WindowState = FormWindowState.Maximized; history[currentPosition].Show(); LoadingInfo.CloseLoading(); break; } case "Intervals": { LoadingInfo.InfoText = "Loading intervals..."; LoadingInfo.ShowLoading(); SuspendLayout(); foreach (Form frm in MdiChildren) { frm.Hide(); } ResumeLayout(true); var frmIntervals = new Intervals() { MdiParent = this }; history[currentPosition] = null; history[currentPosition] = frmIntervals; frmIntervals.WindowState = FormWindowState.Maximized; history[currentPosition].Show(); LoadingInfo.CloseLoading(); break; } case "Efficiency": { LoadingInfo.InfoText = "Loading efficiency..."; LoadingInfo.ShowLoading(); SuspendLayout(); foreach (Form frm in MdiChildren) { frm.Hide(); } ResumeLayout(true); var frmEfficiency = new Efficiency() { MdiParent = this }; history[currentPosition] = null; history[currentPosition] = frmEfficiency; frmEfficiency.WindowState = FormWindowState.Maximized; history[currentPosition].Show(); LoadingInfo.CloseLoading(); break; } case "Sinottico": { if (Sinottico.Mode == "Sinottico_Production") { LoadingInfo.InfoText = "Loading exacta production..."; LoadingInfo.ShowLoading(); SuspendLayout(); foreach (Form frm in MdiChildren) { frm.Hide(); } ResumeLayout(true); var frmSinottico = new Sinottico() { MdiParent = this }; history[currentPosition] = null; history[currentPosition] = frmSinottico; frmSinottico.WindowState = FormWindowState.Maximized; history[currentPosition].Show(); LoadingInfo.CloseLoading(); } else if (Sinottico.Mode == "Sinottico_Efficiency") { LoadingInfo.InfoText = "Loading exacta efficiency..."; LoadingInfo.ShowLoading(); SuspendLayout(); foreach (Form frm in MdiChildren) { frm.Hide(); } ResumeLayout(true); var frmSinottico = new Sinottico() { MdiParent = this }; history[currentPosition] = null; history[currentPosition] = frmSinottico; frmSinottico.WindowState = FormWindowState.Maximized; history[currentPosition].Show(); LoadingInfo.CloseLoading(); } break; } } }