|
@@ -313,8 +313,9 @@ namespace PDF_Office.Views.PageEdit
|
|
{
|
|
{
|
|
try
|
|
try
|
|
{
|
|
{
|
|
- if (e.LeftButton == MouseButtonState.Pressed)
|
|
|
|
|
|
+ if (e.LeftButton == MouseButtonState.Pressed&&!isDragingEnter)
|
|
{
|
|
{
|
|
|
|
+
|
|
//鼠标框选逻辑
|
|
//鼠标框选逻辑
|
|
if (startChoose)
|
|
if (startChoose)
|
|
{
|
|
{
|
|
@@ -331,6 +332,7 @@ namespace PDF_Office.Views.PageEdit
|
|
DoSelectItems();
|
|
DoSelectItems();
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
//拖拽排序的逻辑
|
|
//拖拽排序的逻辑
|
|
var pos = e.GetPosition(ListPageEdit);
|
|
var pos = e.GetPosition(ListPageEdit);
|
|
if (pos.Y < 0 || pos.Y > ListPageEdit.ActualHeight)
|
|
if (pos.Y < 0 || pos.Y > ListPageEdit.ActualHeight)
|
|
@@ -365,7 +367,9 @@ namespace PDF_Office.Views.PageEdit
|
|
System.IO.File.Create(tempPath);
|
|
System.IO.File.Create(tempPath);
|
|
string[] files = new string[1];
|
|
string[] files = new string[1];
|
|
files[0] = tempPath;
|
|
files[0] = tempPath;
|
|
- DataObject dataObj = new DataObject(DataFormats.FileDrop, files);
|
|
|
|
|
|
+ //禁用从窗体拖拽到桌面的方法
|
|
|
|
+ //DataObject dataObj = new DataObject(DataFormats.FileDrop, files);
|
|
|
|
+ DataObject dataObj = new DataObject(listBoxItem);
|
|
DragDrop.DoDragDrop(ListPageEdit, dataObj, DragDropEffects.Copy);
|
|
DragDrop.DoDragDrop(ListPageEdit, dataObj, DragDropEffects.Copy);
|
|
Mouse.Capture(ListPageEdit);
|
|
Mouse.Capture(ListPageEdit);
|
|
return;
|
|
return;
|
|
@@ -531,6 +535,13 @@ namespace PDF_Office.Views.PageEdit
|
|
ImgPicture.Visibility = Visibility.Collapsed;
|
|
ImgPicture.Visibility = Visibility.Collapsed;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //拖入非法格式释放时 返回
|
|
|
|
+ string[] file = (string[])e.Data.GetData(DataFormats.FileDrop);
|
|
|
|
+ if (file != null)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
#region 功能付费锁
|
|
#region 功能付费锁
|
|
// //if (!App.IsActive())
|
|
// //if (!App.IsActive())
|
|
// //{
|
|
// //{
|
|
@@ -544,23 +555,24 @@ namespace PDF_Office.Views.PageEdit
|
|
#region 从外部拖拽插入文件
|
|
#region 从外部拖拽插入文件
|
|
if (isDragingEnter)
|
|
if (isDragingEnter)
|
|
{
|
|
{
|
|
- var files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
|
|
|
- Array.Reverse(files);
|
|
|
|
- foreach(string file in files)
|
|
|
|
- {
|
|
|
|
- System.IO.FileInfo info = new System.IO.FileInfo(file);
|
|
|
|
- if(System.IO.Path.GetExtension(file).ToLower()==".pdf"&&info.Length>0)
|
|
|
|
- {
|
|
|
|
- int index = InsertIndex == -1 ? 0 : InsertIndex;
|
|
|
|
- viewModel.InsertFromFile(index, file);
|
|
|
|
- viewModel.ReloadAfterOption(true,true,new Tuple<int, int>(0,ListPageEdit.Items.Count));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //其他文件 则新增一个页签打开
|
|
|
|
- // DragAddTab.Invoke(dragingEnterPath, new RoutedEventArgs());//底层库需要加一个 Load(TPDFDocument)的接口
|
|
|
|
- LineInset.Visibility = Visibility.Collapsed;
|
|
|
|
- ImgPicture.Visibility = Visibility.Collapsed;
|
|
|
|
- isDragingEnter = false;
|
|
|
|
|
|
+ //注释从外部拖拽插入文件的功能
|
|
|
|
+ //var files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
|
|
|
+ //Array.Reverse(files);
|
|
|
|
+ //foreach(string file in files)
|
|
|
|
+ //{
|
|
|
|
+ // System.IO.FileInfo info = new System.IO.FileInfo(file);
|
|
|
|
+ // if(System.IO.Path.GetExtension(file).ToLower()==".pdf"&&info.Length>0)
|
|
|
|
+ // {
|
|
|
|
+ // int index = InsertIndex == -1 ? 0 : InsertIndex;
|
|
|
|
+ // viewModel.InsertFromFile(index, file);
|
|
|
|
+ // viewModel.ReloadAfterOption(true,true,new Tuple<int, int>(0,ListPageEdit.Items.Count));
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+ ////其他文件 则新增一个页签打开
|
|
|
|
+ //// DragAddTab.Invoke(dragingEnterPath, new RoutedEventArgs());//底层库需要加一个 Load(TPDFDocument)的接口
|
|
|
|
+ //LineInset.Visibility = Visibility.Collapsed;
|
|
|
|
+ //ImgPicture.Visibility = Visibility.Collapsed;
|
|
|
|
+ //isDragingEnter = false;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
#endregion
|
|
#endregion
|
|
@@ -652,6 +664,12 @@ namespace PDF_Office.Views.PageEdit
|
|
if (e.KeyStates == (DragDropKeyStates.ControlKey | DragDropKeyStates.LeftMouseButton) || e.KeyStates == (DragDropKeyStates.ShiftKey | DragDropKeyStates.LeftMouseButton | DragDropKeyStates.ControlKey))
|
|
if (e.KeyStates == (DragDropKeyStates.ControlKey | DragDropKeyStates.LeftMouseButton) || e.KeyStates == (DragDropKeyStates.ShiftKey | DragDropKeyStates.LeftMouseButton | DragDropKeyStates.ControlKey))
|
|
return;
|
|
return;
|
|
|
|
|
|
|
|
+ //从外部拖入文件时 返回
|
|
|
|
+ string[] file = (string[])e.Data.GetData(DataFormats.FileDrop);
|
|
|
|
+ if(file!=null)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
//滚动后有 位置不准确 要减去滚动偏移量
|
|
//滚动后有 位置不准确 要减去滚动偏移量
|
|
@@ -660,6 +678,7 @@ namespace PDF_Office.Views.PageEdit
|
|
var result = VisualTreeHelper.HitTest(ListPageEdit, pos);
|
|
var result = VisualTreeHelper.HitTest(ListPageEdit, pos);
|
|
if (result == null)
|
|
if (result == null)
|
|
{
|
|
{
|
|
|
|
+ return;
|
|
//MidLane.Visibility = Visibility.Collapsed;
|
|
//MidLane.Visibility = Visibility.Collapsed;
|
|
//return;
|
|
//return;
|
|
}
|
|
}
|
|
@@ -859,7 +878,6 @@ namespace PDF_Office.Views.PageEdit
|
|
/// <param name="e"></param>
|
|
/// <param name="e"></param>
|
|
private void Grid_PreviewDragEnter(object sender, DragEventArgs e)
|
|
private void Grid_PreviewDragEnter(object sender, DragEventArgs e)
|
|
{
|
|
{
|
|
- DragDropHelper.DragEnter(this,e);
|
|
|
|
|
|
|
|
var file = (System.Array)e.Data.GetData(DataFormats.FileDrop);
|
|
var file = (System.Array)e.Data.GetData(DataFormats.FileDrop);
|
|
if (file == null)//为null 表示内部拖动 触发的
|
|
if (file == null)//为null 表示内部拖动 触发的
|
|
@@ -871,11 +889,13 @@ namespace PDF_Office.Views.PageEdit
|
|
{
|
|
{
|
|
System.IO.FileInfo info = new System.IO.FileInfo(f);
|
|
System.IO.FileInfo info = new System.IO.FileInfo(f);
|
|
//只要拖拽进来的文件里包含有pdf格式文件,就允许拖入
|
|
//只要拖拽进来的文件里包含有pdf格式文件,就允许拖入
|
|
- if(System.IO.Path.GetExtension(f).ToLower()==".pdf" &&info.Length>0)
|
|
|
|
|
|
+ if (System.IO.Path.GetExtension(f).ToLower() == ".pdf" && info.Length > 0)
|
|
{
|
|
{
|
|
isDragingEnter = true;
|
|
isDragingEnter = true;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ DragDropHelper.DragEnter(this, e);
|
|
}
|
|
}
|
|
|
|
|
|
private void Grid_DragLeave(object sender, DragEventArgs e)
|
|
private void Grid_DragLeave(object sender, DragEventArgs e)
|
|
@@ -894,5 +914,10 @@ namespace PDF_Office.Views.PageEdit
|
|
//较大幅度拖动才能触发排序
|
|
//较大幅度拖动才能触发排序
|
|
isDraging = true;
|
|
isDraging = true;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private void Border_Drop(object sender, DragEventArgs e)
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|