protected override IDocument OpenDocument(object[] arguments) { var fileName = string.Empty; if (arguments != null && arguments.Length > 0 && arguments[0] is string) { fileName = (string)arguments[0]; } if (string.IsNullOrEmpty(fileName)) { using (var dialog = new OpenFileDialog()) { if (dialog.ShowDialog(Globals.MainForm) == DialogResult.OK) { fileName = dialog.FileName; } } } if (string.IsNullOrEmpty(fileName)) { return(null); } var manager = This.GetService <IDocumentManagerService>(true); var source = new FileDocumentSource(fileName); return(manager.CreateDocument(source)); }
public void ReadsFileContent() { FileInfo file = new FileInfo(Directory.GetCurrentDirectory() + "/src/document.pdf"); FileDocumentSource source = new FileDocumentSource(file.FullName); byte[] content = source.Content(); Assert.IsNotNull(content); Assert.IsTrue(content.Length > 0); }