private void ButtonAddDocuments_Click(object sender, RoutedEventArgs e) { using (AugmentedPopupAutoCloser apac = new AugmentedPopupAutoCloser(ButtonAddPDFPopup)) { OpenFileDialog dlg = new OpenFileDialog(); dlg.CheckFileExists = true; dlg.CheckPathExists = true; dlg.Filter = "PDF Files|*.pdf"; dlg.Multiselect = true; dlg.Title = "Select the PDF documents you wish to add to your document library"; if (dlg.ShowDialog() == true) { ImportingIntoLibrary.AddNewPDFDocumentsToLibrary_ASYNCHRONOUS(library, false, false, dlg.FileNames); } } }
void ButtonAddDocuments_Click(object sender, RoutedEventArgs e) { OpenFileDialog dlg = new OpenFileDialog { CheckFileExists = true, CheckPathExists = true, Filter = "PDF Files|*.pdf", Multiselect = true, Title = "Select the PDF documents you wish to add to your document library" }; if (dlg.ShowDialog() == DialogResult.OK) { ImportingIntoLibrary.AddNewPDFDocumentsToLibrary_ASYNCHRONOUS(library, false, false, dlg.FileNames); } }
public void OnDrop(object sender, DragEventArgs e) { // Pick the library Library library = default_library; if (null == library) { WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary(); if (null != web_library_detail) { library = web_library_detail.library; } } // If there still is no library (the user cancelled perhaps) if (null == library) { Logging.Info("No library was selected for the DragToLibraryManager."); return; } //if (false) //{ // StringBuilder sb = new StringBuilder(); // sb.AppendLine("The available formats are:"); // foreach (string format in e.Data.GetFormats(true)) // { // sb.AppendFormat(" - {0}\n", format); // } // Logging.Debug(sb.ToString()); //} if (false) { } else if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] filenames = (string[])e.Data.GetData(DataFormats.FileDrop); // IF they have dragged and dropped a single directory if (0 < filenames.Length && Directory.Exists(filenames[0])) { if (1 == filenames.Length) { // Invoke the directory handler new ImportFromFolder(library, filenames[0]).ShowDialog(); } else { MessageBoxes.Warn("You can drag only one directory at a time to Qiqqa."); } } else { ImportingIntoLibrary.AddNewPDFDocumentsToLibrary_ASYNCHRONOUS(library, false, false, filenames); } } else if (e.Data.GetDataPresent("UniformResourceLocator")) { string download_url = DragDropTools.GetDataString("UniformResourceLocator", e); Logging.Info("The dropped item is {0}", download_url); ImportingIntoLibrary.AddNewDocumentToLibraryFromInternet_ASYNCHRONOUS(library, download_url); } else if (e.Data.GetDataPresent(typeof(PDFDocument))) { PDFDocument pdf_document = (PDFDocument)e.Data.GetData(typeof(PDFDocument)); Logging.Info("The dropped item is {0}", pdf_document); ImportingIntoLibrary.ClonePDFDocumentsFromOtherLibrary_ASYNCHRONOUS(pdf_document, library, false); } else if (e.Data.GetDataPresent(typeof(List <PDFDocument>))) { List <PDFDocument> pdf_documents = (List <PDFDocument>)e.Data.GetData(typeof(List <PDFDocument>)); ImportingIntoLibrary.ClonePDFDocumentsFromOtherLibrary_ASYNCHRONOUS(pdf_documents, library); } else { Logging.Info("Not using any of:"); foreach (string s in e.Data.GetFormats()) { Logging.Info(s); } } e.Handled = true; }