public virtual void Open() { if (string.IsNullOrEmpty(FullName)) { throw new FileNotFoundException("未找到文件:" + FullName); } if (DocumentManager.DocumentList != null && DocumentManager.DocumentList.Count > 0) { //假如文档中已经存在,激活 foreach (IDocumentControl documentControl in DocumentManager.DocumentList) { if (documentControl.Document.DocumentResource is ISingleFileDocumentResource && ((ISingleFileDocumentResource)documentControl.Document.DocumentResource).FullName.Equals(FullName) ) { DocumentManager.SetDocumentControlActive(documentControl); return; } } } IDocumentControl docControl = IocManager.Resolve(DocumentControlType.Type) as IDocumentControl; if (docControl != null) { IDocumentControl documentControl = DocumentManager.AddADocument(DocumentControlType, Path.GetFileName(FullName)); documentControl.Open(this); } else { throw new DocumentOpenException("未找到打开文档的Control," + DocumentControlType.TypeName); } }
public void Open() { if (string.IsNullOrEmpty(FilePath)) { throw new FileNotFoundException("未发现文件:" + FilePath); } IDocumentControl docControl = IocManager.Resolve(DocumentControlType.Type) as IDocumentControl; if (docControl != null) { IDocumentControl documentControl = DocumentManager.AddADocument <CADViewerControl>(Path.GetFileNameWithoutExtension(FilePath)); ((CADViewerControl)documentControl).OpenFile(FilePath); ToolbarControl.CADFileOpen(); } else { throw new DocumentOpenException("未找到打开文档的Control," + DocumentControlType.TypeName); } }