예제 #1
0
        private void ButtonAddDocumentsFromLibrary_Click(object sender, RoutedEventArgs e)
        {
            using (AugmentedPopupAutoCloser apac = new AugmentedPopupAutoCloser(ButtonAddPDFPopup))
            {
                // First choose the source library
                string           message = String.Format("You are about to import a lot of PDFs into the library named '{0}'.  Please choose the library FROM WHICH you wish to import the PDFs.", web_library_detail.Title);
                WebLibraryDetail picked_web_library_detail = WebLibraryPicker.PickWebLibrary(message);
                if (null != picked_web_library_detail)
                {
                    if (picked_web_library_detail == web_library_detail)
                    {
                        MessageBoxes.Error("You can not copy documents into the same library.");
                        return;
                    }

                    // Then check that they still want to do this
                    string message2 = String.Format("You are about to copy ALL of the PDFs from the library named '{0}' into the library named '{1}'.  Are you sure you want to do this?", picked_web_library_detail.Title, web_library_detail.Title);
                    if (!MessageBoxes.AskQuestion(message2))
                    {
                        return;
                    }

                    // They are sure!
                    ImportingIntoLibrary.ClonePDFDocumentsFromOtherLibrary_ASYNCHRONOUS(picked_web_library_detail.Xlibrary.PDFDocuments, web_library_detail);
                }
            }
        }
예제 #2
0
 private void ButtonAddMissingDocumentsFromSelf_Click(object sender, RoutedEventArgs e)
 {
     using (AugmentedPopupAutoCloser apac = new AugmentedPopupAutoCloser(ButtonAddPDFPopup))
     {
         var root_folder = web_library_detail.LIBRARY_DOCUMENTS_BASE_PATH;
         if (Directory.Exists(root_folder))
         {
             // do the import
             ImportingIntoLibrary.AddNewPDFDocumentsToLibraryFromFolder_ASYNCHRONOUS(web_library_detail, root_folder, true, false, false);
         }
     }
 }
예제 #3
0
        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);
            }
        }
 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);
         }
     }
 }
예제 #5
0
        private static PDFDocument AddQiqqaManualToLibrary(Library library)
        {
            FilenameWithMetadataImport fwmi = new FilenameWithMetadataImport();

            fwmi.filename = QiqqaManualFilename;
            fwmi.tags.Add("manual");
            fwmi.tags.Add("help");
            fwmi.bibtex =
                "@booklet{qiqqa_manual" + "\n" +
                ",	title	= {The Qiqqa Manual}"+ "\n" +
                ",	author	= {The Qiqqa Team,}"+ "\n" +
                ",	year	= {2013}"+ "\n" +
                "}"
            ;

            PDFDocument pdf_document = ImportingIntoLibrary.AddNewPDFDocumentsToLibraryWithMetadata_SYNCHRONOUS(library, true, true, new FilenameWithMetadataImport[] { fwmi });

            return(pdf_document);
        }
예제 #6
0
        private static PDFDocument AddLoexManualToLibrary(Library library)
        {
            FilenameWithMetadataImport fwmi = new FilenameWithMetadataImport();

            fwmi.filename = LoexManualFilename;
            fwmi.tags.Add("manual");
            fwmi.tags.Add("help");
            fwmi.bibtex =
                "@article{qiqqatechmatters" + "\n" +
                ",	title	= {TechMatters: “Qiqqa” than you can say Reference Management: A Tool to Organize the Research Process}"+ "\n" +
                ",	author	= {Krista Graham}"+ "\n" +
                ",	year	= {2014}"+ "\n" +
                ",	publication	= {LOEX Quarterly}"+ "\n" +
                ",	volume	= {40}"+ "\n" +
                ",	pages	= {4-6}"+ "\n" +
                "}"
            ;

            PDFDocument pdf_document = ImportingIntoLibrary.AddNewPDFDocumentsToLibraryWithMetadata_SYNCHRONOUS(library, true, true, new FilenameWithMetadataImport[] { fwmi });

            return(pdf_document);
        }
예제 #7
0
        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;
        }