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); } } }
private void ObjHyperlinkGuestPreviewMoveOther_Click(object sender, RoutedEventArgs e) { WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary(); if (null != web_library_detail) { MoveGuestPreviewPDFDocument(web_library_detail); } }
void ObjLibraryTextBox_PreviewMouseDown(object sender, MouseButtonEventArgs e) { // Pick a new library... WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary(); if (null != web_library_detail) { ChooseNewLibrary(web_library_detail); } e.Handled = true; }
void ButtonOpenLibrary_Click(object sender, RoutedEventArgs e) { ButtonLibrariesPopup.Close(); WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary(); if (null != web_library_detail) { MainWindowServiceDispatcher.Instance.OpenLibrary(web_library_detail.library); } e.Handled = true; }
internal static void Go(string filename) { FeatureTrackingManager.Instance.UseFeature(Features.Library_ImportFromOmnipatents); WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary("Please select the Qiqqa library into which you want to import your Omnipatents portfolio."); if (null != web_library_detail) { ImportFromThirdParty win = new ImportFromThirdParty(web_library_detail.library); win.DoAutomatedBibTeXImport(filename); win.ShowDialog(); } }
void TextLibraryForExpedition_PreviewMouseDown(object sender, MouseButtonEventArgs e) { FeatureTrackingManager.Instance.UseFeature(Features.Expedition_ChooseLibrary); // Pick a new library... WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary(); if (null != web_library_detail) { ChooseNewLibrary(web_library_detail); } e.Handled = true; }
private void TxtLibrary_PreviewMouseDown(object sender, MouseButtonEventArgs e) { library = null; TxtLibrary.Text = "Click to choose a library."; // Pick a new library... WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary(); if (null != web_library_detail) { library = web_library_detail.library; TxtLibrary.Text = web_library_detail.Title; } e.Handled = true; }
private void TextLibraryForCitations_PreviewMouseDown(object sender, MouseButtonEventArgs e) { FeatureTrackingManager.Instance.UseFeature(Features.InCite_ChooseLibrary); // Pick a new library... WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary(); if (null != web_library_detail) { ConfigurationManager.Instance.ConfigurationRecord.InCite_LastLibrary = web_library_detail.Title; ConfigurationManager.Instance.ConfigurationRecord_Bindable.NotifyPropertyChanged(() => ConfigurationManager.Instance.ConfigurationRecord.InCite_LastLibrary); ChooseNewLibrary(web_library_detail); } e.Handled = true; }
void ButtonGrabPDFs_Click(object sender, RoutedEventArgs e) { Uri current_uri = CurrentWebBrowserControl.CurrentUri; string html = CurrentWebBrowserControl.PageHTML; List <string> urls = DownloadableFileGrabber.Grab(html, "pdf"); List <Uri> uris = new List <Uri>(); foreach (string url in urls) { Uri uri; if (Uri.TryCreate(current_uri, url, out uri)) { uris.Add(uri); } } if (0 < uris.Count) { string msg = String.Format( "Qiqqa has found {0} PDFs on this page. Please choose the library into which you want to import them." , uris.Count ); WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary(msg); if (null != web_library_detail) { foreach (Uri uri in uris) { ImportingIntoLibrary.AddNewDocumentToLibraryFromInternet_ASYNCHRONOUS(web_library_detail.library, uri.ToString()); } } else { MessageBoxes.Warn("No PDFs have been imported."); } } else { MessageBoxes.Info("Qiqqa could not find links to any PDFs on this page (with URLs ending in .pdf"); } }
private void MoveOrCopyCommon(Feature feature, bool delete_source_pdf_documents) { WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary(); if (null == web_library_detail) { Logging.Warn("User did not pick a library to copy or move to: pick = NULL."); return; } // Check that we are not moving any docs into the same library bool same_library = false; foreach (var pdf_document in pdf_documents) { if (pdf_document.Library.WebLibraryDetail == web_library_detail) { same_library = true; } } if (same_library) { MessageBoxes.Error("You can not move/copy a PDF from/to the same library."); return; } // Copying / Moving PDFDocuments takes a while, particularly if it's a large set. // // Hence this WORK should be executed by a background task. SafeThreadPool.QueueUserWorkItem(o => { FeatureTrackingManager.Instance.UseFeature(feature); ImportingIntoLibrary.ClonePDFDocumentsFromOtherLibrary_SYNCHRONOUS(pdf_documents, web_library_detail.library, delegate(PDFDocument target, PDFDocument source) { if (delete_source_pdf_documents && null != target && null != source && target != source) { source.Library.DeleteDocument(source); } }); }); }
private static void DoImportMyDocuments(object obj) { if (null == mdd) { Logging.Warn("Not sure how MendeleyImporter.MendeleyDatabaseDetails is null if we got a command to import..."); return; } FeatureTrackingManager.Instance.UseFeature(Features.Library_ImportAutoFromMendeley); WebLibraryDetail web_library_detail = null; WPFDoEvents.InvokeInUIThread(() => web_library_detail = WebLibraryPicker.PickWebLibrary() ); if (null != web_library_detail) { ImportingIntoLibrary.AddNewPDFDocumentsToLibraryWithMetadata_ASYNCHRONOUS(web_library_detail.library, false, false, mdd.metadata_imports.ToArray()); } }
static void DoImportMyDocuments(object obj) { if (null == mdd) { Logging.Warn("Not sure how EndnoteImporter.EndnoteDatabaseDetails is null if we got a command to import..."); return; } Qiqqa.UtilisationTracking.FeatureTrackingManager.Instance.UseFeature(Features.Library_ImportAutoFromEndNote); WebLibraryDetail web_library_detail = null; Application.Current.Dispatcher.Invoke(((Action)(() => web_library_detail = WebLibraryPicker.PickWebLibrary() ))); if (null != web_library_detail) { ImportingIntoLibrary.AddNewPDFDocumentsToLibraryWithMetadata_ASYNCHRONOUS(web_library_detail.library, false, false, mdd.metadata_imports.ToArray()); } }
private void MoveOrCopyCommon(Feature feature, bool delete_source_pdf_documents) { WebLibraryDetail web_library_detail = WebLibraryPicker.PickWebLibrary(); if (null == web_library_detail) { return; } // Check that we are not moving any docs into the same library bool same_library = false; foreach (var pdf_document in pdf_documents) { if (pdf_document.Library.WebLibraryDetail == web_library_detail) { same_library = true;; } } if (same_library) { MessageBoxes.Error("You can not move/copy a PDF from/to the same library."); return; } FeatureTrackingManager.Instance.UseFeature(feature); ImportingIntoLibrary.ClonePDFDocumentsFromOtherLibrary_SYNCHRONOUS(pdf_documents, web_library_detail.library); if (delete_source_pdf_documents) { foreach (var pdf_document in pdf_documents) { pdf_document.Deleted = true; pdf_document.Bindable.NotifyPropertyChanged(() => pdf_document.Deleted); } } }
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; }