|
@@ -51,9 +51,27 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
PropertyRegionName = Guid.NewGuid().ToString();
|
|
|
BindingEvent();
|
|
|
InitDefaultValue();
|
|
|
+ InitToolDict();
|
|
|
}
|
|
|
|
|
|
- private Dictionary<string, bool> ToolExpandDict = new Dictionary<string, bool>();
|
|
|
+ private void InitToolDict()
|
|
|
+ {
|
|
|
+ ToolExpandDict.Add("SnapshotEdit", AnnotArgsType.SnapshotWithEditTool);
|
|
|
+ ToolExpandDict.Add("HighLight", AnnotArgsType.AnnotHighlight);
|
|
|
+ ToolExpandDict.Add("UnderLine", AnnotArgsType.AnnotUnderline);
|
|
|
+ ToolExpandDict.Add("Squiggly", AnnotArgsType.AnnotSquiggly);
|
|
|
+ ToolExpandDict.Add("Strikeout", AnnotArgsType.AnnotStrikeout);
|
|
|
+ ToolExpandDict.Add("Freehand", AnnotArgsType.AnnotFreehand);
|
|
|
+ ToolExpandDict.Add("Freetext", AnnotArgsType.AnnotFreeText);
|
|
|
+ ToolExpandDict.Add("StickyNote", AnnotArgsType.AnnotSticky);
|
|
|
+ ToolExpandDict.Add("Rect", AnnotArgsType.AnnotSquare);
|
|
|
+ ToolExpandDict.Add("Circle", AnnotArgsType.AnnotCircle);
|
|
|
+ ToolExpandDict.Add("Arrow", AnnotArgsType.AnnotLine);
|
|
|
+ ToolExpandDict.Add("Line", AnnotArgsType.AnnotLine);
|
|
|
+ ToolExpandDict.Add("Link", AnnotArgsType.AnnotLink);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
|
|
|
|
|
|
public void BtnMyTools_Click(CustomIconToggleBtn annotBtn)
|
|
|
{
|
|
@@ -64,73 +82,16 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
|
|
|
if (annotBtn.IsChecked == true)
|
|
|
{
|
|
|
- switch (annotBtn.Tag.ToString())
|
|
|
- {
|
|
|
- case "SnapshotEdit"://内容选择
|
|
|
- annotArgs = GetSnapshotEdit();
|
|
|
- isSnapshotEdit = true;
|
|
|
- break;
|
|
|
-
|
|
|
- case "HighLight"://字体高亮
|
|
|
- annotArgs = GetHighLight();
|
|
|
- break;
|
|
|
-
|
|
|
- case "UnderLine"://下划线
|
|
|
- annotArgs = GetUnderLine();
|
|
|
- break;
|
|
|
-
|
|
|
- case "Squiggly"://波浪线
|
|
|
- annotArgs = GetSquiggly();
|
|
|
- break;
|
|
|
-
|
|
|
- case "Strikeout"://删除线
|
|
|
- annotArgs = GetStrikeout();
|
|
|
- break;
|
|
|
-
|
|
|
- case "Freehand"://手绘
|
|
|
- annotArgs = GetFreehand();
|
|
|
- break;
|
|
|
-
|
|
|
- case "Freetext"://文本
|
|
|
- annotArgs = GetFreetext();
|
|
|
- break;
|
|
|
-
|
|
|
- case "StickyNote"://便签
|
|
|
- annotArgs = GetStickyNote();
|
|
|
- break;
|
|
|
+ var tag = annotBtn.Tag.ToString();
|
|
|
+ FindAnnotTypeKey(tag, ref annotArgs);
|
|
|
|
|
|
- case "Rect"://矩形
|
|
|
- annotArgs = GetRect();
|
|
|
- break;
|
|
|
-
|
|
|
- case "Circle"://圆
|
|
|
- annotArgs = GetCircle();
|
|
|
- break;
|
|
|
-
|
|
|
- case "Arrow"://箭头
|
|
|
- case "Line"://线
|
|
|
- annotArgs = GetArrowLine(annotBtn.Tag.ToString());
|
|
|
- break;
|
|
|
-
|
|
|
- case "Stamp"://图章
|
|
|
- annotArgs = GetStamp();
|
|
|
- isTemplateAnnot = true;
|
|
|
- break;
|
|
|
-
|
|
|
- case "Image":
|
|
|
- annotArgs = GetImage(annotBtn);
|
|
|
- break;
|
|
|
-
|
|
|
- case "Signature"://签名
|
|
|
- annotArgs = GetSignature();
|
|
|
- isTemplateAnnot = true;
|
|
|
- PDFViewer.SetMouseMode(MouseModes.PanTool);//清空其他注释
|
|
|
- break;
|
|
|
-
|
|
|
- case "Link"://链接
|
|
|
- viewContentViewModel.IsCreateLink = false;
|
|
|
- annotArgs = GetLink();
|
|
|
- break;
|
|
|
+ if (tag == "SnapshotEdit")
|
|
|
+ {
|
|
|
+ isSnapshotEdit = true;
|
|
|
+ }
|
|
|
+ else if(tag == "Signature" || tag == "Stamp")
|
|
|
+ {
|
|
|
+ isTemplateAnnot = true;
|
|
|
}
|
|
|
|
|
|
if (annotArgs != null)
|
|
@@ -158,6 +119,75 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void FindAnnotTypeKey(string tag, ref AnnotHandlerEventArgs annotArgs)
|
|
|
+ {
|
|
|
+ switch (tag)
|
|
|
+ {
|
|
|
+ case "SnapshotEdit"://内容选择
|
|
|
+ annotArgs = GetSnapshotEdit();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "HighLight"://字体高亮
|
|
|
+ annotArgs = GetHighLight();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "UnderLine"://下划线
|
|
|
+ annotArgs = GetUnderLine();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Squiggly"://波浪线
|
|
|
+ annotArgs = GetSquiggly();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Strikeout"://删除线
|
|
|
+ annotArgs = GetStrikeout();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Freehand"://手绘
|
|
|
+ annotArgs = GetFreehand();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Freetext"://文本
|
|
|
+ annotArgs = GetFreetext();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "StickyNote"://便签
|
|
|
+ annotArgs = GetStickyNote();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Rect"://矩形
|
|
|
+ annotArgs = GetRect();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Circle"://圆
|
|
|
+ annotArgs = GetCircle();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Arrow"://箭头
|
|
|
+ case "Line"://线
|
|
|
+ annotArgs = GetArrowLine(tag);
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Stamp"://图章
|
|
|
+ annotArgs = GetStamp();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Image":
|
|
|
+ annotArgs = GetImage();
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Signature"://签名
|
|
|
+ annotArgs = GetSignature();
|
|
|
+ PDFViewer.SetMouseMode(MouseModes.PanTool);//清空其他注释
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Link"://链接
|
|
|
+ viewContentViewModel.IsCreateLink = false;
|
|
|
+ annotArgs = GetLink();
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void AnnotProperty_DefaultStored(object sender, object e)
|
|
|
{
|
|
|
}
|
|
@@ -713,6 +743,19 @@ namespace PDF_Office.ViewModels.Tools
|
|
|
// isTemplateAnnot = true;
|
|
|
// break;
|
|
|
}
|
|
|
+
|
|
|
+ if (ToolExpandDict.ContainsValue(e.AnnotItemsList[0].EventType))
|
|
|
+ {
|
|
|
+ foreach(var item in ToolExpandDict)
|
|
|
+ {
|
|
|
+ if(item.Value == e.AnnotItemsList[0].EventType)
|
|
|
+ {
|
|
|
+ FindAnnotTypeKey(item.Key, ref annot);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
ShowPropertyPanel();
|
|
|
}
|
|
|
}
|