|
@@ -1,5 +1,6 @@
|
|
|
using PDF_Office.CustomControl;
|
|
|
using PDF_Office.Helper;
|
|
|
+using PDF_Office.Model.PDFTool;
|
|
|
using PDF_Office.ViewModels.HomePanel;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
@@ -30,9 +31,9 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
private ListItemQuickTool targetListItem = null;
|
|
|
private ListItemQuickTool quickSourceListItem = null;
|
|
|
|
|
|
- private List<QuickToolItem> quickTools = null;
|
|
|
- private List<QuickToolItem> allTools = null;
|
|
|
- private List<QuickToolItem> moreTools = null;
|
|
|
+ private List<ToolItem> quickTools = null;
|
|
|
+ private List<ToolItem> allTools = null;
|
|
|
+ private List<ToolItem> moreTools = null;
|
|
|
|
|
|
private string fileName = string.Empty;
|
|
|
private BitmapSource bitmapSource = null;
|
|
@@ -46,8 +47,8 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
{
|
|
|
InitializeComponent();
|
|
|
|
|
|
- quickTools = new List<QuickToolItem>();
|
|
|
- allTools = new List<QuickToolItem>();
|
|
|
+ quickTools = new List<ToolItem>();
|
|
|
+ allTools = new List<ToolItem>();
|
|
|
|
|
|
#region ListBox
|
|
|
|
|
@@ -76,7 +77,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
|
|
|
for (int i = 0; i < all.Count; i++)
|
|
|
{
|
|
|
- QuickToolItem aToolModule = new QuickToolItem();
|
|
|
+ ToolItem aToolModule = new ToolItem();
|
|
|
aToolModule.Id = i + 1;
|
|
|
aToolModule.Name = all[i];
|
|
|
aToolModule.Image = path;
|
|
@@ -84,7 +85,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
}
|
|
|
|
|
|
//取前10个,如果List里面数据少于5个,则返回所有的
|
|
|
- quickTools = allTools.Take(8).ToList<QuickToolItem>();
|
|
|
+ quickTools = allTools.Take(8).ToList<ToolItem>();
|
|
|
ListShortCuts.ItemsSource = quickTools;
|
|
|
//对比两个集合,取差值
|
|
|
moreTools = allTools.Except(quickTools).ToList();
|
|
@@ -119,7 +120,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
//获取控件相对于另一控件的坐标
|
|
|
wrpnlPoint = sourceListItem.TranslatePoint(new Point(), this);
|
|
|
|
|
|
- System.Windows.DataObject dataObj = new System.Windows.DataObject(sourceListItem.Content as QuickToolItem);
|
|
|
+ System.Windows.DataObject dataObj = new System.Windows.DataObject(sourceListItem.Content as ToolItem);
|
|
|
|
|
|
if (dataObj != null)
|
|
|
{
|
|
@@ -154,9 +155,9 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
|
|
|
private void IsMoreToolbars()
|
|
|
{
|
|
|
- var source = sourceListItem.Content as QuickToolItem;
|
|
|
+ var source = sourceListItem.Content as ToolItem;
|
|
|
if (moreTools == null && moreTools.Count != 0) return;
|
|
|
- List<QuickToolItem> toolModule = moreTools.FindAll(item => item.Name == source.Name);
|
|
|
+ List<ToolItem> toolModule = moreTools.FindAll(item => item.Name == source.Name);
|
|
|
if (toolModule.Count > 0)
|
|
|
{
|
|
|
// 判断文件夹是否存在,不存在则创建
|
|
@@ -189,11 +190,11 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
WorkingWithAnimation(pos);
|
|
|
return;
|
|
|
}
|
|
|
- var targetAToolModule = targetListItem.Content as QuickToolItem;
|
|
|
- QuickToolItem target = quickTools.Find(c => c.Name == targetAToolModule.Name);
|
|
|
+ var targetAToolModule = targetListItem.Content as ToolItem;
|
|
|
+ ToolItem target = quickTools.Find(c => c.Name == targetAToolModule.Name);
|
|
|
|
|
|
//查找元数据
|
|
|
- var sourceAToolModule = e.Data.GetData(typeof(QuickToolItem)) as QuickToolItem;
|
|
|
+ var sourceAToolModule = e.Data.GetData(typeof(ToolItem)) as ToolItem;
|
|
|
if (sourceAToolModule == null)
|
|
|
{
|
|
|
sourceImage.Visibility = Visibility.Hidden;
|
|
@@ -217,10 +218,10 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
ModuleExchange(sourceAToolModule, targetAToolModule);
|
|
|
}
|
|
|
|
|
|
- private void ModuleExchange(QuickToolItem sourceAToolModule, QuickToolItem targetAToolModule)
|
|
|
+ private void ModuleExchange(ToolItem sourceAToolModule, ToolItem targetAToolModule)
|
|
|
{
|
|
|
if (moreTools == null) return;
|
|
|
- QuickToolItem source = moreTools.Find(c => c.Name == sourceAToolModule.Name);
|
|
|
+ ToolItem source = moreTools.Find(c => c.Name == sourceAToolModule.Name);
|
|
|
|
|
|
int targetIndex = quickTools.FindIndex(item => item.Name == targetAToolModule.Name);
|
|
|
if (targetIndex < 0) return;
|
|
@@ -350,7 +351,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
stream.Close();
|
|
|
}
|
|
|
|
|
|
- private QuickToolItem target;
|
|
|
+ private ToolItem target;
|
|
|
|
|
|
private void ListBoxShortCuts_DragOver(object sender, DragEventArgs e)
|
|
|
{
|
|
@@ -387,7 +388,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
|
|
|
if (!isMoreCuts)
|
|
|
{
|
|
|
- var sourceAToolModule = e.Data.GetData(typeof(QuickToolItem)) as QuickToolItem;
|
|
|
+ var sourceAToolModule = e.Data.GetData(typeof(ToolItem)) as ToolItem;
|
|
|
if (sourceAToolModule == null) return;
|
|
|
int sourceIndex = quickTools.FindIndex(item => item.Name == sourceAToolModule.Name);
|
|
|
//根据index找listbox对应的item
|
|
@@ -401,7 +402,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- var sourceAToolModule = e.Data.GetData(typeof(QuickToolItem)) as QuickToolItem;
|
|
|
+ var sourceAToolModule = e.Data.GetData(typeof(ToolItem)) as ToolItem;
|
|
|
if (sourceAToolModule == null) return;
|
|
|
int sourceIndex = moreTools.FindIndex(item => item.Name == sourceAToolModule.Name);
|
|
|
//根据index找listbox对应的item
|
|
@@ -428,7 +429,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
//sourceImage.Visibility = Visibility.Hidden;
|
|
|
return;
|
|
|
}
|
|
|
- var targetAToolModule = targetListItem.Content as QuickToolItem;
|
|
|
+ var targetAToolModule = targetListItem.Content as ToolItem;
|
|
|
if (targetAToolModule == null) return;
|
|
|
target = quickTools.Find(c => c.Name == targetAToolModule.Name);
|
|
|
}
|
|
@@ -461,7 +462,7 @@ namespace PDF_Office.Views.HomePanel.PDFTools
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
- System.Windows.DataObject dataObj = new System.Windows.DataObject(quickSourceListItem.Content as QuickToolItem);
|
|
|
+ System.Windows.DataObject dataObj = new System.Windows.DataObject(quickSourceListItem.Content as ToolItem);
|
|
|
|
|
|
if (dataObj != null)
|
|
|
{
|