private void TabBarMenu_FormClosing(object sender, FormClosingEventArgs e) { deskTabs = MdiChildren.ToList(); foreach (DeskTab form in MdiChildren) { if (!isCanselCLoseAll) { TryClose(form, deskTabs.Where(f => f != form).ToArray()); } } isCLoseAll = false; isCanselCLoseAll = false; if (MdiChildren.Length > 0) { e.Cancel = true; } else { if (!CloseProgramm()) { e.Cancel = true; } } }
private void OnOpenFormClick(object sender, EventArgs e) { if (!(((ToolStripButton)sender).Tag != null && ((ToolStripButton)sender).Tag is int)) { return; } Type childType = childForms[(int)(((ToolStripButton)sender).Tag)]; if (childType == null) { MessageBox.Show("Выбранная форма не настроена", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Form childObject = MdiChildren.ToList <Form>().Find(f => f.GetType() == childType); MDIChildBase childForm = childObject == null ? null : (MDIChildBase)childObject; if (childForm == null) { childForm = (MDIChildBase)childType.GetConstructor(new Type[] { typeof(MDIForm) }).Invoke(new object[] { this }); childForm.Show(); } else { childForm.Activate(); childForm.WindowState = FormWindowState.Maximized; } }
private void WindowsPreviousMenuItem_Click(object? sender, EventArgs e) { // Se comment in WindowsNextMenuItem_Click. var childList = MdiChildren.ToList(); int currentChildIndex = childList.IndexOf(ActiveMdiChild); int previousChildIndex = currentChildIndex < childList.Count - 1 ? currentChildIndex + 1 : 0; childList[previousChildIndex].Activate(); }
protected virtual void CloseAllDisplays() { foreach (IMdiChildForm childForm in MdiChildren.ToList()) { ((Form)childForm).Close(); MdiChildren.Remove(childForm); ((Form)Parent).Controls.Remove((Form)childForm); childForm.Dispose(); } }
private void logOutToolStripMenuItem_Click(object sender, System.EventArgs e) { if (_userService.GetLoggedUser() == null) { MessageBox.Show("You are already logged out"); return; } _userService.LogOut(); MdiChildren.ToList().ForEach(child => child.Close()); MessageBox.Show("You have successfully logged out"); }
private void logInToolStripMenuItem_Click(object sender, System.EventArgs e) { if (_loginForm != null) { return; } MdiChildren.ToList().ForEach(child => child.Close()); _loginForm = new Login(this); _loginForm.Show(); _loginForm.Closed += (obj, eventArgs) => _loginForm = null; }
public void btnEncourExercice_ItemClick(object sender, ItemClickEventArgs e) { if (_service == null) { return; } // Fermer toute les fenetres active. MdiChildren .ToList() .ForEach(x => x.Close()); var form = Program.Kernel.Get <FrmCurrentExercice>(); form.ShowDialog(); Program.Context.Exercice = _service.Exercice; Program.Context.Societe = _service.Societe; }
private void WindowsNextMenuItem_Click(object? sender, EventArgs e) { // ReSharper disable once CommentTypo // Just emulating the MDI's built-in Next behaviour (Ctrl+F6), which backtracks // through the child editor windows in the order in which they were opened. // Previous (Ctrl+Shift+F6) does the converse. It looks like they are the wrong way // round. And no attempt is made to progress through the order in which the user // actually accessed the windows, i.e. by clicking on them or by selecting a // numbered window from the Windows menu. So there is arguably room for // improvement, though, for consistency, it would then be necessary to change the // behaviour of the keyboard shortcuts and, if possible, Next on the Editor // window's system menu. var childList = MdiChildren.ToList(); int currentChildIndex = childList.IndexOf(ActiveMdiChild); int nextChildIndex = currentChildIndex > 0 ? currentChildIndex - 1 : childList.Count - 1; childList[nextChildIndex].Activate(); }
private Form EnsureForm(Type formType) { try { var allForms = MdiChildren.ToList(); var form = allForms.FirstOrDefault(f => f.GetType() == formType); if (form != null) { form.Focus(); return(form); } } catch (Exception ex) { Logger.Error("Ошибка в EnsureForm() - проверка открытых форм", ex); throw; } try { Form child = null; if (InvokeRequired) { Invoke(new Action <Type>(type => { child = (Form)formType.GetConstructor(Type.EmptyTypes).Invoke(null); SetupNonMdiForm((IMdiNonChartWindow)child); child.Show(); }), formType); } else { child = (Form)formType.GetConstructor(Type.EmptyTypes).Invoke(null); SetupNonMdiForm((IMdiNonChartWindow)child); child.Show(); } return(child); } catch (Exception ex) { Logger.Error("Ошибка в EnsureForm() - открытие нового окна", ex); throw; } }
/// <summary> /// /// </summary> /// <returns></returns> private LogForm GetLogForm() { return((from f in MdiChildren.ToList() where f is LogForm select f).SingleOrDefault() as LogForm); }
/// <summary> /// /// </summary> /// <returns></returns> private ConfigEditorForm GetConfigEditorForm() { return((from f in MdiChildren.ToList() where f is ConfigEditorForm select f).SingleOrDefault() as ConfigEditorForm); }
public void btnParametre_ItemClick(object sender, ItemClickEventArgs e) { if (_service == null) { return; } // Fermer toute les fenetres active. MdiChildren .ToList() .ForEach(x => x.Close()); var parmetreList = new List <IOptionUserControl>(); // parcourit les modules foreach (var page in _modules) { var module = page.Value; switch (module.Type) { case TypeModule.BcSuspension: if (!Program.IsDecBc) { continue; } break; case TypeModule.FcSuspension: if (!Program.IsDecFc) { continue; } break; case TypeModule.Cnss: if (!Program.IsCnss) { continue; } break; case TypeModule.VirementBancaire: if (!Program.IsVirement) { continue; } break; case TypeModule.DecEmp: if (!Program.IsEmp) { continue; } break; case TypeModule.Liasse: if (!Program.IsLiasse) { continue; } break; default: continue; break; } // charger les parametres du module var parameters = module.GetParameters().ToList(); foreach (var i in parameters) { parmetreList.Add(i.Value.GetParam()); } } var form = Program.Kernel.Get <FrmParametrage>(); form.SetParameter(parmetreList); form.ShowDialog(); }
private void cerraToolStripMenuItem_Click(object sender, EventArgs e) => MdiChildren.ToList().ForEach(x => x.Close());
public string name(Form f) => names[MdiChildren.ToList().IndexOf(f)];