コード例 #1
0
        private void WordLaunch_Load(object sender, EventArgs e)
        {
            txt_Title.Enabled   = false;
            txt_Content.Enabled = false;
            txt_Title.Text      = "Please wait while we load the page...";

            DragDropTools.EnableFileDrop(list_images, files =>
            {
                foreach (var file in files)
                {
                    AddToImageList(file);
                }
            });

            geckoWebBrowser1.Navigate(url);
            geckoWebBrowser1.DocumentCompleted += new EventHandler(geckoWebBrowser1_DocumentCompleted);
        }
コード例 #2
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;
        }