// private static void ShowBlockSiteForm() // { // _formBlock.ShowDialog(); // } public static void ShowLoading() { if (_loadingInfo != null) { return; } var threadb = new Thread(delegate() { _formBlock = new Form { FormBorderStyle = FormBorderStyle.None, BackColor = Color.White, WindowState = FormWindowState.Maximized, ShowIcon = false, ShowInTaskbar = false, Opacity = 0.1 }; Application.Run(_formBlock); }); threadb.SetApartmentState(ApartmentState.STA); threadb.Start(); var thread = new Thread(delegate() { _loadingInfo = new LoadingInfo(); Application.Run(_loadingInfo); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); }
private void button1_Click(object sender, EventArgs e) { if (btnclick == 1) { //dataGridView1.DataSource = null; AddDataTableColumnsOp(); //dataGridView1.DataSource = tbl_rep_operators; CreateHeaderFilters(dataGridView1); btnclick++; button1.Text = "Go Back"; ; } else { LoadingInfo.InfoText = "Loading reports..."; LoadingInfo.ShowLoading(); dataGridView1.DataSource = null; AddDataTableColumns(); // dataGridView1.DataSource = _table_reports; CreateHeaderFilters(dataGridView1); btnclick = 1; button1.Text = "Report by Operator"; LoadingInfo.CloseLoading(); } }
private void btnEfficiency_Click(object sender, EventArgs e) { LoadingInfo.InfoText = "Loading production..."; LoadingInfo.ShowLoading(); btnBack.Enabled = true; //var f1 = typeof(Control).GetField("EventClick", BindingFlags.Static | BindingFlags.NonPublic); //var obj = f1.GetValue(pbReload); //var pi = pbReload.GetType().GetProperty("Events", BindingFlags.NonPublic | BindingFlags.Instance); //var list = (EventHandlerList)pi.GetValue(pbReload, null); //list.RemoveHandler(obj, list[obj]); SuspendLayout(); foreach (Form frm in MdiChildren) { frm.Hide(); } ResumeLayout(true); Production f = new Production() { MdiParent = this }; f.WindowState = FormWindowState.Maximized; f.Show(); if (!firstTimeClicked && history[currentPosition + 1] != null) { btnForward.Enabled = false; numOfOpenedForms = currentPosition + 1; history[numOfOpenedForms++] = f; for (var i = numOfOpenedForms; i < history.Count() - 1; i++) { history[i] = null; } } else { history[numOfOpenedForms++] = f; } currentPosition = numOfOpenedForms - 1; //pbReload.Click += (s, ev) => //{ // f.GetDataPublic(); //}; LoadingInfo.CloseLoading(); }
private void btn_Exacta_Click(object sender, EventArgs e) { LoadingInfo.InfoText = "Loading exacta efficiency..."; LoadingInfo.ShowLoading(); btnBack.Enabled = true; SuspendLayout(); foreach (Form frm in MdiChildren) { frm.Hide(); } ResumeLayout(true); Sinottico f = new Sinottico() { MdiParent = this }; Sinottico.Mode = "Sinottico_Efficiency"; //f.GetColorByEfficiency(); f.WindowState = FormWindowState.Maximized; f.Show(); if (!firstTimeClicked && history[currentPosition + 1] != null) { btnForward.Enabled = false; numOfOpenedForms = currentPosition + 1; history[numOfOpenedForms++] = f; for (var i = numOfOpenedForms; i < history.Count() - 1; i++) { history[i] = null; } } else { history[numOfOpenedForms++] = f; } currentPosition = numOfOpenedForms - 1; LoadingInfo.CloseLoading(); }
private void btnIntervals_Click(object sender, EventArgs e) { LoadingInfo.InfoText = "Loading intervals..."; LoadingInfo.ShowLoading(); btnBack.Enabled = true; SuspendLayout(); foreach (Form frm in MdiChildren) { frm.Hide(); } ResumeLayout(true); var i = new Intervals() { MdiParent = this }; i.WindowState = FormWindowState.Maximized; //p.RefreshDgv(); i.Show(); if (!firstTimeClicked && history[currentPosition + 1] != null) { btnForward.Enabled = false; numOfOpenedForms = currentPosition + 1; history[numOfOpenedForms++] = i; for (var j = numOfOpenedForms; j < history.Count() - 1; j++) { history[j] = null; } } else { history[numOfOpenedForms++] = i; } currentPosition = numOfOpenedForms - 1; LoadingInfo.CloseLoading(); }
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; } } }
private static void CloseForm() { _loadingInfo.Close(); _loadingInfo = null; }