|
@@ -10,10 +10,49 @@ using System.Windows;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Controls;
|
|
using System.Windows.Data;
|
|
using System.Windows.Data;
|
|
using System.Windows.Input;
|
|
using System.Windows.Input;
|
|
|
|
+using System.Windows.Media.Animation;
|
|
using Compdfkit_Tools.Helper;
|
|
using Compdfkit_Tools.Helper;
|
|
|
|
+using Compdfkit_Tools.PDFControl;
|
|
|
|
+using ComPDFKitViewer;
|
|
|
|
|
|
namespace Compdfkit_Tools.PDFControlUI
|
|
namespace Compdfkit_Tools.PDFControlUI
|
|
{
|
|
{
|
|
|
|
+ public class ShowReplyListCommand : ICommand
|
|
|
|
+ {
|
|
|
|
+ public event EventHandler CanExecuteChanged;
|
|
|
|
+
|
|
|
|
+ public bool CanExecute(object parameter)
|
|
|
|
+ {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void Execute(object parameter)
|
|
|
|
+ {
|
|
|
|
+ if (parameter is CPDFAnnotationListUI.AnnotationBindData data)
|
|
|
|
+ {
|
|
|
|
+ data.IsReplyListVisible = !data.IsReplyListVisible;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public class ShowReplyInputCommand : ICommand
|
|
|
|
+ {
|
|
|
|
+ public event EventHandler CanExecuteChanged;
|
|
|
|
+
|
|
|
|
+ public bool CanExecute(object parameter)
|
|
|
|
+ {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void Execute(object parameter)
|
|
|
|
+ {
|
|
|
|
+ if (parameter is CPDFAnnotationListUI.AnnotationBindData data)
|
|
|
|
+ {
|
|
|
|
+ data.IsReplyInputVisible = !data.IsReplyInputVisible;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public partial class CPDFAnnotationListUI : UserControl
|
|
public partial class CPDFAnnotationListUI : UserControl
|
|
{
|
|
{
|
|
public class ReplyData
|
|
public class ReplyData
|
|
@@ -27,7 +66,27 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
|
|
|
|
public string Date
|
|
public string Date
|
|
{
|
|
{
|
|
- get => ReplyAnnotation.GetCreationDate();
|
|
|
|
|
|
+ get
|
|
|
|
+ {
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ if (Regex.IsMatch(ReplyAnnotation.GetCreationDate(), "(?<=D\\:)[0-9]+(?=[\\+\\-])"))
|
|
|
|
+ {
|
|
|
|
+ string dateStr = Regex.Match(ReplyAnnotation.GetCreationDate(), "(?<=D\\:)[0-9]+(?=[\\+\\-])").Value;
|
|
|
|
+ return (dateStr.Substring(0, 4) + "-" + dateStr.Substring(4, 2) + "-" + dateStr.Substring(6, 2) + ", " + dateStr.Substring(8, 2) + ":" +
|
|
|
|
+ dateStr.Substring(10, 2));
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ return String.Empty;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ catch (Exception)
|
|
|
|
+ {
|
|
|
|
+ return String.Empty;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
set => ReplyAnnotation.SetCreationDate(value);
|
|
set => ReplyAnnotation.SetCreationDate(value);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -40,7 +99,39 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
|
|
|
|
public class BindAnnotationResult : INotifyPropertyChanged
|
|
public class BindAnnotationResult : INotifyPropertyChanged
|
|
{
|
|
{
|
|
- public ObservableCollection<ReplyData> ReplyList { get; set; } = new ObservableCollection<ReplyData>();
|
|
|
|
|
|
+ private ObservableCollection<ReplyData> _replyList = new ObservableCollection<ReplyData>();
|
|
|
|
+
|
|
|
|
+ public ObservableCollection<ReplyData> ReplyList
|
|
|
|
+ {
|
|
|
|
+ get => _replyList;
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ if (_replyList != value)
|
|
|
|
+ {
|
|
|
|
+ if (_replyList != null)
|
|
|
|
+ {
|
|
|
|
+ // Unsubscribe from the previous collection
|
|
|
|
+ _replyList.CollectionChanged -= ReplyList_CollectionChanged;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ _replyList = value;
|
|
|
|
+
|
|
|
|
+ if (_replyList != null)
|
|
|
|
+ {
|
|
|
|
+ // Subscribe to the new collection
|
|
|
|
+ _replyList.CollectionChanged += ReplyList_CollectionChanged;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ OnPropertyChanged(nameof(ReplyList));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void ReplyList_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ // Notify that the ReplyCount has changed when the collection changes
|
|
|
|
+ OnPropertyChanged(nameof(ReplyCount));
|
|
|
|
+ }
|
|
|
|
|
|
public int PageIndex { get; set; }
|
|
public int PageIndex { get; set; }
|
|
|
|
|
|
@@ -51,6 +142,11 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
get => annotationData.Author;
|
|
get => annotationData.Author;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public string ReplyCount
|
|
|
|
+ {
|
|
|
|
+ get => ReplyList.Count.ToString();
|
|
|
|
+ }
|
|
|
|
+
|
|
public string CreateDate
|
|
public string CreateDate
|
|
{
|
|
{
|
|
get
|
|
get
|
|
@@ -79,8 +175,26 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
}
|
|
}
|
|
|
|
|
|
public AnnotParam annotationData { get; set; }
|
|
public AnnotParam annotationData { get; set; }
|
|
|
|
+
|
|
|
|
+ private CPDFAnnotation _annotation;
|
|
|
|
+ public CPDFAnnotation Annotation
|
|
|
|
+ {
|
|
|
|
+ get
|
|
|
|
+ {
|
|
|
|
+ CPDFAnnotation annotCore = pdfViewer?.GetCPDFViewer()?.GetAnnotForIndex(annotationData.PageIndex, annotationData.AnnotIndex)?.GetAnnotData()?.Annot;
|
|
|
|
+ return annotCore;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ public PDFViewControl pdfViewer{get;set;}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ public CPDFAnnotationState ReplyState { get; set; }
|
|
|
|
|
|
- public CPDFAnnotation Annotation { get; set; }
|
|
|
|
|
|
+ public bool IsMarkState { get; set; }
|
|
|
|
+ public BindAnnotationResult()
|
|
|
|
+ {
|
|
|
|
+ ReplyList.CollectionChanged += ReplyList_CollectionChanged;
|
|
|
|
+ }
|
|
|
|
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
public event PropertyChangedEventHandler PropertyChanged;
|
|
protected void OnPropertyChanged(string propertyName)
|
|
protected void OnPropertyChanged(string propertyName)
|
|
@@ -105,6 +219,28 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private bool _isReplyListVisible;
|
|
|
|
+ public bool IsReplyListVisible
|
|
|
|
+ {
|
|
|
|
+ get { return _isReplyListVisible; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ _isReplyListVisible = value;
|
|
|
|
+ OnPropertyChanged(nameof(IsReplyListVisible));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private bool _isReplyInputVisible;
|
|
|
|
+ public bool IsReplyInputVisible
|
|
|
|
+ {
|
|
|
|
+ get { return _isReplyInputVisible; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ _isReplyInputVisible = value;
|
|
|
|
+ OnPropertyChanged(nameof(IsReplyInputVisible));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
public int ShowPageIndex { get { return BindProperty.PageIndex + 1; } set { BindProperty.PageIndex = value; } }
|
|
public int ShowPageIndex { get { return BindProperty.PageIndex + 1; } set { BindProperty.PageIndex = value; } }
|
|
|
|
|
|
@@ -121,6 +257,8 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
public event EventHandler<object> AnnotationSelectionChanged;
|
|
public event EventHandler<object> AnnotationSelectionChanged;
|
|
|
|
|
|
public event EventHandler<Dictionary<int, List<int>>> DeleteItemHandler;
|
|
public event EventHandler<Dictionary<int, List<int>>> DeleteItemHandler;
|
|
|
|
+
|
|
|
|
+ public event EventHandler<CPDFAnnotationState> ReplyStatusChanged;
|
|
|
|
|
|
private ContextMenu popContextMenu;
|
|
private ContextMenu popContextMenu;
|
|
private bool enableSelectEvent = true;
|
|
private bool enableSelectEvent = true;
|
|
@@ -287,6 +425,21 @@ namespace Compdfkit_Tools.PDFControlUI
|
|
{
|
|
{
|
|
CancelSelected();
|
|
CancelSelected();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private void StatusControl_ReplyStatusChanged(object sender, CPDFAnnotationState e)
|
|
|
|
+ {
|
|
|
|
+ ReplyStatusChanged?.Invoke(sender, e);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void ToggleButton_Checked(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ ReplyStatusChanged?.Invoke(sender, CPDFAnnotationState.C_ANNOTATION_MARKED);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void ToggleButton_Unchecked(object sender, RoutedEventArgs e)
|
|
|
|
+ {
|
|
|
|
+ ReplyStatusChanged?.Invoke(sender, CPDFAnnotationState.C_ANNOTATION_UNMARKED);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
public class SubtractionConverter : IValueConverter
|
|
public class SubtractionConverter : IValueConverter
|