|
@@ -1,6 +1,14 @@
|
|
|
-using PDF_Master.ViewModels.HomePanel.PDFTools;
|
|
|
+using ComPDFKit.PDFDocument;
|
|
|
+using PDF_Master.Helper;
|
|
|
+using PDF_Master.Model;
|
|
|
+using PDF_Master.Properties;
|
|
|
+using PDF_Master.ViewModels.HomePanel.PDFTools;
|
|
|
+using System;
|
|
|
using System.Diagnostics;
|
|
|
+using System.IO;
|
|
|
+using System.Windows;
|
|
|
using System.Windows.Controls;
|
|
|
+using System.Windows.Interop;
|
|
|
|
|
|
namespace PDF_Master.Views.HomePanel.PDFTools
|
|
|
{
|
|
@@ -12,6 +20,8 @@ namespace PDF_Master.Views.HomePanel.PDFTools
|
|
|
|
|
|
private HomeFilesContentViewModel viewModel;
|
|
|
|
|
|
+ private IDropTargetHelper dropHelper;
|
|
|
+
|
|
|
public HomeFilesContent()
|
|
|
{
|
|
|
InitializeComponent();
|
|
@@ -20,7 +30,7 @@ namespace PDF_Master.Views.HomePanel.PDFTools
|
|
|
|
|
|
private void StackPanel_SizeChanged(object sender, System.Windows.SizeChangedEventArgs e)
|
|
|
{
|
|
|
- if (Gridroot.ActualWidth<628)
|
|
|
+ if (Gridroot.ActualWidth<638)
|
|
|
{
|
|
|
OpenFileStackPanel.Margin=new System.Windows.Thickness(0,0,0,0);
|
|
|
viewModel.CreatGridRowIndex = 1;
|
|
@@ -33,5 +43,88 @@ namespace PDF_Master.Views.HomePanel.PDFTools
|
|
|
viewModel.CreatGridColumnIndex = 1;
|
|
|
}
|
|
|
}
|
|
|
+ private void Grid_Drop(object sender, DragEventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Point iconPoint = e.GetPosition(this);
|
|
|
+ dropHelper?.Drop((System.Runtime.InteropServices.ComTypes.IDataObject)e.Data, ref iconPoint, e.Effects);
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ string dropFile = "Drop";
|
|
|
+ if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop))
|
|
|
+ {
|
|
|
+ //BtnBlank.IsEnabled = true;
|
|
|
+ int count = ((System.Array)e.Data.GetData(System.Windows.DataFormats.FileDrop)).Length;
|
|
|
+ for (int i = 0; i < count; i++)
|
|
|
+ {
|
|
|
+ dropFile = ((System.Array)e.Data.GetData(System.Windows.DataFormats.FileDrop)).GetValue(i).ToString();
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void MainPage_DragEnter(object sender, DragEventArgs e)
|
|
|
+ {
|
|
|
+ DropColorBorder.Visibility = Visibility.Visible;
|
|
|
+ NormalColorBorder.Visibility = Visibility.Collapsed;
|
|
|
+ //BtnBlank.IsEnabled = false;
|
|
|
+ //页面编辑和缩略图
|
|
|
+ if ((e.OriginalSource as Image) != null)
|
|
|
+ return;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (dropHelper == null)
|
|
|
+ {
|
|
|
+ dropHelper = Activator.CreateInstance(Type.GetTypeFromCLSID(new Guid("4657278A-411B-11D2-839A-00C04FD918D0"))) as IDropTargetHelper;
|
|
|
+ }
|
|
|
+ Point iconPoint = e.GetPosition(this);
|
|
|
+ dropHelper?.DragEnter(new WindowInteropHelper(Window.GetWindow(this)).Handle, (System.Runtime.InteropServices.ComTypes.IDataObject)e.Data, ref iconPoint, e.Effects);
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void MainPage_DragOver(object sender, DragEventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
+ if ((e.OriginalSource as Image) != null)
|
|
|
+ return;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ Point iconPoint = e.GetPosition(this);
|
|
|
+ dropHelper?.DragOver(ref iconPoint, e.Effects);
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void MainPage_DragLeave(object sender, DragEventArgs e)
|
|
|
+ {
|
|
|
+ DropColorBorder.Visibility = Visibility.Collapsed;
|
|
|
+ NormalColorBorder.Visibility = Visibility.Visible;
|
|
|
+ // BtnBlank.IsEnabled = true;
|
|
|
+ if ((e.OriginalSource as Image) != null)
|
|
|
+ return;
|
|
|
+ try
|
|
|
+ {
|
|
|
+ dropHelper?.DragLeave();
|
|
|
+ }
|
|
|
+ catch
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|