public void OpenItemDocument(FileInfo file) { var itemDoc = new DockItemDocument(_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; } itemDoc.Parent = this.DockPanel; _editorDocuments.Add(itemDoc); this.DockPanel.AddContent(itemDoc); }
private void OpenItemDocument(FileInfo file) { var itemDoc = new DockItemDocument(_project, file.Name, Icons.document_16xLG, file) { Tag = file }; // and if there are, just activate it. foreach (var iDoc in _editorDocuments) { if (iDoc.Tag == file) { this.DockPanel.ActiveContent = iDoc; return; } } itemDoc.Enter += ItemDoc_Enter; _editorDocuments.Add(itemDoc); DockPanel.AddContent(itemDoc); }