/// <summary> /// Returns the next PDF document in the cycle. /// Throws exceptions if the PDF document cannot be found or opened. /// If the last file changed in the meantime, allow it to be returned again. /// </summary> /// <exception cref="FileNotFoundException">If no files are available.</exception> /// <exception cref="DirectoryNotFoundException">If the PDF directory is missing or could not be read (e. g. due to network issues).</exception> /// <exception cref="PdfAccessException">If something went wrong while opening a file.</exception> public IPdfDocument GetNextDocument() { try { // if OnInvalidate was invoked previously, allow GetNextDocument() to return the same file again return(repository.GetDocument(GetNextFileName(includeCurrentFile: invalidateInvoked))); } finally { // re-enable event invalidateInvoked = false; } }