private void NotifyAll(Notification notification, object data = null) { foreach (var vixenMdi in MdiChildren.OfType <IVixenMDI>()) { vixenMdi.Notify(notification, data); } }
// Closing the current query window on deleting the corresponding user query. private void userQueriesView1_UserQueryItemRemoved(object sender, MetadataStructureItem item) { var childWindow = MdiChildren.OfType <ChildForm>().FirstOrDefault(x => x.UserMetadataStructureItem == item); childWindow?.Close(); SaveSettings(); }
private void menuScintilla_Click(object sender, EventArgs e) { var form = MdiChildren.OfType <Editor.Form1>().FirstOrDefault() ?? new Editor.Form1 { MdiParent = this }; form.Show(); form.BringToFront(); }
private void menuCaptcha_Click(object sender, EventArgs e) { var form = MdiChildren.OfType <Security.FormCaptcha>().FirstOrDefault() ?? new Security.FormCaptcha { MdiParent = this }; form.Show(); form.BringToFront(); }
private void menuJsonView_Click(object sender, EventArgs e) { var form = MdiChildren.OfType <EPocalipse.Json.JsonView.MainForm>().FirstOrDefault() ?? new EPocalipse.Json.JsonView.MainForm { MdiParent = this }; form.Show(); form.BringToFront(); }
public void OpenFiles(string[] fileNames) { var fileList = new List <string>(fileNames); var documentWindows = MdiChildren.OfType <DocumentWindow>(); for (int i = 0; i < fileList.Count; ++i) { var fileName = fileList[i]; var extension = Path.GetExtension(fileName).ToLowerInvariant(); var existingWindow = documentWindows.FirstOrDefault( dw => dw.FileName == fileName); if (existingWindow != null) { existingWindow.Activate(); fileList.RemoveAt(i); --i; } if (extension == ".2da" && Settings.Default.AutoLoad2DA) { var schema = TwoDASchemaRegistry.GetMatchingSchema(Path.GetFileName(fileName)); if (schema != null && schema.Columns != null) { foreach (var schemaColumn in schema.Columns) { var rowSource = schemaColumn.RowSource; if (rowSource != null) { if (!documentWindows.Any(dw => Path.GetFileName(dw.FileName) == rowSource) && !fileList.Any(f => Path.GetFileName(f) == rowSource)) { string rowSourceFileName = Path.Combine( Path.GetDirectoryName(fileName), rowSource); if (!File.Exists(rowSourceFileName) && Directory.Exists(Settings.Default.TwoDAPath)) { rowSourceFileName = Path.Combine(Settings.Default.TwoDAPath, rowSource); } if (File.Exists(rowSourceFileName)) { fileList.Insert(0, rowSourceFileName); ++i; } } } } } } } openFilesBackgroundWorker.RunWorkerAsync(fileList); }
private bool FindAndDisplayStatsWindow(string selectedPilot) { var childForm = MdiChildren.OfType <PilotStatsForm>() .SingleOrDefault(form => form.PilotName == selectedPilot); if (childForm == null) { return(false); } childForm.Show(); childForm.Focus(); return(true); }
private void AboutToolStripMenuItem_Click(object sender, EventArgs e) { if (MdiChildren.OfType <AboutBox>().Any()) { return; } var about = new AboutBox { MdiParent = this, FormBorderStyle = FormBorderStyle.FixedToolWindow }; about.Show(); }
private bool DisplayForm([Required] string formId) { bool result = false; var existing = MdiChildren.OfType <PanelContainerForm>() .FirstOrDefault(x => string.CompareOrdinal(x.FormId, formId) == 0); if (existing != null) { result = true; existing.Activate(); } return(result); }
public TlkDocument GetReferencedTlkDocument(TwoDADocument referringDocument, bool alternate) { string docFileName = (from dw in MdiChildren.OfType <TwoDADocumentWindow>() where dw.Document == referringDocument select dw.FileName ).FirstOrDefault(); if (docFileName == null) { return(null); } var matchingWindows = (from dw in MdiChildren.OfType <TlkDocumentWindow>() let fileName = Path.GetFileName(dw.FileName) let std = "dialog.tlk".Equals(fileName, StringComparison.OrdinalIgnoreCase) || "dialogf.tlk".Equals(fileName, StringComparison.OrdinalIgnoreCase) where std ^ alternate select dw ).ToArray(); if (matchingWindows.Length == 0) { return(null); } if (matchingWindows.Length > 1) { var docDirName = Path.GetDirectoryName(docFileName); var sameDirWindow = matchingWindows.FirstOrDefault(dw => Path.GetDirectoryName(dw.FileName) == docDirName); if (sameDirWindow != null) { return(sameDirWindow.Document); } var stdDirName = Path.GetFullPath(Settings.Default.TlkPath); var stdDirWindow = matchingWindows.FirstOrDefault(dw => Path.GetDirectoryName(dw.FileName) == stdDirName); if (stdDirWindow != null) { return(stdDirWindow.Document); } } return(matchingWindows.First().Document); }
public TwoDADocument GetReferencedTwoDADocument(TwoDADocument referringDocument, string rowSource) { var twoDAWindows = MdiChildren.OfType <TwoDADocumentWindow>(); string docFileName = (from dw in twoDAWindows where dw.Document == referringDocument select dw.FileName ).FirstOrDefault(); if (docFileName == null) { return(null); } var matchingWindows = (from dw in twoDAWindows where Path.GetFileName(dw.FileName) == rowSource select dw ).ToArray(); if (matchingWindows.Length == 0) { return(null); } if (matchingWindows.Length > 1) { var docDirName = Path.GetDirectoryName(docFileName); var sameDirWindow = matchingWindows.FirstOrDefault(dw => Path.GetDirectoryName(dw.FileName) == docDirName); if (sameDirWindow != null) { return(sameDirWindow.Document); } var stdDirName = Path.GetFullPath(Settings.Default.TwoDAPath); var stdDirWindow = matchingWindows.FirstOrDefault(dw => Path.GetDirectoryName(dw.FileName) == stdDirName); if (stdDirWindow != null) { return(stdDirWindow.Document); } } return(matchingWindows.First().Document); }
private void productoToolStripMenuItem_Click(object sender, EventArgs e) { Form Formulario; Formulario = MdiChildren.OfType <FormProducto>().FirstOrDefault(); //Si el formulario no existe if (Formulario == null) { Formulario = FormProducto.GetInstancia(); Formulario.Show(); Formulario.MdiParent = this; Formulario.Dock = DockStyle.Fill; } else //Si el formulario existe { Formulario.Activate(); } }
public void AbrirFormEnMDI <MiForm>() where MiForm : Form, new() { Form Formulario; Formulario = MdiChildren.OfType <MiForm>().FirstOrDefault(); //Si el formulario no existe if (Formulario == null) { Formulario = new MiForm(); Formulario.Show(); Formulario.MdiParent = this; Formulario.Dock = DockStyle.Fill; } else //Si el formulario existe { Formulario.Activate(); } }
private void AbrirInicio() { Form1nicio Formulario; Formulario = MdiChildren.OfType <Form1nicio>().FirstOrDefault(); //Si el formulario no existe if (Formulario == null) { Formulario = new Form1nicio(); Formulario.Id_Trabajador = Convert.ToInt32(this.Id_Trabajador); Formulario.Show(); Formulario.MdiParent = this; Formulario.Dock = DockStyle.Fill; } else //Si el formulario existe { Formulario.Activate(); } }
private void ingresosToolStripMenuItem_Click(object sender, EventArgs e) { FormCompra Formulario; Formulario = MdiChildren.OfType <FormCompra>().FirstOrDefault(); //Si el formulario no existe if (Formulario == null) { Formulario = FormCompra.GetInstancia(); Formulario.Show(); Formulario.MdiParent = this; Formulario.Dock = DockStyle.Fill; Formulario.Id_Trabajador = Convert.ToInt32(this.Id_Trabajador); } else //Si el formulario existe { Formulario.Activate(); } }
private PanelContainerForm FindForm([NotNull] IActionDefinition actionDefinition) { return(MdiChildren.OfType <PanelContainerForm>() .FirstOrDefault(x => string.CompareOrdinal(x.Name, actionDefinition.Id.ToString("N")) == 0)); }