private void mainForm_Closing(object sender, FormClosingEventArgs e) { // If no child forms open, skip this logic and close if (MdiChildren.Count() == 0) { return; } // Checks if user really wants to close DialogResult = MessageBox.Show("Are you sure you want to exit?", "Confirm Exit?", MessageBoxButtons.OKCancel); if (DialogResult == DialogResult.OK) { // Request close for each child form foreach (Form child in MdiChildren) { if (child is TextEditorForm) { ((TextEditorForm)child).CloseFile(MessageBoxButtons.YesNo); } } // If no more children are open and child forms were closed, do not cancel close request for parent if (MdiChildren.Count() == 0) { e.Cancel = false; } } else // Cancels closing { e.Cancel = true; } }
/// <summary> /// Réaffichage du panneau central /// </summary> private void Restore() { if (MdiChildren.Count() == 0) { panneauAccueil.Show(); } }
private void SetNum_Click(object sender, EventArgs e) { for (int i = 0, j = 1; i < MdiChildren.Count(); i++, j++) { MdiChildren[i].Text = j.ToString(); } }
private void Close_Click(object sender, EventArgs e) { do { MdiChildren[0].Close(); }while (MdiChildren.Count() > 0); }
private void MainForm_Load(object sender, EventArgs e) { loadding.Hide(); timer1.Start(); if (!CheckForInternetConnection()) { MessageBox.Show("Hệ thống đang bị mất kết nối mạng, vui lòng kiểm tra lại kết nối mạng và thử lại", "Mất kết nối mạng", MessageBoxButtons.OK, MessageBoxIcon.Warning); Environment.Exit(0); } else { if (role != "1") { ChucVu = "Nhân Viên"; PhanQuyen.Visible = false; ThietLapKetNoiSQL.Visible = false; PhucHoiSQL.Visible = false; SaoLuuSQL.Visible = false; NhanVien.Visible = false; } else { ChucVu = "Quản Lý"; } if (MdiChildren.Count() == 0) { txtXinChao.Caption = "Xin chào: ".ToUpper() + name; txtChucVu.Caption = "Chức vụ: ".ToUpper() + ChucVu; WelcomeBack.Text = "Chào mừng quay trở lại: " + name; } } }
private void timer1_Tick(object sender, EventArgs e) { if (auth.login != "") { modulesMenuItem.Enabled = true; } else { modulesMenuItem.Enabled = false; } if (auth.login == "admin") { dbBackupMenuItem.Enabled = userConfigMenuItem.Enabled = true; } else { dbBackupMenuItem.Enabled = userConfigMenuItem.Enabled = false; } if (MdiChildren.Count() > 0) { closeAllWindowsMenuItem.Enabled = true; } else { closeAllWindowsMenuItem.Enabled = false; } statusLbl.Text = "Користувач: " + auth.login; }
private void MainScreen_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape && MdiChildren.Count() > 0)//esc'ye basıldıysa ve çocuk form açıksa { ActiveMdiChild.Close(); } }
private void новыйToolStripMenuItem_Click(object sender, EventArgs e) { Canvas frmChild = new Canvas(); frmChild.Text = (MdiChildren.Count() == 0) ? "Canvas" : "Canvas " + "(" + (MdiChildren.Count() + 1) + ")"; frmChild.MdiParent = this; frmChild.Show(); }
private void usunToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 1) { Form toDelete = this.ActiveMdiChild; toDelete.Close(); } }
private void NamberOfWindowToolStripMenuItem_Click(object sender, EventArgs e) { switch (MessageBox.Show($"namber child - {MdiChildren.Count()}", "About program", MessageBoxButtons.OK, MessageBoxIcon.Information)) { case DialogResult.OK: break; } }
/// <summary> /// Ferme toutes les applications ouvertes /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void fermerToutToolStripMenuItem_Click(object sender, EventArgs e) { int nb = MdiChildren.Count(); //compte le nombre d'applications ouverte for (int i = 0; i < nb; i++) //Boucle pour répéter l'opération autant de fois qu'il y a de d'appli ouverte { ActiveMdiChild.Close(); //prends la fenêtre enfant ouverte et la ferme } }
private void Form_Closed(ToolStripMenuItem mi, DataForm form) { var tsi = mi.DropDownItems.Cast <ToolStripItem>().Single(x => x.Tag == form); mi.DropDownItems.Remove(tsi); // child form is still in list at this point, // so disable button if this is the last child which is about to close BtnClose.Enabled = MdiChildren.Count() != 1; }
private void GalvanicaMdi_FormClosing(object sender, FormClosingEventArgs e) { if (MdiChildren.Count() > 0) { foreach (Form f in MdiChildren) { f.Close(); } } }
private void GetLast_Click(object sender, EventArgs e) { int i = 0; while (MdiChildren.Count() > i) { i++; } MdiChildren[--i].Activate(); }
private void MNowy_Click(object sender, EventArgs e) { var form = new Dokument { MdiParent = this, Text = "Plik " + MdiChildren.Count() }; form.Show(); }
/// <summary> /// Opens a new song in a song editor child window /// </summary> /// <param name="fileName"></param> /// <param name="plugin"></param> public void OpenSong(string fileName, ISongFilePlugin plugin = null) { for (int i = 0; i < MdiChildren.Count(); i++) { EditorChildMetaData md = (EditorChildMetaData)MdiChildren[i].Tag; if (!string.IsNullOrEmpty(md.Filename) && String.Compare( Path.GetFullPath(md.Filename).TrimEnd('\\'), Path.GetFullPath(fileName).TrimEnd('\\'), StringComparison.InvariantCultureIgnoreCase) == 0) { MdiChildren[i].Show(); MdiChildren[i].Focus(); return; } } try { if (plugin == null) { plugin = SongFilePluginFactory.Create(fileName); } var sng = plugin.Load(fileName); SongTemplateMapper stm = new SongTemplateMapper(_settings); // Set default formattig if none exists if (sng.Formatting == null) { stm.ApplyFormattingFromSettings(sng); } // Set default background if none is set foreach (var p in sng.Parts) { foreach (var s in p.Slides) { if (s.Background == null) { s.Background = stm.GetDefaultBackground(); } } } CreateSongEditorChildForm(sng, fileName, false); } catch (NotImplementedException) { MessageBox.Show(StringResources.SongFormatNotSupported, Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } catch (Exception e) { MessageBox.Show(StringResources.SongFileHasErrors + @" (" + e.Message + @")!", Text, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void deauthorize() { this.Text = "ИС Учёт Времени [Не авторизован]"; notify.Text = notify.BalloonTipTitle = this.Text; user.Clear(); while (MdiChildren.Count() > 0) { MdiChildren[0].Close(); } beginworkintoolmenu.Enabled = false; }
private void VisualizarFormularioYTítulo(Form formulario, string título) { if (MdiChildren.Count() == 1) { MdiChildren[0].Close(); } formulario.MdiParent = this; formulario.Dock = DockStyle.Fill; formulario.Show(); this.Text = título; }
private void lISTARToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 0) { ActiveMdiChild.Close(); } ListarClientes TelaListarClientes = new ListarClientes(); TelaListarClientes.MdiParent = this; TelaListarClientes.Show(); }
private void cADASTRARToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 0) { ActiveMdiChild.Close(); } CadCliente TelaCadCliente = new CadCliente(); TelaCadCliente.MdiParent = this; TelaCadCliente.Show(); }
private void pROFISSIONAISToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 0) { ActiveMdiChild.Close(); } Profissionais TelaProfissionais = new Profissionais(); TelaProfissionais.MdiParent = this; TelaProfissionais.Show(); }
private void Projects_roleToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 0) { MdiChildren[0].Close(); Projects_roleForm proj_role = new Projects_roleForm(); proj_role.MdiParent = this; proj_role.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); proj_role.Show(); } }
private void History_projectsToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 0) { MdiChildren[0].Close(); History_projectsForm history_projects = new History_projectsForm(); history_projects.MdiParent = this; history_projects.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); history_projects.Show(); } }
private void MyTaskToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 0) { MdiChildren[0].Close(); MyTaskForm my_task = new MyTaskForm(); my_task.MdiParent = this; my_task.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); my_task.Show(); } }
private void Status_projectsToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 0) { MdiChildren[0].Close(); Status_projectsForm stat_proj = new Status_projectsForm(); stat_proj.MdiParent = this; stat_proj.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); stat_proj.Show(); } }
private void RoleUsersToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 0) { MdiChildren[0].Close(); Users_rolesForm users_role = new Users_rolesForm(); users_role.MdiParent = this; users_role.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); users_role.Show(); } }
private void ListPostsToolStripMenuItem2_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 0) { MdiChildren[0].Close(); PostsForm posts = new PostsForm(); posts.MdiParent = this; posts.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); posts.Show(); } }
private void listEmployeesToolStripMenuItem2_Click(object sender, EventArgs e) { if (MdiChildren.Count() > 0) { MdiChildren[0].Close(); EmployeesForm employees = new EmployeesForm(); employees.MdiParent = this; employees.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right); employees.Show(); } }
private void viewForm(Form frm) { if (!checkForm(frm)) { frm.MdiParent = this; frm.Show(); } if (MdiChildren.Count() > 0) { pb1.Hide(); WelcomeBack.Hide(); } }
private bool isActive(Form form) { if (MdiChildren.Count() > 0) { foreach (var item in MdiChildren) { if (form.Name == item.Name) { return(true); } } } return(false); }