|
@@ -108,13 +108,6 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
keyShape["LineShape"] = new List<List<Point>> { new List<Point> { new Point(3.19995, 14), new Point(25.127, 14) } };
|
|
|
keyShape["DotShape"] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.19995), new Point(3.19995, 3.19995) } };
|
|
|
|
|
|
-
|
|
|
- //keyShape["HookShape"] = new List<List<Point>> { new List<Point> { new Point(0.599976, 7.0286), new Point(5.57775, 11.8), new Point(13.4, 1.40002) } };
|
|
|
- //keyShape["ForkShape"] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.20001), new Point(12.8, 12.8) }, new List<Point> { new Point(12.8, 3.20001), new Point(3.20005, 12.8) } };
|
|
|
- //keyShape["RectShape"] = new List<List<Point>> { new List<Point> { new Point(5, 5), new Point(28, 5) }, new List<Point> { new Point(28, 5), new Point(28, 27) }, new List<Point> { new Point(28, 27), new Point(5, 27) }, new List<Point> { new Point(5, 27), new Point(5, 5) } };
|
|
|
- //keyShape["LineShape"] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.20001), new Point(28, 3.20001) } };
|
|
|
- //keyShape["DotShape"] = new List<List<Point>> { new List<Point> { new Point(3.19995, 3.19995), new Point(3.19995, 3.19995) } };
|
|
|
-
|
|
|
}
|
|
|
#endregion
|
|
|
public DelegateCommand<object> AnnotDefaultValue_MenuCommand { get; set; }
|
|
@@ -157,6 +150,7 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
InitSelectMultiAnnotMenu();
|
|
|
SubscribeEvent();
|
|
|
InitShapeList();
|
|
|
+ InitFillAndSignProperty();
|
|
|
}
|
|
|
|
|
|
#region 事件聚合器(来自AnnotToolContentViewModel)
|
|
@@ -774,11 +768,11 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- if (IsCopyShape && !IsSelectShape)
|
|
|
- {
|
|
|
- ShapeNames.Clear();
|
|
|
+ //if (IsCopyShape && !IsSelectShape)
|
|
|
+ //{
|
|
|
+ // ShapeNames.Clear();
|
|
|
|
|
|
- }
|
|
|
+ //}
|
|
|
freehandArgs = selectedArgs[0] as FreehandAnnotArgs;
|
|
|
foreach (var item in selectedArgs)
|
|
|
{
|
|
@@ -788,18 +782,18 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
{
|
|
|
if ((item as FreehandAnnotArgs).PageIndex == point.PageIndex && (item as FreehandAnnotArgs).AnnotIndex == point.AnnotIndex)
|
|
|
{
|
|
|
- if (IsCopyShape && !IsSelectShape)
|
|
|
- {
|
|
|
- ShapeNames.Add(point.Shape);
|
|
|
- Trace.WriteLine("woshi什么" + point.Shape);
|
|
|
- }
|
|
|
-
|
|
|
+ //if (IsCopyShape && !IsSelectShape)
|
|
|
+ //{
|
|
|
+ // ShapeNames.Add(point.Shape);
|
|
|
+ // Trace.WriteLine("woshi什么" + point.Shape);
|
|
|
+ //}
|
|
|
newSelectedArgs.Add(item);
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- IsCopyShape = true;
|
|
|
+ //IsCopyShape = true;
|
|
|
//freehandArgs.RawPointList = ShapePoints;
|
|
|
//freehandArgs.InkColor = (SelectColor as SolidColorBrush).Color;
|
|
|
//freehandArgs.Transparency = 1;
|
|
@@ -1195,7 +1189,7 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
PDFViewer.AnnotEditHandler += PDFViewer_AnnotEditHandler;
|
|
|
PDFViewer.AnnotHoverHandler -= PDFViewer_AnnotHoverHandler;
|
|
|
PDFViewer.AnnotHoverHandler += PDFViewer_AnnotHoverHandler;
|
|
|
- CommandManager.AddPreviewExecutedHandler(PDFViewer, PreviewExcuteView);
|
|
|
+ //CommandManager.AddPreviewExecutedHandler(PDFViewer, PreviewExcute);
|
|
|
KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
|
|
|
KeyEventsHelper.KeyDown += ShortCut_KeyDown;
|
|
|
}
|
|
@@ -1225,11 +1219,11 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
{
|
|
|
if (e.AnnotEventArgsList == null || (PDFViewer != null && PDFViewer.MouseMode == MouseModes.FormEditTool))
|
|
|
return;
|
|
|
- if ((UIElement)sender != null)
|
|
|
- {
|
|
|
+ //if ((UIElement)sender != null)
|
|
|
+ //{
|
|
|
|
|
|
- CommandManager.AddPreviewExecutedHandler((UIElement)sender, PreviewExcute);
|
|
|
- }
|
|
|
+ // CommandManager.AddPreviewExecutedHandler((UIElement)sender, PreviewExcute);
|
|
|
+ //}
|
|
|
switch (e.CommandType)
|
|
|
{
|
|
|
case CommandType.Context:
|
|
@@ -1534,6 +1528,7 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
if (e != null && e.Count > 0)
|
|
|
{
|
|
|
Dictionary<int, List<int>> selectAnnotDicts = new Dictionary<int, List<int>>();
|
|
|
+
|
|
|
for (int i = 0; i < e.Count; i++)
|
|
|
{
|
|
|
AnnotEditEvent editEvent = e[i];
|
|
@@ -1551,23 +1546,25 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
{
|
|
|
selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
|
|
|
}
|
|
|
- if (editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotFreehand)
|
|
|
- {
|
|
|
- if (IsSelectShape)
|
|
|
- {
|
|
|
- if (ShapeNames.Count == 0) { continue; }
|
|
|
- try
|
|
|
- {
|
|
|
- viewContentViewModel.FillAndSign.Add(new FillAndSignIsShape(pageindex, annotindex, ShapeNames[i]));
|
|
|
- //PDFViewer.SelectAnnotation(pageindex, annotindex);
|
|
|
+ //if (editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotFreehand)
|
|
|
+ //{
|
|
|
+ // //if (IsSelectShape)
|
|
|
+ // //{
|
|
|
+ // if (ShapeNames.Count == 0) { continue; }
|
|
|
+ // if (ShapeNames[i] == "Freehand") { continue; }
|
|
|
+ // try
|
|
|
+ // {
|
|
|
+ // viewContentViewModel.FillAndSign.Add(new FillAndSignIsShape(pageindex, annotindex, ShapeNames[i]));
|
|
|
+ // //PDFViewer.SelectAnnotation(pageindex, annotindex);
|
|
|
|
|
|
- continue;
|
|
|
- }
|
|
|
- catch { continue; }
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+ // catch { continue; }
|
|
|
|
|
|
- }
|
|
|
+ // //}
|
|
|
+
|
|
|
+ //}
|
|
|
|
|
|
- }
|
|
|
if (editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotStamp)
|
|
|
{
|
|
|
if (Shape != "None")
|
|
@@ -1583,34 +1580,26 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
}
|
|
|
PDFViewer.SelectAnnotation(pageindex, annotindex);
|
|
|
}
|
|
|
+ //else
|
|
|
+ //{
|
|
|
+ // foreach (var point in viewContentViewModel.FillAndSign)
|
|
|
+ // {
|
|
|
+ // if (pageindex == point.PageIndex && annotindex == point.AnnotIndex)
|
|
|
+ // {
|
|
|
+ // point.Shape= Shape;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
|
|
|
break;
|
|
|
case ActionType.Del:
|
|
|
- if (Shape != "None")
|
|
|
- {
|
|
|
- for (int j = 0; j < viewContentViewModel.FillAndSign.Count; j++)
|
|
|
- {
|
|
|
- if (viewContentViewModel.FillAndSign[j].PageIndex == pageindex && viewContentViewModel.FillAndSign[j].AnnotIndex == annotindex)
|
|
|
- {
|
|
|
-
|
|
|
- viewContentViewModel.FillAndSign.Remove(viewContentViewModel.FillAndSign[j]);
|
|
|
- }
|
|
|
- }
|
|
|
- for (int j = 0; j < viewContentViewModel.AnnotSignatures.Count; j++)
|
|
|
- {
|
|
|
- if (viewContentViewModel.AnnotSignatures[j].Item1 == pageindex && viewContentViewModel.AnnotSignatures[j].Item2 == annotindex)
|
|
|
- {
|
|
|
-
|
|
|
- viewContentViewModel.AnnotSignatures.Remove(viewContentViewModel.AnnotSignatures[j]);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- IsSelectShape = false;
|
|
|
- if (selectAnnotDicts.Count > 0)
|
|
|
+ if (selectAnnotDicts.Count > 1)
|
|
|
{
|
|
|
PDFViewer.SelectAnnotation(selectAnnotDicts);
|
|
|
}
|
|
@@ -1792,31 +1781,53 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
viewContentViewModel.IsPropertyOpen = show;
|
|
|
}
|
|
|
|
|
|
- private void PreviewExcute(object sender, ExecutedRoutedEventArgs e)
|
|
|
- {
|
|
|
- if (e.Command == ApplicationCommands.Paste)
|
|
|
- {
|
|
|
- IsSelectShape = true;
|
|
|
- }
|
|
|
- if (e.Command == ApplicationCommands.Copy)
|
|
|
- {
|
|
|
-
|
|
|
- IsCopyShape = false;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private void PreviewExcuteView(object sender, ExecutedRoutedEventArgs e)
|
|
|
- {
|
|
|
- if (e.Command == ApplicationCommands.Paste)
|
|
|
- {
|
|
|
- IsSelectShape = true;
|
|
|
- }
|
|
|
- if (e.Command == ApplicationCommands.Copy)
|
|
|
- {
|
|
|
-
|
|
|
- IsCopyShape = false;
|
|
|
- }
|
|
|
- }
|
|
|
+ //private void PreviewExcute(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ //{
|
|
|
+ // if (e.Command == ApplicationCommands.Paste)
|
|
|
+ // {
|
|
|
+ // ShapeNames.Clear();
|
|
|
+ // Trace.WriteLine("几次" + 1);
|
|
|
+ // var items = PDFViewer.GetCopyAnnotData();
|
|
|
+ // foreach (var item in items)
|
|
|
+ // {
|
|
|
+ // bool IsShape = false;
|
|
|
+ // foreach (var point in viewContentViewModel.FillAndSign)
|
|
|
+ // {
|
|
|
+ // if ((item as FreehandAnnotArgs).PageIndex == point.PageIndex && (item as FreehandAnnotArgs).AnnotIndex == point.AnnotIndex)
|
|
|
+ // {
|
|
|
+
|
|
|
+ // ShapeNames.Add(point.Shape);
|
|
|
+ // Trace.WriteLine("woshi什么" + point.Shape);
|
|
|
+ // IsShape = true;
|
|
|
+ // continue;
|
|
|
+ // }
|
|
|
+
|
|
|
+ // }
|
|
|
+ // if (!IsShape) {
|
|
|
+ // ShapeNames.Add("Freehand");
|
|
|
+ // Trace.WriteLine("woshi什么" + "Freehand");
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (e.Command == ApplicationCommands.Copy)
|
|
|
+ // {
|
|
|
+
|
|
|
+ // IsCopyShape = false;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
+
|
|
|
+ //private void PreviewExcuteView(object sender, ExecutedRoutedEventArgs e)
|
|
|
+ //{
|
|
|
+ // if (e.Command == ApplicationCommands.Paste)
|
|
|
+ // {
|
|
|
+ // IsSelectShape = true;
|
|
|
+ // }
|
|
|
+ // if (e.Command == ApplicationCommands.Copy)
|
|
|
+ // {
|
|
|
+
|
|
|
+ // IsCopyShape = false;
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
#region Navigation
|
|
|
|
|
@@ -1829,7 +1840,6 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
{
|
|
|
UnBindingPDFViewerHandler();
|
|
|
ContextMenu contextMenu = App.Current.FindResource("ViewerContextMenu") as ContextMenu;
|
|
|
-
|
|
|
ViewerContextMenu_Loaded(contextMenu, null, Visibility.Visible);
|
|
|
viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
PDFViewer.SetMouseMode(MouseModes.PanTool);
|
|
@@ -1845,7 +1855,6 @@ namespace PDF_Master.ViewModels.FillAndSign
|
|
|
BindingPDFViewerHandler();
|
|
|
HookShapeIsCheck = true;
|
|
|
HookShapeIsCheck = false;
|
|
|
- InitFillAndSignProperty();
|
|
|
ShowPropertyPanel(false);
|
|
|
// InitCheckedEvent("RbtnTick");
|
|
|
IsEdit = false;
|