private void OpenNPCDocument(FileInfo file) { var npcDoc = new DockNPCEditor(_project, file.Name, Icons.document_16xLG, file) { Tag = file }; // Make sure there isn't already an open document of this file foreach (var nDoc in _editorDocuments) { if (((FileInfo)nDoc.Tag).Name == file.Name) { this.DockPanel.ActiveContent = nDoc; return; } } npcDoc.Enter += NPCDoc_Enter; _editorDocuments.Add(npcDoc); DockPanel.AddContent(npcDoc); }
public void OpenNPCDocument(FileInfo file) { var npcDoc = new DockNPCEditor(_project, file.Name, Icons.document_16xLG, file) { Tag = file }; // Make sure there isn't already an open document of this file var existingDoc = this.FindOpenDocument(file); if (existingDoc != null) { this.DockPanel.ActiveContent = existingDoc; return; } npcDoc.Closed += NpcDoc_Closed; _editorDocuments.Add(npcDoc); npcDoc.Size = new Size(npcDoc.Width, npcDoc.Height); this.DockPanel.AddContent(npcDoc); npcDoc.Initalize(); }