|
@@ -1,6 +1,9 @@
|
|
|
-using compdfkit_tools.Common;
|
|
|
+using ComPDFKit.PDFAnnotation.Form;
|
|
|
+using ComPDFKit.PDFAnnotation;
|
|
|
+using compdfkit_tools.Common;
|
|
|
using ComPDFKitViewer;
|
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
|
+using ComPDFKitViewer.PdfViewer;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
@@ -24,7 +27,8 @@ namespace compdfkit_tools.Form.Property
|
|
|
public partial class RadioButtonProperty : UserControl
|
|
|
{
|
|
|
private WidgetRadioButtonArgs widgetArgs = null;
|
|
|
- private AnnotAttribEvent annotAttribEvent = null;
|
|
|
+ private AnnotAttribEvent annotAttribEvent = null;
|
|
|
+ private CPDFViewer pdfViewer;
|
|
|
|
|
|
bool IsLoadedData = false;
|
|
|
public RadioButtonProperty()
|
|
@@ -33,10 +37,11 @@ namespace compdfkit_tools.Form.Property
|
|
|
}
|
|
|
|
|
|
#region Loaded
|
|
|
- public void SetProperty(WidgetArgs Args, AnnotAttribEvent e)
|
|
|
+ public void SetProperty(WidgetArgs Args, AnnotAttribEvent e, CPDFViewer cPDFViewer)
|
|
|
{
|
|
|
widgetArgs = (WidgetRadioButtonArgs)Args;
|
|
|
annotAttribEvent = e;
|
|
|
+ pdfViewer = cPDFViewer;
|
|
|
}
|
|
|
|
|
|
|
|
@@ -48,9 +53,33 @@ namespace compdfkit_tools.Form.Property
|
|
|
BackgroundColorPickerControl.SetCheckedForColor(widgetArgs.BgColor);
|
|
|
RadioButtonStyleCombox.SelectedIndex = (int)widgetArgs.CheckStyle;
|
|
|
chkSelected.IsChecked = widgetArgs.IsChecked;
|
|
|
+
|
|
|
+ if (IsShowWarning())
|
|
|
+ {
|
|
|
+ WarningPanel.Visibility = Visibility.Collapsed;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ WarningPanel.Visibility = Visibility.Visible;
|
|
|
+ }
|
|
|
+
|
|
|
IsLoadedData = true;
|
|
|
}
|
|
|
|
|
|
+ private bool IsShowWarning()
|
|
|
+ {
|
|
|
+ int count = 0;
|
|
|
+ var page = pdfViewer.Document.PageAtIndex(pdfViewer.CurrentIndex);
|
|
|
+ List<CPDFAnnotation> annotList = page.GetAnnotations();
|
|
|
+ if (annotList != null && annotList.Count > 0)
|
|
|
+ {
|
|
|
+ count = annotList.Where(x => x.Type == C_ANNOTATION_TYPE.C_ANNOTATION_WIDGET)
|
|
|
+ .Cast<CPDFWidget>().Where(x => x.WidgeType == C_WIDGET_TYPE.WIDGET_RADIOBUTTON).Count();
|
|
|
+ }
|
|
|
+
|
|
|
+ return count>1;
|
|
|
+ }
|
|
|
+
|
|
|
private void UserControl_Unloaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
IsLoadedData = false;
|