예제 #1
0
        private void DoCmdDropFiles(System.Windows.DragEventArgs e)
        {
            if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop))
            {
                string[] droppedFilePaths = e.Data.GetData(System.Windows.DataFormats.FileDrop, true) as string[];

                this.Files.Clear();

                // Add only valid PDF files
                foreach (string path in droppedFilePaths)
                {
                    if (PDFDocument.PDFCheck(path))
                    {
                        this.Files.Add(path);
                    }
                }

                // Only one file: open it in the main window
                if (this.Files.Count == 1)
                {
                    this.MsgOpenFile_Handler(new MsgOpenFile(this.Files[0], true, false));
                }

                // Shows the window for merging documents, if more than one file is dropped to the window
                if (this.Files.Count > 1)
                {
                    GenericMessageAction <MsgShowMergeDocuments, MsgOpenFile> message = new GenericMessageAction <MsgShowMergeDocuments, MsgOpenFile>(
                        new MsgShowMergeDocuments(this.Files), this.MsgOpenFile_Handler);

                    Messenger.Default.Send(message);
                }
            }
        }
예제 #2
0
        private void DoCmdDropFiles(System.Windows.DragEventArgs e)
        {
            if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop))
            {
                string[] droppedFilePaths = e.Data.GetData(System.Windows.DataFormats.FileDrop, true) as string[];

                // Add only valid PDF files
                foreach (string path in droppedFilePaths)
                {
                    if (PDFDocument.PDFCheck(path))
                    {
                        this.Files.Add(new FileToMergeViewModel(path));
                    }
                }
            }
        }