|
@@ -694,11 +694,13 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
//没有选择注释工具、也不是右键添加注释
|
|
|
//在阅读页,选择注释后,点击按钮
|
|
|
//需要设置相关参数
|
|
|
- if (AnnotAttribEvent.IsAnnotCreateReset == false)
|
|
|
+ if (AnnotAttribEvent.IsAnnotCreateReset == false && propertyPanel.IsAddLink == false)
|
|
|
{
|
|
|
+ propertyPanel.IsLocationLink = true;
|
|
|
+
|
|
|
pdfViewer.SetMouseMode(MouseModes.AnnotCreate);
|
|
|
- pdfViewer.SetToolParam(linkAnnotArgs);
|
|
|
- IsAnnotSelect = false;
|
|
|
+
|
|
|
+ pdfViewer.SetToolParam(LinkAnnotArgs);
|
|
|
}
|
|
|
|
|
|
pdfViewer.EnableDrawSelectArea(true);
|
|
@@ -733,12 +735,18 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
/// </summary>
|
|
|
/// <param name="sender"></param>
|
|
|
/// <param name="e"></param>
|
|
|
- private async void PDFViewer_CustomNotifyHandler(object sender, CustomNotityData e)
|
|
|
+ private void PDFViewer_CustomNotifyHandler(object sender, CustomNotityData e)
|
|
|
{
|
|
|
if (e.NotifyType == CustomNotifyType.LinkAreaLocate)
|
|
|
{
|
|
|
if (e.NotifyData is AreaLocate areaInfo)
|
|
|
{
|
|
|
+ if (pdfViewer.ToolManager.CurrentAnnotArgs == null)
|
|
|
+ {
|
|
|
+ CleanLocationState();
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (pdfViewer.ToolManager.CurrentAnnotArgs.EventType == AnnotArgsType.AnnotLink && pdfViewer.MouseMode == MouseModes.AnnotCreate)
|
|
|
{
|
|
|
LinkAnnotArgs linkArgs = pdfViewer.ToolManager.CurrentAnnotArgs as LinkAnnotArgs;
|
|
@@ -750,37 +758,63 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
historyPageIndex = linkArgs.PageIndex;
|
|
|
LinkAnnotArgs = linkArgs;
|
|
|
//LinkAnnotArgs.PageIndex = historyPageIndex;
|
|
|
+ if (linkArgs.AnnotIndex != -1)
|
|
|
+ {
|
|
|
+ AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
|
|
|
+ AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, areaInfo.PageIndex);
|
|
|
+ AnnotAttribEvent?.UpdateAnnot();
|
|
|
|
|
|
- AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
|
|
|
- AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, areaInfo.PageIndex);
|
|
|
- AnnotAttribEvent?.UpdateAnnot();
|
|
|
+ LinkAnnotArgs.InvokeLinkSaveCalled(this, EventArgs.Empty);
|
|
|
|
|
|
- LinkAnnotArgs.InvokeLinkSaveCalled(this, EventArgs.Empty);
|
|
|
+ PageNumTextContent = (areaInfo.PageIndex + 1).ToString();
|
|
|
+ SetImagePreview(areaInfo.PageIndex);
|
|
|
|
|
|
- PageNumTextContent = (areaInfo.PageIndex + 1).ToString();
|
|
|
- SetImagePreview(areaInfo.PageIndex);
|
|
|
+ //viewContentViewModel.LinkAnnotTipVisibility = Visibility.Collapsed;
|
|
|
+ viewContentViewModel.TipVisible = Visibility.Collapsed;
|
|
|
|
|
|
- //viewContentViewModel.LinkAnnotTipVisibility = Visibility.Collapsed;
|
|
|
- viewContentViewModel.TipVisible = Visibility.Collapsed;
|
|
|
- BtnLocationIsChecked = false;
|
|
|
+ //await System.Threading.Tasks.Task.Delay(5);
|
|
|
+ //SelectAnnotation();
|
|
|
|
|
|
- //没有选择注释工具、也不是右键添加注释
|
|
|
- //在阅读页,选择注释后,点击按钮
|
|
|
- //需要设置相关参数
|
|
|
- if (IsAnnotSelect == false)
|
|
|
- {
|
|
|
- pdfViewer.SetMouseMode(MouseModes.PanTool);
|
|
|
- }
|
|
|
+ //pdfViewer.GoToPage(historyPageIndex);
|
|
|
|
|
|
- await System.Threading.Tasks.Task.Delay(2);
|
|
|
- SelectAnnotation();
|
|
|
+ propertyPanel.IsLocationLink = false;
|
|
|
+ //没有选择注释工具、也不是右键添加注释
|
|
|
+ //在阅读页,选择注释后,点击按钮
|
|
|
+ //需要设置相关参数
|
|
|
+ if (propertyPanel.IsAddLink == false)
|
|
|
+ {
|
|
|
+ pdfViewer.SetMouseMode(MouseModes.PanTool);
|
|
|
+ }
|
|
|
+ //await System.Threading.Tasks.Task.Delay(5);
|
|
|
+ pdfViewer.GoToPage(historyPageIndex);
|
|
|
+ pdfViewer.SelectAnnotation(LinkAnnotArgs.PageIndex, LinkAnnotArgs.AnnotIndex);
|
|
|
|
|
|
- pdfViewer.GoToPage(historyPageIndex);
|
|
|
+ BtnLocationIsChecked = false;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CleanLocationState();
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void CleanLocationState()
|
|
|
+ {
|
|
|
+ viewContentViewModel.TipVisible = Visibility.Collapsed;
|
|
|
+ BtnLocationIsChecked = false;
|
|
|
+ propertyPanel.IsLocationLink = false;
|
|
|
+ //没有选择注释工具、也不是右键添加注释
|
|
|
+ //在阅读页,选择注释后,点击按钮
|
|
|
+ //需要设置相关参数
|
|
|
+ if (propertyPanel.IsAddLink == false)
|
|
|
+ {
|
|
|
+ pdfViewer.SetMouseMode(MouseModes.PanTool);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 前往/返回按钮
|
|
|
/// </summary>
|
|
@@ -893,9 +927,9 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
/// </summary>
|
|
|
private void SelectAnnotation()
|
|
|
{
|
|
|
- if (linkAnnotArgs != null && !isSelected && linkAnnotArgs.AnnotIndex >= 0)
|
|
|
+ if (LinkAnnotArgs != null && !isSelected && LinkAnnotArgs.AnnotIndex >= 0)
|
|
|
{
|
|
|
- pdfViewer.SelectAnnotation(linkAnnotArgs.PageIndex, linkAnnotArgs.AnnotIndex);
|
|
|
+ pdfViewer.SelectAnnotation(LinkAnnotArgs.PageIndex, LinkAnnotArgs.AnnotIndex);
|
|
|
isSelected = true;
|
|
|
}
|
|
|
else
|
|
@@ -1174,36 +1208,38 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
LinkAnnotArgs.PageIndex = pdfViewer.CurrentIndex;
|
|
|
}
|
|
|
}
|
|
|
- if (AnnotAttribEvent.Attribs.ContainsKey(AnnotAttrib.LinkUri))
|
|
|
- {
|
|
|
- string linkUrl = (string)AnnotAttribEvent.Attribs[AnnotAttrib.LinkUri];
|
|
|
- if (!string.IsNullOrEmpty(linkUrl))
|
|
|
- {
|
|
|
- if (linkUrl.StartsWith("mailto:", StringComparison.OrdinalIgnoreCase))
|
|
|
- {
|
|
|
- SetLinkType(LINK_TYPE.URI, true);
|
|
|
- if (AnnotAttribEvent.IsAnnotCreateReset)
|
|
|
- {
|
|
|
- SetLinkEmail("");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SetLinkEmail(linkUrl.ToLower().TrimStart("mailto:".ToCharArray()));
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (AnnotAttribEvent.IsAnnotCreateReset)
|
|
|
- {
|
|
|
- SetLinkUrl("");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SetLinkUrl(linkUrl);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ //暂定 第一版 不显示邮箱、web链接模块
|
|
|
+
|
|
|
+ //if (AnnotAttribEvent.Attribs.ContainsKey(AnnotAttrib.LinkUri))
|
|
|
+ //{
|
|
|
+ // string linkUrl = (string)AnnotAttribEvent.Attribs[AnnotAttrib.LinkUri];
|
|
|
+ // if (!string.IsNullOrEmpty(linkUrl))
|
|
|
+ // {
|
|
|
+ // if (linkUrl.StartsWith("mailto:", StringComparison.OrdinalIgnoreCase))
|
|
|
+ // {
|
|
|
+ // SetLinkType(LINK_TYPE.URI, true);
|
|
|
+ // if (AnnotAttribEvent.IsAnnotCreateReset)
|
|
|
+ // {
|
|
|
+ // SetLinkEmail("");
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // SetLinkEmail(linkUrl.ToLower().TrimStart("mailto:".ToCharArray()));
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // if (AnnotAttribEvent.IsAnnotCreateReset)
|
|
|
+ // {
|
|
|
+ // SetLinkUrl("");
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // SetLinkUrl(linkUrl);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
private void SetLinkUrl(string url)
|
|
@@ -1255,6 +1291,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
BtnLinkPageIsChecked = true;
|
|
|
BtnGOorBackVisibility = Visibility.Collapsed;
|
|
|
+ viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
|
|
|
return;
|
|
|
}
|
|
|
switch (linkType)
|