|
@@ -29,6 +29,7 @@ using System.Text.RegularExpressions;
|
|
|
using System.Net;
|
|
|
using System.Diagnostics;
|
|
|
using static Dropbox.Api.TeamLog.TrustedTeamsRequestState;
|
|
|
+using System.Windows.Input;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
@@ -85,8 +86,9 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (AnnotArgs != null)
|
|
|
{
|
|
|
AnnotArgs.DestIndex = pageNum - 1;
|
|
|
-
|
|
|
- SetImagePreview(AnnotArgs.DestIndex);
|
|
|
+ AnnotArgs.Content = string.Format($"To Page {AnnotArgs.DestIndex}");
|
|
|
+ //isTextChanged = (int)AnnotAttribEvent.Attribs[AnnotAttrib.LinkDestIndx] != AnnotArgs.DestIndex ? true : false;
|
|
|
+ //SetImagePreview(AnnotArgs.DestIndex);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -118,6 +120,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (AnnotArgs != null)
|
|
|
{
|
|
|
AnnotArgs.URI = pageWebTextContent;
|
|
|
+ AnnotArgs.Content = AnnotArgs.URI;
|
|
|
+ //isTextChanged = (string)AnnotAttribEvent.Attribs[AnnotAttrib.LinkUri] != AnnotArgs.URI ? true : false;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -140,6 +144,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (!string.IsNullOrEmpty(pageMailTextContent) && AnnotArgs != null)
|
|
|
{
|
|
|
AnnotArgs.URI = "mailto:" + pageMailTextContent.Trim();
|
|
|
+ AnnotArgs.Content = AnnotArgs.URI;
|
|
|
+ //isTextChanged = (string)AnnotAttribEvent.Attribs[AnnotAttrib.LinkUri] != AnnotArgs.URI ? true : false;
|
|
|
}
|
|
|
}
|
|
|
return pageMailTextContent;
|
|
@@ -409,6 +415,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
private bool isLoaded = false;
|
|
|
private bool isMail = false;
|
|
|
+ private bool isTextChanged = false;
|
|
|
private string historyBtnGOorBackTag = string.Empty;
|
|
|
private int totalPage = 0;
|
|
|
private int backPageIndex = 0;
|
|
@@ -419,7 +426,9 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
private Button btnGOorBack = null;
|
|
|
private LinkAnnotProperty linkAnnot;
|
|
|
public DelegateCommand<object> LoadedCommand { get; set; }
|
|
|
- public DelegateCommand<object> PageNumTextChangedCommand { get; set; }
|
|
|
+ public DelegateCommand<object> PageNumTextLostFocusCommand { get; set; }
|
|
|
+
|
|
|
+ public DelegateCommand<object> PageNumTextKeyDownCommand { get; set; }
|
|
|
public DelegateCommand<object> BtnGOorBackPageCommand { get; set; }
|
|
|
public DelegateCommand<object> LocationCommand { get; set; }
|
|
|
|
|
@@ -428,13 +437,46 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
public LinkAnnotPropertyViewModel()
|
|
|
{
|
|
|
LoadedCommand = new DelegateCommand<object>(Loaded);
|
|
|
- PageNumTextChangedCommand = new DelegateCommand<object>(PageNumTextChanged);
|
|
|
+ PageNumTextLostFocusCommand = new DelegateCommand<object>(PageNumTextLostFocus);
|
|
|
+ PageNumTextKeyDownCommand = new DelegateCommand<object>(PageNumTextKeyDown);
|
|
|
BtnGOorBackPageCommand = new DelegateCommand<object>(BtnGOorBackPageEvent);
|
|
|
LocationCommand = new DelegateCommand<object>(LocationPage);
|
|
|
ToggleButtonTabCommand = new DelegateCommand<object>(ToggleButtonTabSelected);
|
|
|
isLoaded = true;
|
|
|
}
|
|
|
|
|
|
+ private void PageNumTextKeyDown(object obj)
|
|
|
+ {
|
|
|
+ if (obj is KeyEventArgs keyEventArgs)
|
|
|
+ {
|
|
|
+ if (keyEventArgs.Key == Key.Enter)
|
|
|
+ {
|
|
|
+ PageNumTextLostFocus(obj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void PageNumTextLostFocus(object obj)
|
|
|
+ {
|
|
|
+ if (!string.IsNullOrEmpty(PageNumTextContent))
|
|
|
+ {
|
|
|
+ if (CheckPageNumVaild(out int pageNum, PageNumTextContent))
|
|
|
+ {
|
|
|
+ AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
|
|
|
+ AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, pageNum - 1);
|
|
|
+ AnnotAttribEvent?.UpdateAnnot();
|
|
|
+
|
|
|
+ AnnotArgs?.InvokeLinkSaveCalled(this, EventArgs.Empty);
|
|
|
+ //isTextChanged = false;
|
|
|
+ SetImagePreview(AnnotArgs.DestIndex);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ImagePreviewVisibility = Visibility.Collapsed;
|
|
|
+ BtnGOorBackVisibility = Visibility.Collapsed;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void ToggleButtonTabSelected(object obj)
|
|
|
{
|
|
|
if (obj is RadioButton radioButton)
|
|
@@ -518,16 +560,17 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
/// <param name="obj"></param>
|
|
|
private void LocationPage(object obj)
|
|
|
{
|
|
|
- if (!string.IsNullOrEmpty(PageNumTextContent))
|
|
|
+ if (string.IsNullOrEmpty(PageNumTextContent))
|
|
|
{
|
|
|
- if (CheckPageNumVaild(out int pageNum, PageNumTextContent))
|
|
|
- {
|
|
|
- AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
|
|
|
- AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, pageNum - 1);
|
|
|
- AnnotAttribEvent?.UpdateAnnot();
|
|
|
+ //if (CheckPageNumVaild(out int pageNum, PageNumTextContent))
|
|
|
+ //{
|
|
|
+ // AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
|
|
|
+ // AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, pageNum - 1);
|
|
|
+ // AnnotAttribEvent?.UpdateAnnot();
|
|
|
|
|
|
- AnnotArgs?.InvokeLinkSaveCalled(this, EventArgs.Empty);
|
|
|
- }
|
|
|
+ // AnnotArgs?.InvokeLinkSaveCalled(this, EventArgs.Empty);
|
|
|
+ // //isTextChanged = false;
|
|
|
+ //}
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -609,6 +652,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
if (btnGOorBack.Tag.ToString() == "GO")
|
|
|
{
|
|
|
+ //AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkType, LINK_TYPE.GOTO);
|
|
|
+ //AnnotAttribEvent?.UpdateAttrib(AnnotAttrib.LinkDestIndx, pageIndex);
|
|
|
+ //AnnotAttribEvent?.UpdateAnnot();
|
|
|
+
|
|
|
historyPageIndex = AnnotArgs != null ? AnnotArgs.PageIndex : backPageIndex;
|
|
|
pdfViewer.GoToPage(pageIndex);
|
|
|
|
|
@@ -696,7 +743,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
ShowPageNumTip = Visibility.Collapsed;
|
|
|
}
|
|
|
- BtnGOorBackVisibility = Visibility.Visible;
|
|
|
+ //BtnGOorBackVisibility = Visibility.Visible;
|
|
|
|
|
|
return true;
|
|
|
}
|
|
@@ -836,8 +883,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
totalPage = pdfViewer.Document.PageCount;
|
|
|
|
|
|
SetTextBoxEnableOrNot(false, totalPage);
|
|
|
-
|
|
|
- GetAnnotAttribute();
|
|
|
+ if (AnnotAttribEvent.IsAnnotCreateReset == false)
|
|
|
+ {
|
|
|
+ GetAnnotAttribute();
|
|
|
+ }
|
|
|
|
|
|
if (isLoaded)
|
|
|
{
|
|
@@ -944,7 +993,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
PageNumTextIsEnabled = true;
|
|
|
ImagePreviewVisibility = Visibility.Visible;
|
|
|
|
|
|
- //SetImagePreview(pageNum - 1);
|
|
|
+ SetImagePreview(pageNum - 1);
|
|
|
|
|
|
//if (btnGOorBack != null)
|
|
|
//{
|