public static void ClonePDFDocumentsFromOtherLibrary_ASYNCHRONOUS(List <PDFDocument> existing_pdf_document, Library library, ActionPerClonedDocument doneActionPerDocument = null) { SafeThreadPool.QueueUserWorkItem(o => ClonePDFDocumentsFromOtherLibrary_SYNCHRONOUS(existing_pdf_document, library, doneActionPerDocument)); }
/// <summary> /// Creates a new <code>PDFDocument</code> in the given library, and creates a copy of all the metadata. /// </summary> public static void ClonePDFDocumentsFromOtherLibrary_SYNCHRONOUS(List <PDFDocument> existing_pdf_documents, Library library, ActionPerClonedDocument doneActionPerDocument = null) { for (int i = 0; i < existing_pdf_documents.Count; ++i) { StatusManager.Instance.UpdateStatus("BulkLibraryDocument", String.Format("Adding document {0} of {1} to your library", i, existing_pdf_documents.Count), i, existing_pdf_documents.Count); PDFDocument existing_pdf_document = existing_pdf_documents[i]; // Signal only the last doc bool suppress_signal_that_docs_have_changed = true; if (i == existing_pdf_documents.Count - 1) { suppress_signal_that_docs_have_changed = false; } PDFDocument new_pdf_document = ClonePDFDocumentsFromOtherLibrary_SYNCHRONOUS(existing_pdf_document, library, suppress_signal_that_docs_have_changed); doneActionPerDocument?.Invoke(new_pdf_document, existing_pdf_document); } library.NotifyLibraryThatDocumentListHasChangedExternally(); StatusManager.Instance.UpdateStatus("BulkLibraryDocument", String.Format("Added {0} document(s) to your library", existing_pdf_documents.Count)); }
/// <summary> /// Creates a new <code>PDFDocument</code> in the given library, and creates a copy of all the metadata. /// </summary> public static void ClonePDFDocumentsFromOtherLibrary_SYNCHRONOUS(List <PDFDocument> existing_pdf_documents, WebLibraryDetail web_library_detail, ActionPerClonedDocument doneActionPerDocument = null) { for (int i = 0; i < existing_pdf_documents.Count; ++i) { StatusManager.Instance.UpdateStatus("BulkLibraryDocument", String.Format("Adding document {0} of {1} to your library", i + 1, existing_pdf_documents.Count), i, existing_pdf_documents.Count); PDFDocument existing_pdf_document = existing_pdf_documents[i]; PDFDocument new_pdf_document = ClonePDFDocumentsFromOtherLibrary_SYNCHRONOUS(existing_pdf_document, web_library_detail); doneActionPerDocument?.Invoke(new_pdf_document, existing_pdf_document); } web_library_detail.Xlibrary.NotifyLibraryThatDocumentListHasChangedExternally(); StatusManager.Instance.UpdateStatus("BulkLibraryDocument", String.Format("Added {0} document(s) to your library", existing_pdf_documents.Count)); }