//ADMIN GOMB click esemény: private void bnAdmin_Click(object sender, EventArgs e) { Admin myadmin = new Admin(); bool IsOpen = false; foreach (Form f in Application.OpenForms) { if (f.Text == "Adminisztrátori felület") { IsOpen = true; myadmin.BringToFront(); myadmin.Activate(); } } if (IsOpen == false) { myadmin = new Admin(); myadmin.Show(); myadmin.BringToFront(); myadmin.Activate(); } }
private void сменитьРежимToolStripMenuItem_Click(object sender, EventArgs e) { int i; TEC t; int index; // выбираем список отображаемых вкладок if (changeMode.ShowDialog() == DialogResult.OK) { StartWait(); tclTecViews.TabPages.Clear(); selectedTecViews.Clear(); // отображаем вкладки ТЭЦ for (i = 0; i < changeMode.tec_index.Count; i++) { t = tec[changeMode.tec_index[i]]; if ((index = changeMode.was_checked.IndexOf(i)) >= 0) { if (changeMode.gtp_index[changeMode.was_checked[index]] == -1) { tclTecViews.TabPages.Add(t.name); } else { tclTecViews.TabPages.Add(t.name + " - " + t.GTP[changeMode.gtp_index[changeMode.was_checked[index]]].name); } tclTecViews.TabPages[tclTecViews.TabPages.Count - 1].Controls.Add(tecViews[i]); selectedTecViews.Add(tecViews[i]); tecViews[i].Activate(false); tecViews[i].Start(); } else { tecViews[i].Stop(); } } StopWait(); if (changeMode.admin_was_checked) { if (prevStateIsAdmin || passwordForm.ShowDialog() == DialogResult.Yes) { StartWait(); tclTecViews.TabPages.Add("Редактирование ПБР"); tclTecViews.TabPages[tclTecViews.TabPages.Count - 1].Controls.Add(adminPanel); adminPanel.Start(); StopWait(); } else { changeMode.admin_was_checked = false; } } prevStateIsAdmin = changeMode.admin_was_checked; if (selectedTecViews.Count > 0) { oldSelectedIndex = 0; selectedTecViews[oldSelectedIndex].Activate(true); adminPanel.Activate(false); } else if (changeMode.admin_was_checked) { adminPanel.Activate(true); } } }