Browse Source

Merge branch 'dev' into practice2

# Conflicts:
#	PDF Office/App.xaml.cs
#	PDF Office/CustomControl/CompositeControl/SlidComboControl.xaml
OYXH\oyxh 2 years ago
parent
commit
5df1fe95c4
74 changed files with 5705 additions and 1604 deletions
  1. 1 0
      PDF Office/App.xaml
  2. 15 4
      PDF Office/App.xaml.cs
  3. BIN
      PDF Office/ComPDFKit.Desk.dll
  4. BIN
      PDF Office/ComPDFKit.Viewer.dll
  5. 3 3
      PDF Office/CustomControl/AlertsMessage.xaml
  6. 8 8
      PDF Office/CustomControl/AlertsMessage.xaml.cs
  7. 97 39
      PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml.cs
  8. 2 0
      PDF Office/CustomControl/CompositeControl/SlidComboControl.xaml
  9. 14 28
      PDF Office/CustomControl/CompositeControl/SlidComboControl.xaml.cs
  10. 10 2
      PDF Office/CustomControl/Form/FormFieldCombox.xaml.cs
  11. 15 0
      PDF Office/CustomControl/ImageButton.cs
  12. 15 5
      PDF Office/CustomControl/NumericUpDown.xaml.cs
  13. 58 0
      PDF Office/CustomControl/PaginationControl.xaml
  14. 108 0
      PDF Office/CustomControl/PaginationControl.xaml.cs
  15. 14 0
      PDF Office/CustomControl/TextBoxEx.cs
  16. 26 0
      PDF Office/EventAggregators/RedactionCommandEvent.cs
  17. 1 1
      PDF Office/Helper/DpiHelpers.cs
  18. 11 0
      PDF Office/Helper/UpdateAttributeHelper.cs
  19. 10 0
      PDF Office/Model/ParameterNames.cs
  20. 56 18
      PDF Office/PDF Office.csproj
  21. 11 0
      PDF Office/Properties/Settings.Designer.cs
  22. 3 0
      PDF Office/Properties/Settings.settings
  23. BIN
      PDF Office/Resources/ToolBarIcon/Scan/batch.png
  24. BIN
      PDF Office/Resources/ToolBarIcon/Scan/enhance.png
  25. BIN
      PDF Office/Resources/ToolBarIcon/Scan/ocr.png
  26. 2 2
      PDF Office/SDKLisence.xml
  27. 14 0
      PDF Office/Styles/ContextMenuStyle.xaml
  28. 1 0
      PDF Office/Styles/ImageButtonStyle.xaml
  29. 23 0
      PDF Office/Styles/SeparatorStyle.xaml
  30. 4 0
      PDF Office/Themes/Generic.xaml
  31. 24 1
      PDF Office/ViewModels/Dialog/Redaction/MarkSettingDialogViewModel.cs
  32. 145 3
      PDF Office/ViewModels/Dialog/Redaction/PageMarkDialogViewModel.cs
  33. 22 1
      PDF Office/ViewModels/Dialog/Redaction/RepeatMarkDialogViewModel.cs
  34. 276 27
      PDF Office/ViewModels/EditTools/Redaction/RedactionContentViewModel.cs
  35. 0 90
      PDF Office/ViewModels/EditTools/Redaction/RedactionDocumentContentViewModel.cs
  36. 277 72
      PDF Office/ViewModels/Form/ButtonPropertyViewModel.cs
  37. 208 70
      PDF Office/ViewModels/Form/CheckBoxPropertyViewModel.cs
  38. 456 69
      PDF Office/ViewModels/Form/ComboxPropertyViewModel.cs
  39. 357 91
      PDF Office/ViewModels/Form/FormBaseVM.cs
  40. 1 0
      PDF Office/ViewModels/Form/FormsToolContentViewModel.cs
  41. 447 93
      PDF Office/ViewModels/Form/ListBoxPropertyViewModel.cs
  42. 211 68
      PDF Office/ViewModels/Form/RadioButtonPropertyViewModel.cs
  43. 212 49
      PDF Office/ViewModels/Form/SignPropertyViewModel.cs
  44. 146 426
      PDF Office/ViewModels/Form/TextFieldPropertyViewModel.cs
  45. 1 1
      PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs
  46. 62 0
      PDF Office/ViewModels/PropertyPanel/Scan/ScanPropertyPanelViewModel.cs
  47. 15 3
      PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs
  48. 203 2
      PDF Office/ViewModels/Tools/ScanContentViewModel.cs
  49. 19 0
      PDF Office/ViewModels/ViewContentViewModel.cs
  50. 22 3
      PDF Office/Views/Dialog/Redaction/PageMarkDialog.xaml
  51. 8 0
      PDF Office/Views/Dialog/Redaction/PageMarkDialog.xaml.cs
  52. 3 2
      PDF Office/Views/Dialog/Redaction/RepeatMarkDialog.xaml
  53. 9 2
      PDF Office/Views/EditTools/Redaction/RedactionContent.xaml
  54. 0 21
      PDF Office/Views/EditTools/Redaction/RedactionDocumentContent.xaml
  55. 0 15
      PDF Office/Views/EditTools/Redaction/RedactionDocumentContent.xaml.cs
  56. 410 2
      PDF Office/Views/Form/ButtonProperty.xaml
  57. 76 1
      PDF Office/Views/Form/ButtonProperty.xaml.cs
  58. 16 139
      PDF Office/Views/Form/CheckBoxProperty.xaml
  59. 46 0
      PDF Office/Views/Form/CheckBoxProperty.xaml.cs
  60. 434 2
      PDF Office/Views/Form/ComboxProperty.xaml
  61. 76 1
      PDF Office/Views/Form/ComboxProperty.xaml.cs
  62. 66 119
      PDF Office/Views/Form/ListBoxProperty.xaml
  63. 46 0
      PDF Office/Views/Form/ListBoxProperty.xaml.cs
  64. 317 2
      PDF Office/Views/Form/RadioButtonProperty.xaml
  65. 76 1
      PDF Office/Views/Form/RadioButtonProperty.xaml.cs
  66. 289 2
      PDF Office/Views/Form/SignProperty.xaml
  67. 75 1
      PDF Office/Views/Form/SignProperty.xaml.cs
  68. 36 110
      PDF Office/Views/Form/TextFieldProperty.xaml
  69. 5 0
      PDF Office/Views/MainContent.xaml.cs
  70. 35 0
      PDF Office/Views/PropertyPanel/Scan/ScanPropertyPanel.xaml
  71. 28 0
      PDF Office/Views/PropertyPanel/Scan/ScanPropertyPanel.xaml.cs
  72. 25 4
      PDF Office/Views/Tools/ScanContent.xaml
  73. 3 1
      PDF Office/Views/ViewContent.xaml
  74. BIN
      PDF Office/x64/ComPDFKit.dll

+ 1 - 0
PDF Office/App.xaml

@@ -12,6 +12,7 @@
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Themes/Alias_Light.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Themes/Global.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/TabControlStyle.xaml" />
+                <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/SeparatorStyle.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/ButtonStyle.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/ToggleButton.xaml" />
                 <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/TextBoxStyle.xaml" />

+ 15 - 4
PDF Office/App.xaml.cs

@@ -52,6 +52,7 @@ using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomeP
 using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageWatermark;
 using PDF_Office.Views.Dialog.HomePageToolsDialogs.HomePageBatchProcessing.HomePageBackground;
 using ComDocumentAIKit;
+using PDF_Office.Views.PropertyPanel.Scan;
 using PDF_Office.Views.Dialog.Redaction;
 using ComPDFKitViewer.PdfViewer;
 using ComPDFKitViewer;
@@ -80,9 +81,10 @@ namespace PDF_Office
         public static CacheFilePath CachePath;
 
         /// <summary>
-        /// OCR引擎对象
+        /// OCR数据模型所在目录
         /// </summary>
         public static COCREngine ocrEngine = null;
+        public static string modelFolderPath = null;
 
         public static bool IsFirstOpen = true;
         public static bool IsBookMode = false;
@@ -103,6 +105,9 @@ namespace PDF_Office
             if (Settings.Default.RecentOpenFiles == null)
                 Settings.Default.RecentOpenFiles = new RecentOpenFiles();
 
+            if (Settings.Default.RedactionsSettings == null)
+                Settings.Default.RedactionsSettings = new PDFSettings.RedactionSettings();
+
             if (Settings.Default.AppProperties == null)
                 Settings.Default.AppProperties = new PDFSettings.APPSettingProperties();
 
@@ -243,6 +248,7 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<TextAnnotProperty>();
             containerRegistry.RegisterForNavigation<ImageEditProperty>();
             containerRegistry.RegisterForNavigation<TextEditProperty>();
+            containerRegistry.RegisterForNavigation<ScanPropertyPanel>();
             containerRegistry.RegisterForNavigation<BatesContent>();
             containerRegistry.RegisterForNavigation<BatesTemplateListContent>();
             containerRegistry.RegisterForNavigation<BatesCreateContent>();
@@ -252,7 +258,6 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<HeaderFooterCreateContent>();
             containerRegistry.RegisterForNavigation<HeaderFooterDocumentContent>();
             containerRegistry.RegisterForNavigation<RedactionContent>();
-            containerRegistry.RegisterForNavigation<RedactionDocumentContent>();
             //填写与签名
             containerRegistry.RegisterForNavigation<FillAndSignContent>();
             containerRegistry.RegisterForNavigation<DateFillProperty>();
@@ -265,6 +270,7 @@ namespace PDF_Office
             containerRegistry.RegisterForNavigation<ButtonProperty>();
             containerRegistry.RegisterForNavigation<CheckBoxProperty>();
             containerRegistry.RegisterForNavigation<ListBoxProperty>();
+            containerRegistry.RegisterForNavigation<ComboxProperty>();
             containerRegistry.RegisterForNavigation<RadioButtonProperty>();
             containerRegistry.RegisterForNavigation<SignProperty>();
 
@@ -366,6 +372,11 @@ namespace PDF_Office
 
             try
             {
+                //加载OCR库
+                if (!DocumentAIKitLicenseVerify())
+                {
+
+                }
                 /*LicenseError licenseerror = CPDFConverter.SDKLicenseVerify(ConverterDevKey, ConverterDevSecret, ConverterUserkey, ConverterUserSecret);
                 string resPath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location) + "\\";
                 if (licenseerror != LicenseError.ERR_SUCCESS)
@@ -400,8 +411,9 @@ namespace PDF_Office
             Task.Factory.StartNew(() =>
             {
                 string exePath = Path.GetDirectoryName(typeof(MainWindow).Assembly.Location);
+                exePath = Path.Combine(exePath, "x64");
                 string libFolderPath = Path.Combine(exePath, "DocumentAILib");
-                string modelFolderPath = Path.Combine(exePath, "models");
+                modelFolderPath = Path.Combine(exePath, "models");
 
                 if (CDocumentAIKit.LoadNativeLibrary(libFolderPath) == false)
                     return;
@@ -410,7 +422,6 @@ namespace PDF_Office
                 if (error != CErrorCode.E_DA_SUCCESS)
                     return;
 
-                ocrEngine = new COCREngine(modelFolderPath);
             });
             return true;
         }

BIN
PDF Office/ComPDFKit.Desk.dll


BIN
PDF Office/ComPDFKit.Viewer.dll


+ 3 - 3
PDF Office/CustomControl/AlertsMessage.xaml

@@ -18,9 +18,9 @@
     <Border
         Height="auto"
         Background="White"
+        BorderBrush="Gray"
         BorderThickness="1"
         CornerRadius="6"
-        BorderBrush="Gray"
         MouseLeftButtonDown="Border_PreviewMouseLeftButtonDown">
         <Grid Margin="20,24,20,0">
             <Grid.RowDefinitions>
@@ -60,7 +60,7 @@
                 </Grid.ColumnDefinitions>
                 <Button
                     x:Name="CancelBtn"
-                    Grid.Column="0"
+                    Grid.Column="2"
                     Height="28"
                     Margin="0,0,0,0"
                     BorderThickness="0"
@@ -80,7 +80,7 @@
                     FontWeight="SemiBold" />
                 <Button
                     x:Name="OkBtn"
-                    Grid.Column="2"
+                    Grid.Column="0"
                     Height="28"
                     Margin="8,0,0,0"
                     BorderThickness="0"

+ 8 - 8
PDF Office/CustomControl/AlertsMessage.xaml.cs

@@ -77,8 +77,8 @@ namespace PDF_Office.CustomControl
             OkBtn.Content = okBtn;
             Width = 408;
 
-            Grid.SetColumn(MiddleCancelBtn, 0);
-            Grid.SetColumn(OkBtn, 1);
+            Grid.SetColumn(MiddleCancelBtn, 1);
+            Grid.SetColumn(OkBtn, 0);
 
             BtnGrid.ColumnDefinitions.Clear();
             var column = new ColumnDefinition();
@@ -103,9 +103,9 @@ namespace PDF_Office.CustomControl
             MiddleCancelBtn.Content = cancelBtn2;
             OkBtn.Content = okBtn;
 
-            Grid.SetColumn(CancelBtn, 0);
+            Grid.SetColumn(CancelBtn, 2);
             Grid.SetColumn(MiddleCancelBtn, 1);
-            Grid.SetColumn(OkBtn, 2);
+            Grid.SetColumn(OkBtn, 0);
 
             BtnGrid.ColumnDefinitions.Clear();
             var column = new ColumnDefinition();
@@ -161,8 +161,8 @@ namespace PDF_Office.CustomControl
             OkBtn.Content = okBtn;
             Width = 408;
 
-            Grid.SetColumn(MiddleCancelBtn, 0);
-            Grid.SetColumn(OkBtn, 1);
+            Grid.SetColumn(MiddleCancelBtn, 1);
+            Grid.SetColumn(OkBtn, 0);
 
             BtnGrid.ColumnDefinitions.Clear();
             var column = new ColumnDefinition();
@@ -191,9 +191,9 @@ namespace PDF_Office.CustomControl
             MiddleCancelBtn.Content = cancelBtn2;
             OkBtn.Content = okBtn;
 
-            Grid.SetColumn(CancelBtn, 0);
+            Grid.SetColumn(CancelBtn, 2);
             Grid.SetColumn(MiddleCancelBtn, 1);
-            Grid.SetColumn(OkBtn, 2);
+            Grid.SetColumn(OkBtn, 0);
 
             BtnGrid.ColumnDefinitions.Clear();
             var column = new ColumnDefinition();

+ 97 - 39
PDF Office/CustomControl/CompositeControl/CustomComboControl.xaml.cs

@@ -24,15 +24,21 @@ namespace PDF_Office.CustomControl.CompositeControl
 
     public class ComboDataItem
     {
+        //字符串类型的值
         public string ValueStr { get; private set; }
+        //数字类型的值
         public double Value { get; private set; }
+        //下拉框显示的内容
         public string Content { get; private set; }
+        //下拉框显示的内容+单位:限数字值的单位
         public string Unit { get; private set; }
+        //数字类型
         public ComboDataItem(double value, string unitStr = "")
         {
             Content = value + unitStr;
             Value = value;
         }
+        //字符串类型
         public ComboDataItem(string valueStr, string contentStr = "")
         {
             Content = contentStr;
@@ -54,13 +60,18 @@ namespace PDF_Office.CustomControl.CompositeControl
             Items = new List<ComboDataItem>();
             DefaultItems();
         }
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            comBox.SelectionChanged -= comBox_SelectionChanged;
+            comBox.SelectionChanged += comBox_SelectionChanged;
+        }
+
         //更换集合
         public void SetItemSource(List<ComboDataItem> items)
         {
             SelectedIndex = - 1;//为了触发SelectedIndex
             Items = items;
-            comBox.ItemsSource = Items;
-            SelectedIndex = ((Items == null || Items.Count == 0) ? -1 : 0);
+            ItemSource = Items;
         }
 
         /// <summary>
@@ -87,29 +98,30 @@ namespace PDF_Office.CustomControl.CompositeControl
             Items.Add(item);
             item = new ComboDataItem(24);
             Items.Add(item);
-
-            comBox.ItemsSource = Items;
-            SelectedIndex = ((Items == null || Items.Count == 0) ? -1 : 0);
-        }
-        private void UserControl_Loaded(object sender, RoutedEventArgs e)
-        {
-            comBox.SelectionChanged -= comBox_SelectionChanged;
-            comBox.SelectionChanged += comBox_SelectionChanged;
+            ItemSource = Items;
         }
-
+ 
+        //下拉框选中项
         private void comBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             var item = comBox.SelectedItem as ComboDataItem;
             if (item != null)
             {
-                Value = item.Value;
-                ValueStr = item.ValueStr;
                 title.Text = item.Content;
+                SelectedIndex = comBox.SelectedIndex;
 
                 if (IsValueContent == false)
-                    ValueChanged?.Invoke(Value, e);
+                {
+                    Value = item.Value;
+                    ValueChanged?.Invoke(Value, null);
+                }
+                    
                 else
-                    ValueChanged?.Invoke(ValueStr, e);
+                {
+                    ValueStr = item.ValueStr;
+                    ValueChanged?.Invoke(ValueStr, null);
+                }
+
             }
 
 
@@ -127,6 +139,7 @@ namespace PDF_Office.CustomControl.CompositeControl
             set { SetValue(ValueStrProperty, value); }
         }
 
+        //下拉框每项的值是否为字符串类型
         public bool IsValueContent
         {
             get { return (bool)GetValue(IsValueContentProperty); }
@@ -145,11 +158,21 @@ namespace PDF_Office.CustomControl.CompositeControl
             set { SetValue(SelectedIndexProperty, value); }
         }
 
+        public ComboDataItem SelectedItems
+        {
+            get { return (ComboDataItem)GetValue(SelectedItemsProperty); }
+            set { SetValue(SelectedItemsProperty, value); }
+        }
+
+        public static readonly DependencyProperty SelectedItemsProperty =
+         DependencyProperty.Register("SelectedItems", typeof(ComboDataItem), typeof(CustomComboControl), new PropertyMetadata(null, SelectedItemsPropertyChanged));
+
+
         public static readonly DependencyProperty ValueProperty =
-           DependencyProperty.Register("Value", typeof(double), typeof(CustomComboControl), new PropertyMetadata(1.0, SelectedValuePropertyChanged));
+           DependencyProperty.Register("Value", typeof(double), typeof(CustomComboControl), new PropertyMetadata(1.0));
 
         public static readonly DependencyProperty ValueStrProperty =
-         DependencyProperty.Register("ValueStr", typeof(string), typeof(CustomComboControl), new PropertyMetadata("", SelectedValueStrPropertyChanged));
+         DependencyProperty.Register("ValueStr", typeof(string), typeof(CustomComboControl), new PropertyMetadata(""));
 
         public static readonly DependencyProperty ItemSourceProperty =
           DependencyProperty.Register("ItemSource", typeof(List<ComboDataItem>), typeof(CustomComboControl), new PropertyMetadata(null, SelectedItemSourcePropertyChanged));
@@ -160,53 +183,88 @@ namespace PDF_Office.CustomControl.CompositeControl
         public static readonly DependencyProperty IsValueContentProperty =
           DependencyProperty.Register("IsValueContent", typeof(bool), typeof(CustomComboControl), new PropertyMetadata(false));
 
-        private static void SelectedValuePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        //集合绑定下拉框 SelectedItems触发属性
+        private static void SelectedItemsPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
             var control = d as CustomComboControl;
-            var value = (double)e.NewValue;
-            if (control != null && control.IsValueContent == false)
+            var selectedItems = (ComboDataItem)e.NewValue;
+            if (control != null & selectedItems != null)
             {
-                control.ValueChanged?.Invoke(value, null);
-            }
-        }
+                if(control.comBox.Items != null && control.comBox.Items.Count > 0)
+                {
+                    if(control.IsValueContent)
+                    {
+                        control.ValueStr = selectedItems.ValueStr;
+                    }
+                    else
+                    {
+                        control.Value = selectedItems.Value;
+                    }
+                }
+
+                if(control.comBox.Items == null || control.comBox.Items.Count == 0)
+                {
+                    control.title.Text = selectedItems.Content;
+                }
+                else
+                {
+                    int index = -1;
+                    ComboDataItem temp;
+                    if (control.IsValueContent)
+                        temp = control.Items.FirstOrDefault(inlineItem => inlineItem.ValueStr == selectedItems.ValueStr);
+                   else
+                        temp = control.Items.FirstOrDefault(inlineItem => inlineItem.Value == selectedItems.Value);
+
+                    if (temp != null)
+                        index = control.Items.IndexOf(temp);
+
+
+                    if (index >= 0)
+                    {
+                        control.SelectedIndex = -1;
+                        control.SelectedIndex = index;
+                    }
+                    else
+                        control.title.Text = selectedItems.Content;
+
+                }
 
-        private static void SelectedValueStrPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
-        {
-            var control = d as CustomComboControl;
-            var value = (string)e.NewValue;
-            if (control != null && control.IsValueContent)
-            {
-                control.ValueChanged?.Invoke(value, null);
             }
         }
-       
+
+        //集合绑定下拉框Itemsource触发属性
         private static void SelectedItemSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
             var control = d as CustomComboControl;
-            var value = (List<ComboDataItem>)e.NewValue;
+            var itemsource = (List<ComboDataItem>)e.NewValue;
             if (control != null)
             {
                 control.SelectedIndex = -1;
-                control.comBox.ItemsSource = value;
-                control.Items = value;
-                control.SelectedIndex = ((value == null || value.Count == 0) ? -1 : 0);
+                control.comBox.ItemsSource = itemsource;
+                control.Items = itemsource;
+                control.SelectedIndex = ((itemsource == null || itemsource.Count == 0) ? -1 : 0);
             }
         }
 
+        //选中项触发属性
         private static void SelectedIndexPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
         {
             var control = d as CustomComboControl;
-            var value = (int)e.NewValue;
+            var selectedIndex = (int)e.NewValue;
             if (control != null)
             {
-                if(control.comBox.Items != null && control.comBox.Items.Count > 0)
+                if(control.comBox.Items != null && control.comBox.Items.Count > 0 && selectedIndex != -1)
                 {
-                    control.comBox.SelectedIndex = value;
+                    control.comBox.SelectedIndex = selectedIndex;
+                    if (control.comBox.SelectedItem != null)
+                        control.SelectedItems = (ComboDataItem)control.comBox.SelectedItem;
+                    else
+                        control.SelectedItems = null;
                 }
                 control.UpdateSelectedIndex();
             }
         }
-
+        //选中项后,更新控件选中的显示内容
         public void UpdateSelectedIndex()
         {
             if(SelectedIndex < 0  || comBox.Items == null || comBox.Items.Count <= SelectedIndex)

+ 2 - 0
PDF Office/CustomControl/CompositeControl/SlidComboControl.xaml

@@ -102,6 +102,8 @@
                         TextAlignment="Left" />
                 </Grid>
             </Border>
+            <local:CustomComboControl x:Name="combox" Grid.Column="1" Width="80" Height="32"  />
+   
         </Grid>
     </Grid>
 

+ 14 - 28
PDF Office/CustomControl/CompositeControl/SlidComboControl.xaml.cs

@@ -36,7 +36,7 @@ namespace PDF_Office.CustomControl.CompositeControl
         public void SetItemSource(List<ComboDataItem> items)
         {
             Items = items;
-            ThicknessBox.ItemsSource = Items;
+            combox.ItemSource = Items;
         }
 
         private void DefaultItems()
@@ -58,48 +58,31 @@ namespace PDF_Office.CustomControl.CompositeControl
             item = new ComboDataItem(24);
             Items.Add(item);
 
-            ThicknessBox.ItemsSource = Items;
+            combox.ItemSource = Items;
         }
 
         private void UserControl_Loaded(object sender, RoutedEventArgs e)
         {
-            ThicknessBox.SelectionChanged -= ThicknessBox_SelectionChanged;
-            ThicknessBox.SelectionChanged += ThicknessBox_SelectionChanged;
             ThicknessSlider.ValueChanged += ThicknessSlider_ValueChanged;
-            ThicknessBox.SelectedIndex = 0;
+            combox.ValueChanged -= combox_ValueChanged;
+            combox.ValueChanged += combox_ValueChanged;
         }
 
-        private void ThicknessSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
+        private void combox_ValueChanged(object sender, RoutedEventArgs e)
         {
-            foreach(var item in ThicknessBox.Items)
+            if (sender is double == true)
             {
-
-                var itemData = item as ComboDataItem;
-                if(itemData != null)
-                {
-                    if(itemData.Value == Value)
-                    {
-                        ThicknessBox.SelectedItem = itemData;
-                        break;
-                    }
-                }
+                if ((double)sender != Value)
+                    Value = (double)sender;
             }
-            ThicknessText.Text = Value.ToString();
         }
 
-        private void ThicknessBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+        private void ThicknessSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
         {
-            var item = ThicknessBox.SelectedItem as ComboDataItem;
-            if(item != null)
-            {
-                Value = item.Value;
-                ThicknessText.Text = item.Content;
-                ValueChanged?.Invoke(Value, e);
-            }
-           
-
+            combox.SelectedItems = new ComboDataItem(Value);
         }
 
+
         public double Value
         {
             get { return (double)GetValue(ValueProperty); }
@@ -114,7 +97,10 @@ namespace PDF_Office.CustomControl.CompositeControl
             var value = (double)e.NewValue;
             if (control != null)
             {
+
+                control.combox.SelectedItems = new ComboDataItem(value);
                 control.ValueChanged?.Invoke(value, null);
+
             }
         }
 

+ 10 - 2
PDF Office/CustomControl/Form/FormFieldCombox.xaml.cs

@@ -38,9 +38,17 @@ namespace PDF_Office.CustomControl.Form
 
         // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty TypeProperty =
-            DependencyProperty.Register("Type", typeof(FormFieldType), typeof(FormFieldCombox), new PropertyMetadata(FormFieldType.visible));
-
+            DependencyProperty.Register("Type", typeof(FormFieldType), typeof(FormFieldCombox), new PropertyMetadata(FormFieldType.visible, FormFieldTypePropertyChanged));
 
+        private static void FormFieldTypePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        {
+            var control = d as FormFieldCombox;
+            var type = (FormFieldType)e.NewValue;
+            if (control != null)
+            {
+                control.Combox.SelectedIndex = (int)type;
+            }
+        }
 
         public FormFieldType SetType
         {

+ 15 - 0
PDF Office/CustomControl/ImageButton.cs

@@ -74,6 +74,12 @@ namespace PDF_Office.CustomControl
         public static readonly DependencyProperty MouseOverBackgroundProperty
             = DependencyProperty.Register("MouseOverBackground", typeof(Brush), typeof(ImageButton));
 
+        /// <summary>
+        /// 鼠标移上去的背景颜色的透明度
+        /// </summary>
+        public static readonly DependencyProperty MouseOverBackgroundOpacityProperty
+            = DependencyProperty.Register("MouseOverBackgroundOpacity", typeof(double), typeof(ImageButton), new PropertyMetadata(1.0, null));
+
         /// <summary>  
         /// 鼠标按下去的背景颜色  
         /// </summary>  
@@ -151,6 +157,15 @@ namespace PDF_Office.CustomControl
             set { SetValue(MouseOverBackgroundProperty, value); }
         }
 
+        public double MouseOverBackgroundOpacity
+        {
+            get
+            {
+                return (double)GetValue(MouseOverBackgroundOpacityProperty);
+            }
+            set { SetValue(MouseOverBackgroundOpacityProperty, value); }
+        }
+
         public Brush MouseDownBackground
         {
             get

+ 15 - 5
PDF Office/CustomControl/NumericUpDown.xaml.cs

@@ -41,6 +41,7 @@ namespace PDF_Office.CustomControl
             get { return (double)GetValue(ValueProperty); }
             set
             {
+                SetValue(ValueProperty, value);
                 if (value > Maximum)
                 {
                     SetValue(ValueProperty, Maximum);
@@ -58,9 +59,17 @@ namespace PDF_Office.CustomControl
         }
 
         public static readonly DependencyProperty ValueProperty =
-            DependencyProperty.Register("Value", typeof(double), typeof(NumericUpDown), new PropertyMetadata(0.0));
-
+            DependencyProperty.Register("Value", typeof(double), typeof(NumericUpDown), new PropertyMetadata(0.0, SelectedItemSourcePropertyChanged));
 
+        private static void SelectedItemSourcePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+        {
+            var control = d as NumericUpDown;
+            var value = (double)e.NewValue;
+            if (control != null)
+            {
+                control.TextBox_Num.Text = Convert.ToString(value);
+            }
+        }
         /// <summary>
         /// 最大值
         /// </summary>
@@ -167,13 +176,14 @@ namespace PDF_Office.CustomControl
 
         private void TextBox_Num_TextChanged(object sender, TextChangedEventArgs e)
         {
-            int num = 0;
-            if (this.TextBox_Num.Text == "" || !int.TryParse(this.TextBox_Num.Text,out num))
+            //int.TryParse("30.0000610351563"),字符串有小数点,会转换失败
+            double num = 0;
+            if (this.TextBox_Num.Text == "" || !double.TryParse(this.TextBox_Num.Text,out num))
             {
                 this.TextBox_Num.Text = Minimum.ToString();
             }
             Text = this.TextBox_Num.Text;
-            Value = int.Parse(this.TextBox_Num.Text);
+            Value = (int)double.Parse(this.TextBox_Num.Text);
         }
 
         private void CountTextBox_PreviewTextInput(object sender, TextCompositionEventArgs e)

+ 58 - 0
PDF Office/CustomControl/PaginationControl.xaml

@@ -0,0 +1,58 @@
+<UserControl
+    x:Class="PDF_Office.CustomControl.PaginationControl"
+    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
+    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:local="clr-namespace:PDF_Office.CustomControl"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    Height="36"
+    d:DesignHeight="450"
+    Foreground="{StaticResource color.sys.text.anti.norm}"
+    mc:Ignorable="d">
+    <Border Background="{StaticResource color.sys.layout.dark.bg}" CornerRadius="{StaticResource radius.base.m}">
+        <Grid
+            Margin="16,6"
+            HorizontalAlignment="Stretch"
+            Background="Transparent">
+            <Grid.ColumnDefinitions>
+                <ColumnDefinition Width="auto" />
+                <ColumnDefinition Width="auto" />
+                <ColumnDefinition Width="auto" />
+            </Grid.ColumnDefinitions>
+            <Grid>
+                <cus:TextBoxEx
+                    x:Name="TxtInput"
+                    Width="50"
+                    Height="24"
+                    CornerRadius="4"
+                    Foreground="{StaticResource color.field.text.act}"
+                    InputMethod.IsInputMethodEnabled="False"
+                    LostFocus="TxtInput_LostFocus"
+                    PreviewKeyDown="TxtInput_PreviewKeyDown"
+                    ShowClose="False"
+                    Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:PaginationControl}, Path=InputString, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                    Visibility="Collapsed" />
+                <TextBlock
+                    Name="TblIndex"
+                    MinWidth="15"
+                    VerticalAlignment="Center"
+                    PreviewMouseDown="TblIndex_PreviewMouseDown"
+                    Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:PaginationControl}, Path=CurrentPage, StringFormat={}{0}}"
+                    TextAlignment="Center" />
+            </Grid>
+            <TextBlock
+                Grid.Column="1"
+                Margin="8,0"
+                VerticalAlignment="Center"
+                FontSize="12"
+                Text="/" />
+            <TextBlock
+                Name="TBPageCount"
+                Grid.Column="2"
+                VerticalAlignment="Center"
+                FocusVisualStyle="{x:Null}"
+                Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:PaginationControl}, Path=PageCount, StringFormat={}{0}}" />
+        </Grid>
+    </Border>
+</UserControl>

+ 108 - 0
PDF Office/CustomControl/PaginationControl.xaml.cs

@@ -0,0 +1,108 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.CustomControl
+{
+    /// <summary>
+    /// PaginationControl.xaml 的交互逻辑
+    /// </summary>
+    public partial class PaginationControl : UserControl
+    {
+        public PaginationControl()
+        {
+            InitializeComponent();
+        }
+
+
+        public int CurrentPage
+        {
+            get { return (int)GetValue(CurrentPageProperty); }
+            set { SetValue(CurrentPageProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for CurrentPage.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty CurrentPageProperty =
+            DependencyProperty.Register("CurrentPage", typeof(int), typeof(PaginationControl), new PropertyMetadata(0));
+
+
+
+
+        public int PageCount
+        {
+            get { return (int)GetValue(PageCountProperty); }
+            set { SetValue(PageCountProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for PageCount.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty PageCountProperty =
+            DependencyProperty.Register("PageCount", typeof(int), typeof(PaginationControl), new PropertyMetadata(0));
+
+
+
+        public string InputString
+        {
+            get { return (string)GetValue(InputStringProperty); }
+            set { SetValue(InputStringProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for InputString.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty InputStringProperty =
+            DependencyProperty.Register("InputString", typeof(string), typeof(PaginationControl), new PropertyMetadata(""));
+
+
+        private void CheckInput()
+        {
+            int page = CurrentPage;
+            bool result = int.TryParse(InputString,out page);
+            if(result&&(page <= PageCount)&&page>=1)
+            {
+                CurrentPage = page;
+            }
+            else
+            {
+                InputString = CurrentPage.ToString();
+            }
+        }
+
+        private async void TblIndex_PreviewMouseDown(object sender, MouseButtonEventArgs e)
+        {
+            if(e.ClickCount==2)
+            {
+                TblIndex.Visibility = Visibility.Collapsed;
+                TxtInput.Visibility = Visibility.Visible;
+                await Task.Delay(20);
+                TxtInput.SelectAll();
+                TxtInput.Focus();
+                InputString = CurrentPage.ToString();
+            }
+        }
+
+        private void TxtInput_LostFocus(object sender, RoutedEventArgs e)
+        {
+            CheckInput();
+            TblIndex.Visibility = Visibility.Visible;
+            TxtInput.Visibility = Visibility.Collapsed;
+
+        }
+
+        private void TxtInput_PreviewKeyDown(object sender, KeyEventArgs e)
+        {
+            if (e.Key == Key.Enter)
+            {
+                CheckInput();
+            }
+        }
+    }
+}

+ 14 - 0
PDF Office/CustomControl/TextBoxEx.cs

@@ -125,5 +125,19 @@ namespace PDF_Office.CustomControl
         // Using a DependencyProperty as the backing store for TipText.  This enables animation, styling, binding, etc...
         public static readonly DependencyProperty TipTextProperty =
             DependencyProperty.Register("TipText", typeof(string), typeof(TextBoxEx), new PropertyMetadata(""));
+
+
+
+        public bool ShowClose
+        {
+            get { return (bool)GetValue(ShowCloseProperty); }
+            set { SetValue(ShowCloseProperty, value); }
+        }
+
+        // Using a DependencyProperty as the backing store for ShowClose.  This enables animation, styling, binding, etc...
+        public static readonly DependencyProperty ShowCloseProperty =
+            DependencyProperty.Register("ShowClose", typeof(bool), typeof(TextBoxEx), new PropertyMetadata(true));
+
+
     }
 }

+ 26 - 0
PDF Office/EventAggregators/RedactionCommandEvent.cs

@@ -0,0 +1,26 @@
+using ComPDFKitViewer.AnnotEvent;
+using Prism.Events;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.EventAggregators
+{
+    public class RedactionCommandEventArgs
+    {
+        public string UniCode { get; set; }
+
+        public object Sender { get; set; }
+
+        public AnnotCommandArgs args { get; set; }
+    }
+
+    /// <summary>
+    /// 绑定标记密文右键菜单的事件
+    /// </summary>
+    public class RedactionCommandEvent: PubSubEvent<RedactionCommandEventArgs>
+    {
+    }
+}

+ 1 - 1
PDF Office/Helper/DpiHelpers.cs

@@ -87,7 +87,7 @@ namespace PDF_Office.Helper
         {
             Rect standRect = new Rect(GetDpiUnrelatedNum(oldValue.Left), GetDpiUnrelatedNum(oldValue.Top),
                 GetDpiUnrelatedNum(oldValue.Width), GetDpiUnrelatedNum(oldValue.Height));
-            return new Rect(standRect.Left * 72D / 96D, standRect.Top * 72D / 96D, standRect.Width * 72D / 96D, standRect.Height * 72D / 96D);
+            return new Rect((int)(standRect.Left * 72D / 96D), (int)(standRect.Top * 72D / 96D), (int)(standRect.Width * 72D / 96D), (int)(standRect.Height * 72D / 96D));
         }
 
         /// <summary>

+ 11 - 0
PDF Office/Helper/UpdateAttributeHelper.cs

@@ -25,6 +25,17 @@ namespace PDF_Office.Helper
             annotEditEvent = Event;
         }
 
+        public bool IsCreateForm()
+        {
+            if (annotEditEvent != null)
+            {
+                if(annotEditEvent.EditAction == ActionType.Add)
+                    return true;
+            }
+
+            return false;
+        }
+
         public void UpdateAttrib(AnnotAttrib attrib, object updateData)
         {
             if (annotAttribEvent != null)

+ 10 - 0
PDF Office/Model/ParameterNames.cs

@@ -45,6 +45,16 @@ namespace PDF_Office.Model
         /// </summary>
         public static string PageList = "PageList";
 
+        /// <summary>
+        /// 页面总数
+        /// </summary>
+        public static string PageCount = "PageCount";
+
+        /// <summary>
+        /// 当前页
+        /// </summary>
+        public static string CurrentPageIndex = "CurrentPageIndex";
+
         /// <summary>
         /// 书签
         /// </summary>

+ 56 - 18
PDF Office/PDF Office.csproj

@@ -260,6 +260,9 @@
     <Compile Include="CustomControl\PageTurningPreview.xaml.cs">
       <DependentUpon>PageTurningPreview.xaml</DependentUpon>
     </Compile>
+    <Compile Include="CustomControl\PaginationControl.xaml.cs">
+      <DependentUpon>PaginationControl.xaml</DependentUpon>
+    </Compile>
     <Compile Include="CustomControl\PathButton.cs" />
     <Compile Include="CustomControl\PathRadioButton.cs" />
     <Compile Include="CustomControl\SystemControl\CustomCommandAction .cs" />
@@ -297,6 +300,7 @@
     <Compile Include="EventAggregators\EditToolsEvent.cs" />
     <Compile Include="EventAggregators\PageEditNotifyEvent.cs" />
     <Compile Include="EventAggregators\PageEditRefreshEvent.cs" />
+    <Compile Include="EventAggregators\RedactionCommandEvent.cs" />
     <Compile Include="EventAggregators\SendPrintInfoEvent.cs" />
     <Compile Include="EventAggregators\SplitEvent.cs" />
     <Compile Include="Helper\CacheFilePath.cs" />
@@ -439,7 +443,6 @@
     <Compile Include="ViewModels\EditTools\HeaderFooter\HeaderFooterDocumentContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\HeaderFooter\HeaderFooterTemplateListContentViewModel.cs" />
     <Compile Include="ViewModels\EditTools\Redaction\RedactionContentViewModel.cs" />
-    <Compile Include="ViewModels\EditTools\Redaction\RedactionDocumentContentViewModel.cs" />
     <Compile Include="ViewModels\Form\ButtonPropertyViewModel.cs" />
     <Compile Include="ViewModels\Form\CheckBoxPropertyViewModel.cs" />
     <Compile Include="ViewModels\Form\ComboxPropertyViewModel.cs" />
@@ -476,6 +479,7 @@
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\SignatureCreateDialogViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\ImageEditPropertyViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\PDFEdit\TextEditPropertyViewModel.cs" />
+    <Compile Include="ViewModels\PropertyPanel\Scan\ScanPropertyPanelViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\ViewModular\ReadViewContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\RecentFiles\RecentFilesContentViewModel.cs" />
     <Compile Include="ViewModels\Dialog\CustomCreateDialogViewModel.cs" />
@@ -775,9 +779,6 @@
     <Compile Include="Views\EditTools\Redaction\RedactionContent.xaml.cs">
       <DependentUpon>RedactionContent.xaml</DependentUpon>
     </Compile>
-    <Compile Include="Views\EditTools\Redaction\RedactionDocumentContent.xaml.cs">
-      <DependentUpon>RedactionDocumentContent.xaml</DependentUpon>
-    </Compile>
     <Compile Include="Views\EditTools\Bates\BatesContent.xaml.cs">
       <DependentUpon>BatesContent.xaml</DependentUpon>
     </Compile>
@@ -990,6 +991,9 @@
     <Compile Include="Views\PropertyPanel\PropertyPanelContent.xaml.cs">
       <DependentUpon>PropertyPanelContent.xaml</DependentUpon>
     </Compile>
+    <Compile Include="Views\PropertyPanel\Scan\ScanPropertyPanel.xaml.cs">
+      <DependentUpon>ScanPropertyPanel.xaml</DependentUpon>
+    </Compile>
     <Compile Include="Views\PropertyPanel\ViewModular\ReadModeContent.xaml.cs">
       <DependentUpon>ReadModeContent.xaml</DependentUpon>
     </Compile>
@@ -1074,6 +1078,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="CustomControl\PaginationControl.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="CustomControl\TextBoxWithTip.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1158,6 +1166,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Styles\SeparatorStyle.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
     <Page Include="Styles\SliderStyle.xaml">
       <Generator>MSBuild:Compile</Generator>
       <SubType>Designer</SubType>
@@ -1462,10 +1474,6 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
-    <Page Include="Views\EditTools\Redaction\RedactionDocumentContent.xaml">
-      <SubType>Designer</SubType>
-      <Generator>MSBuild:Compile</Generator>
-    </Page>
     <Page Include="Views\FillAndSign\FillAndSignContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1711,6 +1719,10 @@
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
     </Page>
+    <Page Include="Views\PropertyPanel\Scan\ScanPropertyPanel.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
     <Page Include="Views\PropertyPanel\ViewModular\ReadModeContent.xaml">
       <SubType>Designer</SubType>
       <Generator>MSBuild:Compile</Generator>
@@ -1864,18 +1876,45 @@
       <LastGenOutput>Settings.Designer.cs</LastGenOutput>
     </None>
     <Content Include="ComDocumentAIKit.dll" />
+    <Resource Include="Resources\ToolBarIcon\Scan\enhance.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Resource>
+    <Resource Include="Resources\ToolBarIcon\Scan\ocr.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Resource>
+    <Resource Include="Resources\ToolBarIcon\Scan\batch.png">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </Resource>
     <Content Include="source\AnalysisWord\Res\word\_rels\document.xml.rels">
       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     </Content>
-    <None Include="x64\models\DA_image_enhance_magic_color_1.0.0.model" />
-    <None Include="x64\models\DA_Ocr_Classification_1.0.0.model" />
-    <None Include="x64\models\DA_Ocr_Detection_chinese_1.0.0.model" />
-    <None Include="x64\models\DA_Ocr_Detection_english_1.0.0.model" />
-    <None Include="x64\models\DA_Ocr_Recognition_chinese_1.0.0.model" />
-    <None Include="x64\models\DA_Ocr_Recognition_chinese_cht_1.0.0.model" />
-    <None Include="x64\models\DA_Ocr_Recognition_english_1.0.0.model" />
-    <None Include="x64\models\DA_Ocr_Recognition_japan_1.0.0.model" />
-    <None Include="x64\models\DA_Ocr_Recognition_korean_1.0.0.model" />
+    <None Include="x64\models\DA_image_enhance_magic_color_1.0.0.model">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="x64\models\DA_Ocr_Classification_1.0.0.model">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="x64\models\DA_Ocr_Detection_chinese_1.0.0.model">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="x64\models\DA_Ocr_Detection_english_1.0.0.model">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="x64\models\DA_Ocr_Recognition_chinese_1.0.0.model">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="x64\models\DA_Ocr_Recognition_chinese_cht_1.0.0.model">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="x64\models\DA_Ocr_Recognition_english_1.0.0.model">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="x64\models\DA_Ocr_Recognition_japan_1.0.0.model">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
+    <None Include="x64\models\DA_Ocr_Recognition_korean_1.0.0.model">
+      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+    </None>
     <Resource Include="Resources\BOTA\Annotation\Arrow.png" />
     <Resource Include="Resources\BOTA\Annotation\Bookmark.png" />
     <Resource Include="Resources\BOTA\Annotation\Circle.png" />
@@ -1968,7 +2007,6 @@
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Views\Edit\" />
-    <Folder Include="Views\Scan\" />
   </ItemGroup>
   <ItemGroup>
     <Content Include="ComOCRKit.Desk.dll">

+ 11 - 0
PDF Office/Properties/Settings.Designer.cs

@@ -191,5 +191,16 @@ namespace PDF_Office.Properties {
                 this["SignatureList"] = value;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        public global::PDFSettings.RedactionSettings RedactionsSettings {
+            get {
+                return ((global::PDFSettings.RedactionSettings)(this["RedactionsSettings"]));
+            }
+            set {
+                this["RedactionsSettings"] = value;
+            }
+        }
     }
 }

+ 3 - 0
PDF Office/Properties/Settings.settings

@@ -47,5 +47,8 @@
     <Setting Name="SignatureList" Type="PDFSettings.SignatureList" Scope="User">
       <Value Profile="(Default)" />
     </Setting>
+    <Setting Name="RedactionsSettings" Type="PDFSettings.RedactionSettings" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
   </Settings>
 </SettingsFile>

BIN
PDF Office/Resources/ToolBarIcon/Scan/batch.png


BIN
PDF Office/Resources/ToolBarIcon/Scan/enhance.png


BIN
PDF Office/Resources/ToolBarIcon/Scan/ocr.png


+ 2 - 2
PDF Office/SDKLisence.xml

@@ -1,6 +1,6 @@
 <Lisences
-	devKey = "ehrnKqkWc1XSEAWyPUt6+95GzCoLEyoKrCbsUuJkCqGmxmP5ozX4bS0R6crHItQVNTFvC5mBZ1M7QjJ6Ekdu4Daj7PM+EDLTBKbFJinK4Ri9E5E2X+a9vF5zSj0TkIscQPVnwj9ikxAFOWGIyybMwQQzwc8a4j1cGOqGXQRDMMY="
-  devSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4gQurxTxGuBlGAhs0P1mD3X3bHT+AHfcLiymaqE4DY7kTFHoPs9I3tl5ErS+BHdzHRhrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1367/WkJ00tM7U7tttD6ccHhEu996bvBgqf8Sw8OekQKQq13VBewK5AckaDux4W7SGRhCUNWC4MItkr36JnXMD2tiFQYzMG8C66HYmRGSLh"
+	devKey = "BK8BcXWm+YbGRpEONe43pEJXhshAiAwWoBQgwlEUnxFBkCVal4AYW01RnbuwHCdkktvy9sAYs/SUflLR+KOMayg6z2TE2G3OhIXf95sN8k1sk947zrPGeHPtHx7gMaurYrscLDAumvtymhg4rMTg7XFKfBtchlAi0bE+wPTsqa8="
+  devSecret = "mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4iYSXB8erGstkUyaynN7k8ocNCYAAzc9CPxiym2TlqeSUWpLOaOv47bs7x+UqfQzn9hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBwyVLBY93oKLBB8UJg4t07605BGbaBKUlDopA0iGq1HSnRAJhqHxGgIZ+m3BxAFwgabp2OdkT7I9klGmA/4KertEmsKlSJ3WFqmDWhwfT73yCYDNQpuarUAQxiS1PJu8kUw=="
   userKey = "iBPRM/Tz8b6Z1G2GQt52X7hiNCGfVYXztnPjalgrgARvqfKV6lFNH8QeScTzBRYI8GGFpwelfgh790Kd9JmL7V4adI1jCiFHUT2DLT7QucxY5Nkgys2aJItQS482Ck2G2Xf8gNgojxYxRt65o/MEzkj93foj8qIdfHagXsSorSs="
 	userSecret="mG0c3O3Mzeu5dkZJW3gpqq9uA7o7EGQveSC38Q8TK4ivEHOmPIqbfhpDnKKj+7Ymj2rXQvfZRmke06HMV+3tt064G64WjPW8+EbGCNZaAh1hrp9sGpqfp0B228KI+IMTu4aGVjtYuk+Uxs/kosIBw1FKJi6HYB+DuugQyaqI2prfej861QnJrU4s2T/npZK/"
 	ConverterDevKey="Eahwo7OZAYHJaCF7TJQYKSVqC62MzfBdllVXnC5BRR5BQFDKnQ1FJtCRVdug+VNg/ti+/DeA5Sq4IH2CBpQjAZst5705uk5Sz0ZwRu8Qdn9HFGwh2pG6dJEIrl7lOccoZS6+1IxgOTcTeHqYpym3NsmtbhBWE848Pvme3scpW28="

+ 14 - 0
PDF Office/Styles/ContextMenuStyle.xaml

@@ -82,4 +82,18 @@
         </MenuItem>
     </ContextMenu>
 
+    <ContextMenu x:Key="RedactionContextMenu">
+        <MenuItem
+            Name="MenuDelete"
+            Command="{x:Static ApplicationCommands.Delete}"
+            Header="Delete" />
+        <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
+        <MenuItem Name="MenuProperties" Header="Properties..." />
+        <MenuItem Name="MenuSetDeufalt" Header="Use Current Properties as New Default" />
+        <Separator Style="{StaticResource HorizontalSeparatorStyle}" />
+        <MenuItem Name="MenuRepeat" Header="Repeat mark across pages" />
+        <MenuItem Name="MenuApply" Header="Apply Redactions" />
+        <MenuItem Name="MenuErase" Header="Erase Redactions" />
+    </ContextMenu>
+
 </ResourceDictionary>

+ 1 - 0
PDF Office/Styles/ImageButtonStyle.xaml

@@ -63,6 +63,7 @@
                         <Trigger Property="IsMouseOver" Value="True">
                             <Setter TargetName="PART_Content" Property="Foreground" Value="{Binding MouseOverForeground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:ImageButton}}}" />
                             <Setter TargetName="PART_Border" Property="Background" Value="{Binding MouseOverBackground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:ImageButton}}}" />
+                            <Setter TargetName="PART_Border" Property="Opacity" Value="{Binding MouseOverBackgroundOpacity, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:ImageButton}}}" />
                             <Setter TargetName="PART_Border" Property="BorderBrush" Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type customControl:ImageButton}}}" />
                             <Setter TargetName="PART_MouseOverIcon" Property="Visibility" Value="Visible" />
                             <Setter TargetName="PART_Icon" Property="Visibility" Value="Collapsed" />

+ 23 - 0
PDF Office/Styles/SeparatorStyle.xaml

@@ -0,0 +1,23 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+
+    <Style
+        x:Key="VerticalSeparatorStyle"
+        BasedOn="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"
+        TargetType="{x:Type Separator}">
+        <Setter Property="Background" Value="{StaticResource color.sys.layout.divider}" />
+        <Setter Property="Height" Value="16" />
+        <Setter Property="Width" Value="1" />
+        <Setter Property="HorizontalAlignment" Value="Stretch" />
+        <Setter Property="Margin" Value="12,0" />
+    </Style>
+
+    <Style
+        x:Key="HorizontalSeparatorStyle"
+        BasedOn="{StaticResource {x:Static ToolBar.SeparatorStyleKey}}"
+        TargetType="{x:Type Separator}">
+        <Setter Property="Background" Value="{StaticResource color.sys.layout.divider}" />
+        <Setter Property="Height" Value="1" />
+        <Setter Property="HorizontalAlignment" Value="Stretch" />
+        <Setter Property="Margin" Value="8,4" />
+    </Style>
+</ResourceDictionary>

+ 4 - 0
PDF Office/Themes/Generic.xaml

@@ -130,6 +130,10 @@
                             <Setter TargetName="placeholder" Property="Visibility" Value="Visible" />
                             <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
                         </Trigger>
+                        <Trigger Property="ShowClose" Value="False">
+                            <Setter TargetName="PART_BtnClear" Property="Visibility" Value="Collapsed" />
+                            <Setter TargetName="PART_ContentHost" Property="Margin" Value="4,5" />
+                        </Trigger>
                         <MultiTrigger>
                             <MultiTrigger.Conditions>
                                 <Condition Property="Text" Value="" />

+ 24 - 1
PDF Office/ViewModels/Dialog/Redaction/MarkSettingDialogViewModel.cs

@@ -1,4 +1,5 @@
-using Prism.Mvvm;
+using Prism.Commands;
+using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
@@ -14,6 +15,28 @@ namespace PDF_Office.ViewModels.Dialog.Redaction
 
         public event Action<IDialogResult> RequestClose;
 
+        public DelegateCommand OkCommand { get; set; }
+
+        public DelegateCommand CancelCommand { get; set; }
+
+
+
+        public MarkSettingDialogViewModel()
+        {
+            OkCommand = new DelegateCommand(ok);
+            CancelCommand = new DelegateCommand(cancel);
+        }
+
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void ok()
+        {
+            
+        }
+
         public bool CanCloseDialog()
         {
             return true;

+ 145 - 3
PDF Office/ViewModels/Dialog/Redaction/PageMarkDialogViewModel.cs

@@ -1,4 +1,8 @@
-using Prism.Mvvm;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using Prism.Commands;
+using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
@@ -10,10 +14,142 @@ namespace PDF_Office.ViewModels.Dialog.Redaction
 {
     public class PageMarkDialogViewModel : BindableBase, IDialogAware
     {
-        public string Title =>"";
+        public string Title => "";
 
         public event Action<IDialogResult> RequestClose;
 
+        public DelegateCommand OkCommand { get; set; }
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public DelegateCommand<string> CheckedCommand { get; set; }
+
+
+        /// <summary>
+        /// 当前页
+        /// </summary>
+        public int CurrentPageIndex { get; set; }
+
+
+        private string pagecount = "/1";
+
+        /// <summary>
+        /// 页面总数
+        /// </summary>
+        public string PageCount
+        {
+            get { return pagecount; }
+            set
+            {
+                SetProperty(ref pagecount, value);
+            }
+        }
+
+        /// <summary>
+        /// 页码集合
+        /// </summary>
+        public List<int> PageList = new List<int>();
+
+        /// <summary>
+        /// 文档页面总数
+        /// </summary>
+        public int pageCount = 0;
+
+        private string custompage;
+        /// <summary>
+        /// 自定义页面
+        /// </summary>
+        public string CustomPage
+        {
+            get { return custompage; }
+            set
+            {
+                SetProperty(ref custompage, value);
+                if(!string.IsNullOrEmpty(value))
+                {
+                    CheckCustomPage();
+                }
+            }
+        }
+
+
+        public PageMarkDialogViewModel()
+        {
+            OkCommand = new DelegateCommand(ok);
+            CancelCommand = new DelegateCommand(cancel);
+            CheckedCommand = new DelegateCommand<string>(check);
+        }
+
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
+        private void ok()
+        {
+            DialogParameters valuePairs = new DialogParameters();
+            valuePairs.Add(ParameterNames.PageList, PageList);
+            RequestClose.Invoke(new DialogResult(ButtonResult.OK, valuePairs));
+        }
+
+        private void CheckCustomPage()
+        {
+            var result = CommonHelper.GetPagesInRange(ref PageList,CustomPage,pageCount,new char[]{ ','},new char[] { '-'});
+            if(!result)
+            {
+                AlertsMessage alertsMessage = new AlertsMessage();
+                alertsMessage.ShowDialog("","页码错误","ok");
+                CustomPage = "";
+                return;
+            }
+        }
+
+        private void check(string args)
+        {
+            switch (args)
+            {
+                case "Old":
+                    PageList = new List<int>();
+                    for (int i = 1; i <=pageCount; i++)
+                    {
+                        if (i % 2 != 0)
+                        {
+                            PageList.Add(i-1);
+                        }
+                    }
+                    break;
+                case "Even":
+                    PageList = new List<int>();
+                    for (int i = 1; i <= pageCount; i++)
+                    {
+                        if (i % 2 == 0)
+                        {
+                            PageList.Add(i - 1);
+                        }
+                    }
+                    break;
+                case "All":
+                    PageList = new List<int>();
+                    for(int i=0;i<pageCount;i++)
+                    {
+                        PageList.Add(i);
+                    }
+                    break;
+                case "Custom":
+                    if(!string.IsNullOrEmpty(CustomPage))
+                    {
+                        CheckCustomPage();
+                    }
+                    break;
+                default:
+                case "Current":
+                    PageList = new List<int>();
+                    PageList.Add(CurrentPageIndex);
+                    break;
+            }
+        }
+
+
         public bool CanCloseDialog()
         {
             return true;
@@ -26,7 +162,13 @@ namespace PDF_Office.ViewModels.Dialog.Redaction
 
         public void OnDialogOpened(IDialogParameters parameters)
         {
-    
+            int page = parameters.GetValue<int>(ParameterNames.PageCount);
+            if(page>0)
+            {
+                PageCount = "/ " + page;
+                pageCount = page;
+            }
+            CurrentPageIndex = parameters.GetValue<int>(ParameterNames.CurrentPageIndex);
         }
     }
 }

+ 22 - 1
PDF Office/ViewModels/Dialog/Redaction/RepeatMarkDialogViewModel.cs

@@ -1,4 +1,5 @@
-using Prism.Mvvm;
+using Prism.Commands;
+using Prism.Mvvm;
 using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
@@ -14,6 +15,26 @@ namespace PDF_Office.ViewModels.Dialog.Redaction
 
         public event Action<IDialogResult> RequestClose;
 
+        public DelegateCommand OkCommand { get; set; }
+
+        public DelegateCommand CancelCommand { get; set; }
+
+        public RepeatMarkDialogViewModel()
+        {
+            OkCommand = new DelegateCommand(ok);
+            CancelCommand = new DelegateCommand(cancel);
+        }
+
+        private void ok()
+        {
+
+        }
+
+        private void cancel()
+        {
+            RequestClose.Invoke(new DialogResult(ButtonResult.Cancel));
+        }
+
         public bool CanCloseDialog()
         {
             return true;

+ 276 - 27
PDF Office/ViewModels/EditTools/Redaction/RedactionContentViewModel.cs

@@ -1,8 +1,13 @@
-using ComPDFKitViewer.AnnotEvent;
+using ComPDFKit.Import;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKit.PDFPage;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.CustomControl;
 using PDF_Office.EventAggregators;
 using PDF_Office.Model;
+using PDF_Office.Properties;
 using Prism.Commands;
 using Prism.Events;
 using Prism.Mvvm;
@@ -12,11 +17,13 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Input;
 using System.Windows.Media;
 
 namespace PDF_Office.ViewModels.EditTools.Redaction
 {
-    public class RedactionContentViewModel : BindableBase,INavigationAware
+    public class RedactionContentViewModel : BindableBase, INavigationAware
     {
         public IEventAggregator eventAggregator;
 
@@ -28,6 +35,8 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
 
         private ViewContentViewModel viewContentViewModel;
 
+        private RedactionAnnotArgs redactionArgs = new RedactionAnnotArgs();
+
         public string RedactionDocumentRegionName { get; set; }
         public string RedactionBottomBarRegionName { get; set; }
 
@@ -39,11 +48,45 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
 
         public DelegateCommand ApplyCommmand { get; set; }
 
-        public DelegateCommand RemoveCommand { get; set; }
-
         public DelegateCommand PageRedactionCommand { get; set; }
 
-        public RedactionContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator,IDialogService dialogService)
+        public DelegateCommand EraseCommand { get; set; }
+
+        public RedactionCommandEventArgs TempArgs { get; set; }
+
+        private int currentPage = 0;
+
+        /// <summary>
+        /// 是否因为本身传递值  防止循环调用
+        /// </summary>
+        private bool isFromSelf = false;
+
+        public int CurrentPage
+        {
+            get { return currentPage; }
+            set
+            {
+                SetProperty(ref currentPage, value);
+                if (value >= 1 && value <= PDFViewer.Document.PageCount && !isFromSelf)
+                {
+                    PDFViewer.GoToPage(value - 1);
+                }
+            }
+        }
+
+        private int pageCount = 0;
+
+        public int PageCount
+        {
+            get { return pageCount; }
+            set
+            {
+                SetProperty(ref pageCount, value);
+            }
+        }
+
+
+        public RedactionContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, IDialogService dialogService)
         {
             this.redactionRegion = regionManager;
             this.eventAggregator = eventAggregator;
@@ -53,10 +96,80 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
             Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
             CloseEditToolCommand = new DelegateCommand(CloseEditTool);
             ApplyCommmand = new DelegateCommand(apply);
-            RemoveCommand = new DelegateCommand(remove);
+            EraseCommand = new DelegateCommand(erase);
             PageRedactionCommand = new DelegateCommand(pageMark);
+
+            eventAggregator.GetEvent<RedactionCommandEvent>().Subscribe(SetContextMenu, e => e.UniCode == Unicode);
+        }
+
+        private void SetContextMenu(RedactionCommandEventArgs obj)
+        {
+            var contextmenu = App.Current.FindResource("RedactionContextMenu") as ContextMenu;
+            obj.args.PopupMenu = contextmenu;
+            for(int i=0;i<contextmenu.Items.Count;i++)
+            {
+                if(contextmenu.Items[i] is MenuItem) 
+                {
+                    var item = contextmenu.Items[i] as MenuItem;
+                    switch (item.Name)
+                    {
+                        case "MenuSetDeufalt":
+                            item.Command = new DelegateCommand<RedactionCommandEventArgs>(SetDefualtProperty);
+                            item.CommandParameter = obj;
+                            break;
+                        case "MenuProperties":
+                            item.Command = new DelegateCommand<RedactionCommandEventArgs>(ShowProperty);
+                            item.CommandParameter = obj;
+                            break;
+                        case "MenuRepeat":
+                            item.Command = new DelegateCommand<RedactionCommandEventArgs>(RepreatMark);
+                            item.CommandParameter = obj;
+                            break;
+                        case "MenuApply":
+                            item.Command = this.ApplyCommmand;
+                            break;
+                        case "MenuErase":
+                            item.Command = this.EraseCommand;
+                            break;
+                        default:
+                            break;
+                    }
+
+                }
+            }
         }
 
+        /// <summary>
+        /// 设置当前为默认属性
+        /// </summary>
+        /// <param name="args"></param>
+        private void SetDefualtProperty(RedactionCommandEventArgs args)
+        {
+            DialogParameters keyValues = new DialogParameters();
+            keyValues.Add(ParameterNames.DataModel,args.args.AnnotEventArgsList[0] as RedactionAnnotArgs);
+        }
+
+        /// <summary>
+        /// 显示属性弹窗
+        /// </summary>
+        /// <param name="args"></param>
+        private void ShowProperty(RedactionCommandEventArgs args)
+        {
+            DialogParameters keyValues = new DialogParameters();
+            keyValues.Add(ParameterNames.DataModel, args.args.AnnotEventArgsList[0] as RedactionAnnotArgs);
+            dialogs.ShowDialog(DialogNames.MarkSettingDialog,keyValues,null);
+        }
+
+        /// <summary>
+        /// 显示跨页标记弹窗
+        /// </summary>
+        /// <param name="args"></param>
+        private void RepreatMark(RedactionCommandEventArgs args)
+        {
+            DialogParameters keyValues = new DialogParameters();
+            keyValues.Add(ParameterNames.PageCount,PDFViewer.Document.PageCount);
+            dialogs.ShowDialog(DialogNames.RepeatMarkDialog, keyValues, null);
+        }
         /// <summary>
         /// 应用
         /// </summary>
@@ -75,25 +188,148 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
         /// <summary>
         /// 擦除
         /// </summary>
-        private void remove()
+        private void erase()
         {
 
         }
 
         private void pageMark()
         {
-            dialogs.ShowDialog(DialogNames.PageMarkDialog);
+            DialogParameters valuePairs = new DialogParameters();
+            valuePairs.Add(ParameterNames.PageCount,PDFViewer.Document.PageCount);
+            valuePairs.Add(ParameterNames.CurrentPageIndex,PDFViewer.CurrentIndex);
+            dialogs.ShowDialog(DialogNames.PageMarkDialog,valuePairs,e=> { 
+                if(e.Result == ButtonResult.OK)
+                {
+                    var pagelist = e.Parameters.GetValue<List<int>>(ParameterNames.PageList);
+                    addMarkToPages(pagelist);
+                }
+            });
         }
 
+        private void addMarkToPages(List<int> list)
+        {
+            foreach (var page in list)
+            {
+
+                //根据页面大小,创建标记密文注释
+                CPDFPage docPage = PDFViewer.Document.PageAtIndex(page);
+
+                CPDFRedactAnnotation redactionAnnot = docPage.CreateAnnot(C_ANNOTATION_TYPE.C_ANNOTATION_REDACT) as CPDFRedactAnnotation;
+                if (redactionAnnot == null)
+                {
+                    //TODO 操作失败
+                    return;
+                }
+
+                redactionAnnot.SetQuardRects(new List<CRect>() { new CRect(0, (float)docPage.PageSize.Height, (float)docPage.PageSize.Width,0)});
+
+                if (redactionArgs == null)
+                    return;
+
+                byte[] lineColor = { redactionArgs.LineColor.R, redactionArgs.LineColor.G, redactionArgs.LineColor.B };
+                redactionAnnot.SetOutlineColor(lineColor);
+
+                if (redactionArgs.BgColor != Colors.Transparent)
+                {
+                    byte[] bgColor = { redactionArgs.BgColor.R, redactionArgs.BgColor.G, redactionArgs.BgColor.B };
+                    redactionAnnot.SetFillColor(bgColor);
+                }
+                else
+                {
+                    // redactionAnnot.ClearBgColor();
+                }
+
+                CTextAttribute textAttr = new CTextAttribute();
+                byte[] fontColor = { redactionArgs.FontColor.R, redactionArgs.FontColor.G, redactionArgs.FontColor.B };
+                textAttr.FontColor = fontColor;
+                textAttr.FontSize = (float)redactionArgs.FontSize;
+                redactionAnnot.SetTextAttribute(textAttr);
+                switch (redactionArgs.Align)
+                {
+                    case TextAlignment.Left:
+                        redactionAnnot.SetTextAlignment(C_TEXT_ALIGNMENT.ALIGNMENT_LEFT);
+                        break;
+                    case TextAlignment.Center:
+                        redactionAnnot.SetTextAlignment(C_TEXT_ALIGNMENT.ALIGNMENT_CENTER);
+                        break;
+                    case TextAlignment.Right:
+                        redactionAnnot.SetTextAlignment(C_TEXT_ALIGNMENT.ALIGNMENT_RIGHT);
+                        break;
+                    default:
+                        redactionAnnot.SetTextAlignment(C_TEXT_ALIGNMENT.ALIGNMENT_LEFT);
+                        break;
+                }
+
+                //byte transparency = (byte)Math.Round(redactionArgs.Transparency * 255);
+                //redactionAnnot.SetTransparency(transparency);
+                redactionAnnot.SetBorderWidth(1);
+                //redactionAnnot.SetRect(new CRect(Left, Bottom, Right, Top));
+
+                //redactionAnnot.SetCreationDate(Helpers.GetCurrentPdfTime());
+                if (string.IsNullOrEmpty(Settings.Default.AppProperties.Description.Author))
+                {
+                    redactionAnnot.SetAuthor(Settings.Default.AppProperties.Description.Author);
+                }
+
+                if (redactionArgs.Content != null && redactionArgs.Content != string.Empty)
+                {
+                    redactionAnnot.SetOverlayText(redactionArgs.Content);
+                }
+
+                if (redactionAnnot.GetIsLocked() != redactionArgs.Locked)
+                {
+                    redactionAnnot.SetIsLocked(redactionArgs.Locked);
+                }
+
+                redactionAnnot.UpdateAp();
+                redactionAnnot.ReleaseAnnot();
+            }
+        }
+
+
 
         public void CloseEditTool()
         {
-            PDFViewer.SetMouseMode(MouseModes.Default);
-            redactionRegion.Regions[RegionNames.ViwerRegionName].Remove(PDFViewer);
-            redactionRegion.Regions[RedactionDocumentRegionName].Remove(PDFViewer);
-            this.eventAggregator.GetEvent<CloseEditToolEvent>().Publish(new EnumCloseModeUnicode { Unicode = this.Unicode, Status = EnumCloseMode.StatusCancel });
+            bool isClose = true;
+            if (CheckHasRedactionAnnote())
+            {
+                AlertsMessage alertsMessage = new AlertsMessage();
+                alertsMessage.ShowDialog("", "There are unapplied redactions in this file. Exit will not save redaction.", "Cancel", "Exit");
+                if (alertsMessage.result != ContentResult.Ok)
+                {
+                    isClose = false;
+                }
+            }
+
+            if(isClose)
+            {
+                PDFViewer.SetMouseMode(MouseModes.Default);
+                redactionRegion.Regions[RegionNames.ViwerRegionName].Remove(PDFViewer);
+                redactionRegion.Regions[RedactionDocumentRegionName].Remove(PDFViewer);
+                this.eventAggregator.GetEvent<CloseEditToolEvent>().Publish(new EnumCloseModeUnicode { Unicode = this.Unicode, Status = EnumCloseMode.StatusCancel });
+                App.mainWindowViewModel.SelectedItem.IsInReadctonMode = false;
+            }
         }
 
+        /// <summary>
+        /// 检查是否有未应用的标记密文
+        /// </summary>
+        private bool CheckHasRedactionAnnote()
+        {
+            for (int i = 0; i < PDFViewer.Document.PageCount; i++)
+            {
+                var items = PDFViewer.GetAnnotCommentList(i, PDFViewer.Document);
+                for (int j = 0; j < items.Count; j++)
+                {
+                    if (items[j].EventType == AnnotArgsType.AnnotRedaction)
+                    {
+                        return true;
+                    }
+                }
+            }
+            return false;
+        }
         #region Navigation
 
         public bool IsNavigationTarget(NavigationContext navigationContext)
@@ -107,29 +343,31 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            App.mainWindowViewModel.SelectedItem.IsInReadctonMode = true;
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
+            PDFViewer.InfoChanged += PDFViewer_InfoChanged;
+            CurrentPage = PDFViewer.CurrentIndex + 1;
+            PageCount = PDFViewer.Document.PageCount;
             if (!redactionRegion.Regions[RedactionDocumentRegionName].Views.Contains(PDFViewer))
             {
-                RedactionAnnotArgs redactionArgs = new RedactionAnnotArgs();
+                redactionArgs = new RedactionAnnotArgs();
                 AnnotHandlerEventArgs annotArgs = null;
-                redactionArgs.LineColor = ((SolidColorBrush)Brushes.Black).Color;
-                redactionArgs.BgColor = ((SolidColorBrush)Brushes.Black).Color;
-                redactionArgs.FontColor = ((SolidColorBrush)Brushes.Red).Color;
-                //redactionArgs.LineColor = Settings.Default.RedactionsSettings.LineColor;
-                //redactionArgs.BgColor = Settings.Default.RedactionsSettings.BgColor;
-                //redactionArgs.FontColor = Settings.Default.RedactionsSettings.FontColor;
-                //redactionArgs.Align = Settings.Default.RedactionsSettings.Align;
-                //redactionArgs.FontSize = Settings.Default.RedactionsSettings.FontSize;
-                //redactionArgs.Content = Settings.Default.RedactionsSettings.Content;
-                //if (!Settings.Default.RedactionsSettings.isUseText)
-                //{
-                //    redactionArgs.Content = "";
-                //}
+                redactionArgs.LineColor = Settings.Default.RedactionsSettings.LineColor;
+                redactionArgs.BgColor = Settings.Default.RedactionsSettings.BgColor;
+                redactionArgs.FontColor = Settings.Default.RedactionsSettings.FontColor;
+                redactionArgs.Align = Settings.Default.RedactionsSettings.Align;
+                redactionArgs.FontSize = Settings.Default.RedactionsSettings.FontSize;
+                redactionArgs.Content = Settings.Default.RedactionsSettings.Content;
+                if (!Settings.Default.RedactionsSettings.isUseText)
+                {
+                    redactionArgs.Content = "";
+                }
                 annotArgs = redactionArgs;
                 if (annotArgs != null)
                 {
-                    //annotArgs.Author = Settings.Default.AppProperties.Description.Author;
+                    //设置注释作者
+                    annotArgs.Author = Settings.Default.AppProperties.Description.Author;
                     PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
                     PDFViewer.SetToolParam(annotArgs);
                 }
@@ -137,6 +375,17 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
             }
   
         }
+
+        private void PDFViewer_InfoChanged(object sender, KeyValuePair<string, object> e)
+        {
+            isFromSelf = true;
+           if(e.Key=="PageNum")
+            {
+                var data = e.Value as RenderData;
+                CurrentPage = data.PageIndex;
+            }
+            isFromSelf = false;
+        }
         #endregion
     }
 }

+ 0 - 90
PDF Office/ViewModels/EditTools/Redaction/RedactionDocumentContentViewModel.cs

@@ -1,90 +0,0 @@
-using ComPDFKit.PDFDocument;
-using ComPDFKitViewer;
-using ComPDFKitViewer.PdfViewer;
-using PDF_Office.Helper;
-using PDF_Office.Model;
-using PDF_Office.Model.EditTools.Background;
-using Prism.Mvvm;
-using Prism.Regions;
-using System;
-using System.Collections.Generic;
-using System.Drawing.Printing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Media.Imaging;
-
-namespace PDF_Office.ViewModels.EditTools.Redaction
-{
-    public class RedactionDocumentContentViewModel : BindableBase, INavigationAware
-    {
-        private CPDFViewer pdfViewer;
-        public IRegionManager regionManager;
-        public CPDFViewer PDFViewer;
-        public CPDFDocument Document;
-
-        public string ViewerRegionName { get; set; }
-
-        private int _currentPageIndex;
-        public int CurrentPageIndex
-        {
-            get { return _currentPageIndex; }
-            set
-            {
-                SetProperty(ref _currentPageIndex, PDFViewer.CurrentIndex);
-            }
-        }
-
-        private int _pageSize;
-        public int PageRangeNumber
-        {
-            get { return _pageSize; }
-            set { SetProperty(ref _pageSize, value); }
-        }
-
-        public RedactionDocumentContentViewModel(IRegionManager regionManager)
-        {
-            this.regionManager = regionManager;
-            PageRangeNumber = PDFViewer.Document.PageCount;
-            ViewerRegionName = RegionNames.BackgroundViewerRegionName;
-        }
-
-        private void CurrentViewer_CustomDrawHandler(object sender, CustomDrawData e)
-        {
-        }
-
-        private void UndoManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
-        {
-        }
-
-        public bool IsNavigationTarget(NavigationContext navigationContext)
-        {
-            return true;
-        }
-
-        public void OnNavigatedFrom(NavigationContext navigationContext)
-        {
-        }
-
-        public void OnNavigatedTo(NavigationContext navigationContext)
-        {
-            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out pdfViewer);
-            if (pdfViewer != null)
-            {
-                if (!regionManager.Regions[ViewerRegionName].Views.Contains(PDFViewer))
-                {
-                    PDFViewer = new CPDFViewer();
-                    PDFViewer.InitDocument(pdfViewer.Document);
-                    Document = PDFViewer.Document;
-                    PDFViewer.CustomDrawHandler += CurrentViewer_CustomDrawHandler;
-                    PDFViewer.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
-                    regionManager.AddToRegion(ViewerRegionName, PDFViewer);
-                    PDFViewer.SetAnnotInteraction(!PDFViewer.GetAnnotInteraction());
-                    PDFViewer.Load();
-                    PDFViewer.ChangeViewMode(ViewMode.SingleContinuous);
-                    PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
-                }
-            }
-        }
-    }
-}

+ 277 - 72
PDF Office/ViewModels/Form/ButtonPropertyViewModel.cs

@@ -1,49 +1,48 @@
-using ComPDFKitViewer.AnnotEvent;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl.CompositeControl;
+using PDF_Office.Helper;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
 using System.Windows.Media;
 
 namespace PDF_Office.ViewModels.Form
 {
     public class ButtonPropertyViewModel : FormBaseVM, INavigationAware
     {
-        #region 属性
-
-        #region 选项
-        //标签
-        private string _labelContent;
-        public string LabelContent
-        {
-            get { return _labelContent; }
-            set { SetProperty(ref _labelContent, value); }
-        }
-
-        private string _emailContent;
-        public string EmailContent
-        {
-            get { return _emailContent; }
-            set { SetProperty(ref _emailContent, value); }
-        }
-
-        #endregion
 
+        #region Command变量
+        public DelegateCommand<string> FieldNameTextChangedCommand { get; set; }
+        public DelegateCommand<string> ToolTipTextChangedCommand { get; set; }
 
-        #endregion
+        //外观
+        public DelegateCommand<object> ResetColorCommand { get; set; }
+        public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
 
-        #region Command
+        public DelegateCommand<string> FormContentTextChangedCommand { get; set; }
 
+        public DelegateCommand<object> LineStyleCommand { get; set; }
         #endregion
 
         #region 变量
         private CPDFViewer PDFViewer;
         private WidgetPushButtonArgs pushButtonArgs;
+        private IDialogService dialogs;
+        public event EventHandler<int> SelectResetColorBtnHandler;
+        public List<ComboDataItem> FontFamilyItems { get; private set; }
+        public List<ComboDataItem> FontStyleItems { get; private set; }
+        public List<ComboDataItem> AglinmentItems { get; private set; }
+
         #endregion
 
         #region 初始化
@@ -55,29 +54,222 @@ namespace PDF_Office.ViewModels.Form
 
         private void InitVariable()
         {
+            InitAllResetColor();
+            InitFontFamilyComboBox();
+            InitFontStyleComboBox();
+            InitAglinmentItemsComboBox();
+        }
+
+        private void InitAllResetColor()
+        {
+            ResetColorOne = InitResetColor(Colors.Transparent, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorTwo = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorThree = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorForth = InitResetColor(Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Colors.Transparent);
+        }
+
+        private void InitFontFamilyComboBox()
+        {
+            FontFamilyItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Courier", "Courier New");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Helvetica", "Helvetica");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Times Roman", "Times New Roman");
+            FontFamilyItems.Add(item);
+        }
 
+        private void InitFontStyleComboBox()
+        {
+            FontStyleItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Regular", "Regular");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Bold", "Bold");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Italic", "Italic");
+            FontStyleItems.Add(item);
+
+            item = new ComboDataItem("Bold Italic", "Bold Italic");
+            FontStyleItems.Add(item);
         }
 
+        private void InitAglinmentItemsComboBox()
+        {
+            AglinmentItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Left", "Left");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Center", "Center");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Right", "Right");
+            AglinmentItems.Add(item);
+        }
         private void InitCommand()
         {
-            ChangeValueHandler -= ChangeValue;
-            ChangeValueHandler += ChangeValue;
+            //一般
+            FieldNameTextChangedCommand = new DelegateCommand<string>(FieldNameTextChanged);
+            ToolTipTextChangedCommand = new DelegateCommand<string>(ToolTipTextChanged);
+            //外观
+            ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
+            ResetColorCommand = new DelegateCommand<object>(ResetColorEvent);
+            LineStyleCommand = new DelegateCommand<object>(LineStyleBtnEvent);
+
+            //选项
+            FormContentTextChangedCommand = new DelegateCommand<string>(FormContentTextChanged);
         }
 
-      
+
         #endregion
 
 
-        #region 一般处理
+        #region 事件
 
-        #endregion
 
-        #region 外观处理
+        private void FieldNameTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                FieldName = obj;
+
+            }
+        }
+
+        private void ToolTipTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                ToolTipStr = obj;
+            }
+        }
+
+
+        private void LineStyleBtnEvent(object obj)
+        {
+            if (obj != null)
+            {
+                switch ((string)obj)
+                {
+                    case "Solid":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
+                        break;
+                    case "Dotted":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
+                        break;
+                }
+            }
+        }
+
+
+        private void FormContentTextChanged(string obj)
+        {
+            if (obj != null && IsCurrentWidget == true)
+            {
+                FormContent = obj;
+            }
+        }
+
+
+        private void ResetColorCheckedBtn(object obj)
+        {
+            if (obj != null)
+            {
+                var str = obj as string;
+                if (str != null)
+                {
+                    switch (str)
+                    {
+                        case "One":
+                            BorderColor = ResetColorOne.BorderColor.Color;
+                            ContentColor = ResetColorOne.FontColor.Color;
+                            FillColor = ResetColorOne.FillColor.Color;
+                            break;
+
+                        case "Two":
+                            BorderColor = ResetColorTwo.BorderColor.Color;
+                            ContentColor = ResetColorTwo.FontColor.Color;
+                            FillColor = ResetColorTwo.FillColor.Color;
+                            break;
+
+                        case "Three":
+                            BorderColor = ResetColorThree.BorderColor.Color;
+                            ContentColor = ResetColorThree.FontColor.Color;
+                            FillColor = ResetColorThree.FillColor.Color;
+                            break;
+
+                        case "Forth":
+                            BorderColor = ResetColorForth.BorderColor.Color;
+                            ContentColor = ResetColorForth.FontColor.Color;
+                            FillColor = ResetColorForth.FillColor.Color;
+                            break;
+                    }
+                }
+            }
+        }
+
+        private void ResetColorEvent(object obj)
+        {
+            bool result = true;
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.PDFViewer, PDFViewer);
+            dialogs.ShowDialog(DialogNames.EditPresetColorsDialog, value, e =>
+            {
+                if (e.Result != ButtonResult.OK)
+                {
+                    result = false;
+                }
+                EditPresetColorsDialogViewModel DialogVM = e.Parameters.GetValue<EditPresetColorsDialogViewModel>(ParameterNames.DataModel);
+                if (DialogVM != null)
+                {
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
+
 
         #endregion
 
-        #region 选项处理
+        #region 外部XAML触发事件
+
+        private void UpdataSelectResetColorBtn()
+        {
+            int result = 0;
+            if (UpdataSelectResetColor(ResetColorOne))
+            {
+                result = 1;
+            }
+            else if (UpdataSelectResetColor(ResetColorTwo))
+            {
+                result = 2;
+            }
+            else if (UpdataSelectResetColor(ResetColorThree))
+            {
+                result = 3;
+            }
+            else if (UpdataSelectResetColor(ResetColorForth))
+            {
+                result = 4;
+            }
+
+            SelectResetColorBtnHandler?.Invoke(null, result);
+        }
 
+        private bool UpdataSelectResetColor(ResetColor reset)
+        {
+            if (reset.FillColor.Color == FillColor &&
+                reset.FontColor.Color == ContentColor &&
+                reset.BorderColor.Color == BorderColor
+                )
+            {
+                return true;
+            }
+
+            return false;
+        }
         #endregion
 
         #region Navegation
@@ -89,22 +281,26 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             pushButtonArgs = null;
+            isCreateWidget = false;
+            IsCurrentWidget = false;
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<WidgetPushButtonArgs>("WidgetArgs", out pushButtonArgs);
+            navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
 
             GetWidgeText();
-            GetProperty();
+            UpdataSelectResetColorBtn();
         }
 
         private void GetWidgeText()
         {
-            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
+           
             if (pushButtonArgs == null)
             {
+                PDFViewer.SetMouseMode(MouseModes.FormEditTool);
                 WidgetPushButtonArgs pushButtonArgs = new WidgetPushButtonArgs();
                 pushButtonArgs.BgColor = Colors.White;
                 pushButtonArgs.FontFamily = "Courier New";
@@ -120,59 +316,68 @@ namespace PDF_Office.ViewModels.Form
 
                 this.pushButtonArgs = pushButtonArgs;
                 PDFViewer.SetToolParam(pushButtonArgs);
+                isCreateWidget = true;
             }
             else
             {
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
+                isCreateWidget = false;
             }
-        }
+            GetProperty();
 
-        private void GetProperty()
-        {
-            
+            IsCurrentWidget = true;
         }
 
-        //更改基类公共属性后,触发的事件
-        private void ChangeValue(object sender, FormAttributeType e)
+        private void GetProperty()
         {
-            switch (e)
+            if (pushButtonArgs != null)
             {
-                case FormAttributeType.Name:
-                    break;
-
-                case FormAttributeType.ToolTip:
-
-                    break;
-
-                case FormAttributeType.IsSolid:
-                    break;
-
-                case FormAttributeType.IsLocked:
-                    break;
-
-                case FormAttributeType.HeightSize:
-                    break;
-
-                case FormAttributeType.BorderThiness:
-                    break;
-
-                case FormAttributeType.BorderColor:
-                    break;
-
-                case FormAttributeType.ContentColor:
-                    break;
-
-                case FormAttributeType.IsReadOnly:
-                    break;
-
-                case FormAttributeType.WidthSize:
-                    break;
-
-                case FormAttributeType.IsRequiredField:
-                    break;
+                IsLocked = pushButtonArgs.Locked;
+                FieldName = pushButtonArgs.FieldName;
+                ToolTipStr = pushButtonArgs.Tooltip;
+                IsReadOnly = pushButtonArgs.ReadOnly;
+
+                FillColor = pushButtonArgs.BgColor;
+                ContentColor = pushButtonArgs.FontColor;
+                BorderColor = pushButtonArgs.LineColor;
+                BorderThiness = pushButtonArgs.LineWidth;
+                BorderStyle = pushButtonArgs.BorderStyle;
+
+                string fontWeightStyleStr = "";
+                if (pushButtonArgs.FontStyle == FontStyles.Normal)
+                {
+                    if (pushButtonArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Regular";
+                    else
+                        fontWeightStyleStr = "Bold";
+                }
+                else
+                {
+                    if (pushButtonArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Italic";
+                    else
+                        fontWeightStyleStr = "Bold Italic";
+                }
+                FontWeightStyleItem = new ComboDataItem(fontWeightStyleStr);
+
+                FontFamilyData = new ComboDataItem(pushButtonArgs.FontFamily);
+                //避免BorderStyle跟上一个值相同,而没触发更改IsSolid属性
+                if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
+                    IsSolid = true;
+                else
+                    IsSolid = false;
+                FontSizeData = new ComboDataItem(pushButtonArgs.FontSize);
+                if (isCreateWidget == false)
+                {
+                    HeightSize = pushButtonArgs.Height;
+                    WidthSize = pushButtonArgs.Width;
+                }
+
+                //FormContent = listBoxArgs.Text;
+                //IsMultiLine = listBoxArgs.IsMultiLine;
+                //IsScrollText = listBoxArgs.ScrollFlag;
 
             }
-
         }
         #endregion
     }

+ 208 - 70
PDF Office/ViewModels/Form/CheckBoxPropertyViewModel.cs

@@ -2,9 +2,12 @@
 using ComPDFKit.PDFAnnotation.Form;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Helper;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -17,39 +20,27 @@ namespace PDF_Office.ViewModels.Form
 
     public class CheckBoxPropertyViewModel : FormBaseVM, INavigationAware
     {
-        #region 属性
 
-        #region 选项
-
-        //导出值
-        private string _exportValue;
-        public string ExportValue
-        {
-            get { return _exportValue; }
-            set { SetProperty(ref _exportValue, value); }
-        }
-
-        //复选框默认为选中
-        private bool _isDefaultChecked = false;
-        public bool IsDefaultChecked
-        {
-            get { return _isDefaultChecked; }
-            set { SetProperty(ref _isDefaultChecked, value); }
-        }
+        #region Command
+        public DelegateCommand<string> FieldNameTextChangedCommand { get; set; }
+        public DelegateCommand<string> ToolTipTextChangedCommand { get; set; }
 
+        //外观
 
-        #endregion
+        public DelegateCommand<object> ResetColorCommand { get; set; }
+        public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
 
-        #endregion
-
-        #region Command
+        public DelegateCommand<string> ExportedValuesTextChangedCommand { get; set; }
 
+        public DelegateCommand<object> LineStyleCommand { get; set; }
         #endregion
 
         #region 变量
+
         private CPDFViewer PDFViewer;
         private WidgetCheckBoxArgs checkBoxArgs;
-        private bool IsCurrentWidget = false;
+        private IDialogService dialogs;
+        public event EventHandler<int> SelectResetColorBtnHandler;
         #endregion
 
         #region 初始化
@@ -61,28 +52,182 @@ namespace PDF_Office.ViewModels.Form
 
         private void InitVariable()
         {
+            InitAllResetColor();
+        }
+
+        private void InitAllResetColor()
+        {
+            ResetColorOne = InitResetColor(Colors.Transparent, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorTwo = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorThree = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
 
+            ResetColorForth = InitResetColor(Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Colors.Transparent);
         }
 
         private void InitCommand()
         {
-            ChangeValueHandler -= ChangeValue;
-            ChangeValueHandler += ChangeValue;
+            //一般
+            FieldNameTextChangedCommand = new DelegateCommand<string>(FieldNameTextChanged);
+            ToolTipTextChangedCommand = new DelegateCommand<string>(ToolTipTextChanged);
+            //外观
+            ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
+            ResetColorCommand = new DelegateCommand<object>(ResetColorEvent);
+            LineStyleCommand = new DelegateCommand<object>(LineStyleBtnEvent);
+
+            //选项
+            ExportedValuesTextChangedCommand = new DelegateCommand<string>(ExportedValuesTextChanged);
         }
 
         #endregion
 
+        #region 事件
 
-        #region 一般处理
 
-        #endregion
+        private void FieldNameTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+               FieldName = obj;
+
+            }
+        }
+
+        private void ToolTipTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                ToolTipStr = obj;
+            }
+        }
+
+
+        private void LineStyleBtnEvent(object obj)
+        {
+            if (obj != null)
+            {
+                switch ((string)obj)
+                {
+                    case "Solid":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
+                        break;
+                    case "Dotted":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
+                        break;
+                }
+            }
+        }
+
+
+        private void ExportedValuesTextChanged(string obj)
+        {
+            if (obj != null && IsCurrentWidget == true)
+            {
+                ExportedValues = obj;
+            }
+        }
+
+
+        private void ResetColorCheckedBtn(object obj)
+        {
+            if (obj != null)
+            {
+                var str = obj as string;
+                if (str != null)
+                {
+                    switch (str)
+                    {
+                        case "One":
+                            BorderColor = ResetColorOne.BorderColor.Color;
+                            ContentColor = ResetColorOne.FontColor.Color;
+                            FillColor = ResetColorOne.FillColor.Color;
+                            break;
+
+                        case "Two":
+                            BorderColor = ResetColorTwo.BorderColor.Color;
+                            ContentColor = ResetColorTwo.FontColor.Color;
+                            FillColor = ResetColorTwo.FillColor.Color;
+                            break;
+
+                        case "Three":
+                            BorderColor = ResetColorThree.BorderColor.Color;
+                            ContentColor = ResetColorThree.FontColor.Color;
+                            FillColor = ResetColorThree.FillColor.Color;
+                            break;
+
+                        case "Forth":
+                            BorderColor = ResetColorForth.BorderColor.Color;
+                            ContentColor = ResetColorForth.FontColor.Color;
+                            FillColor = ResetColorForth.FillColor.Color;
+                            break;
+                    }
+                }
+            }
+        }
+
+        private void ResetColorEvent(object obj)
+        {
+            bool result = true;
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.PDFViewer, PDFViewer);
+            dialogs.ShowDialog(DialogNames.EditPresetColorsDialog, value, e =>
+            {
+                if (e.Result != ButtonResult.OK)
+                {
+                    result = false;
+                }
+                EditPresetColorsDialogViewModel DialogVM = e.Parameters.GetValue<EditPresetColorsDialogViewModel>(ParameterNames.DataModel);
+                if (DialogVM != null)
+                {
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
 
-        #region 外观处理
 
         #endregion
 
-        #region 选项处理
+        #region 外部XAML触发事件
+
+        private void UpdataSelectResetColorBtn()
+        {
+            int result = 0;
+            if (UpdataSelectResetColor(ResetColorOne))
+            {
+                result = 1;
+            }
+            else if (UpdataSelectResetColor(ResetColorTwo))
+            {
+                result = 2;
+            }
+            else if (UpdataSelectResetColor(ResetColorThree))
+            {
+                result = 3;
+            }
+            else if (UpdataSelectResetColor(ResetColorForth))
+            {
+                result = 4;
+            }
+
+            SelectResetColorBtnHandler?.Invoke(null, result);
+        }
 
+        private bool UpdataSelectResetColor(ResetColor reset)
+        {
+            if (reset.FillColor.Color == FillColor &&
+                reset.FontColor.Color == ContentColor &&
+                reset.BorderColor.Color == BorderColor
+                )
+            {
+                return true;
+            }
+
+            return false;
+        }
         #endregion
 
         #region Navegation
@@ -94,26 +239,28 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             checkBoxArgs = null;
+            isCreateWidget = false;
+            IsCurrentWidget = false;
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
             navigationContext.Parameters.TryGetValue<WidgetCheckBoxArgs>("WidgetArgs", out checkBoxArgs);
 
             GetWidgeText();
+            UpdataSelectResetColorBtn();
         }
 
         private void GetWidgeText()
         {
-           
+
             if (checkBoxArgs == null)
             {
                 PDFViewer.SetMouseMode(MouseModes.FormEditTool);
                 checkBoxArgs = new WidgetCheckBoxArgs();
                 WidgetCheckBoxArgs args = new WidgetCheckBoxArgs();
-
-                args.FieldName = "CheckBox1";
                 args.CheckStyle = C_CHECK_STYLE.CK_CHECK;
                 args.BorderStyle = C_BORDER_STYLE.BS_SOLID;
                 args.LineColor = Colors.Black;
@@ -121,56 +268,47 @@ namespace PDF_Office.ViewModels.Form
                 args.LineWidth = 1;
                 checkBoxArgs = args;
                 PDFViewer.SetToolParam(checkBoxArgs);
+                isCreateWidget = true;
             }
             else
             {
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
+                isCreateWidget = false;
             }
 
+            GetProperty();
+
+            IsCurrentWidget = true;
         }
 
-        //更改基类公共属性后,触发的事件
-        private void ChangeValue(object sender, FormAttributeType e)
+        private void GetProperty()
         {
-            switch (e)
+            if (checkBoxArgs != null)
             {
-                case FormAttributeType.Name:
-                    break;
-
-                case FormAttributeType.ToolTip:
-
-                    break;
-
-                case FormAttributeType.IsSolid:
-                    break;
-
-                case FormAttributeType.IsLocked:
-                    break;
-
-                case FormAttributeType.HeightSize:
-                    break;
-
-                case FormAttributeType.BorderThiness:
-                    break;
-
-                case FormAttributeType.BorderColor:
-                    break;
-
-                case FormAttributeType.ContentColor:
-                    break;
-
-                case FormAttributeType.IsReadOnly:
-                    break;
-
-                case FormAttributeType.WidthSize:
-                    break;
-
-                case FormAttributeType.IsRequiredField:
-                    break;
-
+                IsLocked = checkBoxArgs.Locked;
+                FieldName = checkBoxArgs.FieldName;
+                ToolTipStr = checkBoxArgs.Tooltip;
+                IsReadOnly = checkBoxArgs.ReadOnly;
+                IsRequiredField = checkBoxArgs.IsRequired;
+
+                FillColor = checkBoxArgs.BgColor;
+                ContentColor = checkBoxArgs.FontColor;
+                BorderColor = checkBoxArgs.LineColor;
+                BorderThiness = checkBoxArgs.LineWidth;
+                BorderStyle = checkBoxArgs.BorderStyle;
+                ExportedValues = checkBoxArgs.ExportValue;
+                //避免BorderStyle跟上一个值相同,而没触发更改IsSolid属性
+                if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
+                    IsSolid = true;
+                else
+                    IsSolid = false;
+     
+                IsDefaultCheckBox = checkBoxArgs.IsChecked;
             }
-
         }
+
+     
+
         #endregion
     }
 }

+ 456 - 69
PDF Office/ViewModels/Form/ComboxPropertyViewModel.cs

@@ -1,47 +1,62 @@
-using ComPDFKitViewer.AnnotEvent;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl.CompositeControl;
+using PDF_Office.Helper;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
 using System.Windows.Media;
 
 namespace PDF_Office.ViewModels.Form
 {
     public class ComboxPropertyViewModel : FormBaseVM, INavigationAware
     {
-        #region 属性
+        #region Command变量
+        public DelegateCommand<string> FieldNameTextChangedCommand { get; set; }
+        public DelegateCommand<string> ToolTipTextChangedCommand { get; set; }
 
-        #region 选项
-        //排序项目
-        private bool _isSortProject = false;
-        public bool IsSortProject
-        {
-            get { return _isSortProject; }
-            set { SetProperty(ref _isSortProject, value); }
-        }
-        //允许用户输入自定义文本
-        private bool _isAllowInOutText = false;
-        public bool IsAllowInOutText
-        {
-            get { return _isAllowInOutText; }
-            set { SetProperty(ref _isAllowInOutText, value); }
-        }
-        #endregion
+        //外观
 
-        #endregion
+        public DelegateCommand<object> ResetColorCommand { get; set; }
+        public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
+
+        public DelegateCommand<string> FormContentTextChangedCommand { get; set; }
 
-        #region Command
+        public DelegateCommand<object> LineStyleCommand { get; set; }
+        //选项
+        public DelegateCommand<object> AddOptionCommand { get; set; }
+        public DelegateCommand<object> RemoveOptionCommand { get; set; }
+        public DelegateCommand<object> UpItemOptionCommand { get; set; }
+        public DelegateCommand<object> DownItemOptionCommand { get; set; }
+        public DelegateCommand<string> OptionKeyTextChangedCommand { get; set; }
 
+        public DelegateCommand<string> OptionKeyValueTextChangedCommand { get; set; }
+        public DelegateCommand<object> OptionSelectionChangedCommand { get; set; }
+        
         #endregion
 
         #region 变量
         private CPDFViewer PDFViewer;
         private WidgetComboBoxArgs comboBoxArgs;
+        private IDialogService dialogs;
+        public event EventHandler<int> SelectResetColorBtnHandler;
+        public List<ComboDataItem> FontFamilyItems { get; private set; }
+        public List<ComboDataItem> FontStyleItems { get; private set; }
+        public List<ComboDataItem> AglinmentItems { get; private set; }
+        public ObservableCollection<ComboDataItem> OptionItems { get; private set; }
+
         #endregion
 
         #region 初始化
@@ -53,28 +68,379 @@ namespace PDF_Office.ViewModels.Form
 
         private void InitVariable()
         {
+            InitAllResetColor();
+            InitFontFamilyComboBox();
+            InitFontStyleComboBox();
+            InitAglinmentItemsComboBox();
+            InitOptionItems();
+        }
+
+        private void InitOptionItems()
+        {
+            OptionItems = new ObservableCollection<ComboDataItem>();
+            OptionItems.CollectionChanged -= OptionItems_CollectionChanged;
+            OptionItems.CollectionChanged += OptionItems_CollectionChanged;
+        }
+
+        private void OptionItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+        {
+           if(OptionItems.Count == 0)
+                IsRemoveOption = false;
+        }
+
+        private void InitAllResetColor()
+        {
+            ResetColorOne = InitResetColor(Colors.Transparent, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorTwo = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorThree = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorForth = InitResetColor(Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Colors.Transparent);
+        }
+
+        private void InitFontFamilyComboBox()
+        {
+            FontFamilyItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Courier", "Courier New");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Helvetica", "Helvetica");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Times", "Times New Roman");
+            FontFamilyItems.Add(item);
+        }
+
+        private void InitFontStyleComboBox()
+        {
+            FontStyleItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Regular", "Regular");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Bold", "Bold");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Italic", "Italic");
+            FontStyleItems.Add(item);
+
+            item = new ComboDataItem("Bold Italic", "Bold Italic");
+            FontStyleItems.Add(item);
+        }
 
+        private void InitAglinmentItemsComboBox()
+        {
+            AglinmentItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Left", "Left");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Center", "Center");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Right", "Right");
+            AglinmentItems.Add(item);
         }
 
         private void InitCommand()
         {
-            ChangeValueHandler -= ChangeValue;
-            ChangeValueHandler += ChangeValue;
+            //一般
+            FieldNameTextChangedCommand = new DelegateCommand<string>(FieldNameTextChanged);
+            ToolTipTextChangedCommand = new DelegateCommand<string>(ToolTipTextChanged);
+            //外观
+            ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
+            ResetColorCommand = new DelegateCommand<object>(ResetColorEvent);
+            LineStyleCommand = new DelegateCommand<object>(LineStyleBtnEvent);
+
+            //选项
+            FormContentTextChangedCommand = new DelegateCommand<string>(FormContentTextChanged);
+            AddOptionCommand = new DelegateCommand<object>(AddOption);
+            RemoveOptionCommand = new DelegateCommand<object>(RemoveOption);
+            UpItemOptionCommand = new DelegateCommand<object>(UpItemOption);
+            DownItemOptionCommand = new DelegateCommand<object>(DownItemOption);
+            OptionKeyTextChangedCommand = new DelegateCommand<string>(OptionKeyTextChanged);
+            OptionKeyValueTextChangedCommand = new DelegateCommand<string>(OptionKeyValueTextChanged);
+            OptionSelectionChangedCommand = new DelegateCommand<object>(OptionSelectionChanged);
         }
 
         #endregion
 
 
-        #region 一般处理
+        #region 事件
 
-        #endregion
 
-        #region 外观处理
+        private void FieldNameTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                FieldName = obj;
+
+            }
+        }
+
+        private void ToolTipTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                ToolTipStr = obj;
+            }
+        }
+
+
+        private void LineStyleBtnEvent(object obj)
+        {
+            if (obj != null)
+            {
+                switch ((string)obj)
+                {
+                    case "Solid":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
+                        break;
+                    case "Dotted":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
+                        break;
+                }
+            }
+        }
+
+
+        private void FormContentTextChanged(string obj)
+        {
+            if (obj != null && IsCurrentWidget == true)
+            {
+                FormContent = obj;
+            }
+        }
+
+        private void OptionKeyValueTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                OptionKeyValue = obj;
+            }
+            UpdateIsInputOption();
+        }
+
+        private void OptionKeyTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                OptionKey = obj;
+            }
+
+            UpdateIsInputOption();
+        }
+
+        private void OptionSelectionChanged(object obj)
+        {
+            if(obj != null && obj is int == true)
+            {
+                UpdateAllOptionBtn((int)obj);
+            }
+
+        }
+
+        //刷新所有Option有关的按钮状态
+        private void UpdateAllOptionBtn(int SelectedIndex)
+        {
+            var count = OptionItems.Count;
+            if (SelectedIndex <= -1)
+            {
+                IsDownOption = false;
+                IsUpOption = false;
+                IsRemoveOption = false;
+            }
+            else
+            {
+                IsRemoveOption = true;
+                IsUpOption = SelectedIndex == 0 ? false : true;
+                IsDownOption = (SelectedIndex == count - 1)?false:true;
+            }
+            OptionSelectedIndex = SelectedIndex;
+        }
+
+        //Option是否可输入内容
+        private void UpdateIsInputOption()
+        {
+            if (string.IsNullOrEmpty(OptionKeyValue) || string.IsNullOrEmpty(OptionKey))
+            {
+                IsInputOption = false;
+            }
+            else
+            {
+                foreach (var item in OptionItems)
+                {
+                    if (item.ValueStr == OptionKeyValue || item.Content == OptionKey)
+                    {
+                        IsInputOption = false;
+                        return;
+                    }
+                }
+
+                IsInputOption = true;
+            }
+        }
+        //新增Option项
+        private void AddOption(object obj)
+        {
+
+            if (string.IsNullOrEmpty(OptionKey) || string.IsNullOrEmpty(OptionKeyValue))
+                return;
+
+            var item = new ComboDataItem(OptionKeyValue,OptionKey);
+            OptionItems.Add(item);
+            OptionsList[item.Content] = item.ValueStr;
+            ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+            OptionKey = "";
+            OptionKeyValue = "";
+            UpdateAllOptionBtn(OptionSelectedIndex);
+        }
+        //移除Option项
+        private void RemoveOption(object obj)
+        {
+            if(obj != null)
+            {
+                var item = (ComboDataItem)obj;
+                OptionsList.Remove(item.Content);
+                OptionItems.Remove(item);
+                ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                UpdateAllOptionBtn(-1);
+            }
+        }
+        //向下移项
+        private void DownItemOption(object obj)
+        {
+            if(obj != null)
+            {
+                var item = (ComboDataItem)obj;
+               var index =  OptionItems.IndexOf(item);
+                if(index < OptionItems.Count - 1)
+                {
+                    OptionItems.Move(index, index + 1);
+                    UpdateAllOptionBtn(index + 1);
+                    OptionsList.Clear();
+                    foreach(var itemOption in OptionItems)
+                    {
+                        OptionsList[itemOption.Content] = itemOption.ValueStr;
+                    }
+                    ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                }
+            }
+        }
+        //向上移项
+        private void UpItemOption(object obj)
+        {
+            if (obj != null)
+            {
+                var item = (ComboDataItem)obj;
+                var index = OptionItems.IndexOf(item);
+                if (index > 0)
+                {
+                    OptionItems.Move(index, index - 1);
+                    UpdateAllOptionBtn(index - 1);
+                    OptionsList.Clear();
+                    foreach (var itemOption in OptionItems)
+                    {
+                        OptionsList[itemOption.Content] = itemOption.ValueStr;
+                    }
+                    ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                }
+            }
+        }
+
+
+        private void ResetColorCheckedBtn(object obj)
+        {
+            if (obj != null)
+            {
+                var str = obj as string;
+                if (str != null)
+                {
+                    switch (str)
+                    {
+                        case "One":
+                            BorderColor = ResetColorOne.BorderColor.Color;
+                            ContentColor = ResetColorOne.FontColor.Color;
+                            FillColor = ResetColorOne.FillColor.Color;
+                            break;
+
+                        case "Two":
+                            BorderColor = ResetColorTwo.BorderColor.Color;
+                            ContentColor = ResetColorTwo.FontColor.Color;
+                            FillColor = ResetColorTwo.FillColor.Color;
+                            break;
+
+                        case "Three":
+                            BorderColor = ResetColorThree.BorderColor.Color;
+                            ContentColor = ResetColorThree.FontColor.Color;
+                            FillColor = ResetColorThree.FillColor.Color;
+                            break;
+
+                        case "Forth":
+                            BorderColor = ResetColorForth.BorderColor.Color;
+                            ContentColor = ResetColorForth.FontColor.Color;
+                            FillColor = ResetColorForth.FillColor.Color;
+                            break;
+                    }
+                }
+            }
+        }
+
+        private void ResetColorEvent(object obj)
+        {
+            bool result = true;
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.PDFViewer, PDFViewer);
+            dialogs.ShowDialog(DialogNames.EditPresetColorsDialog, value, e =>
+            {
+                if (e.Result != ButtonResult.OK)
+                {
+                    result = false;
+                }
+                EditPresetColorsDialogViewModel DialogVM = e.Parameters.GetValue<EditPresetColorsDialogViewModel>(ParameterNames.DataModel);
+                if (DialogVM != null)
+                {
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
+
 
         #endregion
 
-        #region 选项处理
+        #region 外部XAML触发事件
 
+        private void UpdataSelectResetColorBtn()
+        {
+            int result = 0;
+            if (UpdataSelectResetColor(ResetColorOne))
+            {
+                result = 1;
+            }
+            else if (UpdataSelectResetColor(ResetColorTwo))
+            {
+                result = 2;
+            }
+            else if (UpdataSelectResetColor(ResetColorThree))
+            {
+                result = 3;
+            }
+            else if (UpdataSelectResetColor(ResetColorForth))
+            {
+                result = 4;
+            }
+
+            SelectResetColorBtnHandler?.Invoke(null, result);
+        }
+
+        private bool UpdataSelectResetColor(ResetColor reset)
+        {
+            if (reset.FillColor.Color == FillColor &&
+                reset.FontColor.Color == ContentColor &&
+                reset.BorderColor.Color == BorderColor
+                )
+            {
+                return true;
+            }
+
+            return false;
+        }
         #endregion
 
         #region Navegation
@@ -86,22 +452,25 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             comboBoxArgs = null;
+            ClearVMData();
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<WidgetComboBoxArgs>("WidgetArgs", out comboBoxArgs);
-
+            navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
+            OptionsList = new Dictionary<string, string>();
             GetWidgeText();
+            UpdataSelectResetColorBtn();
         }
 
         private void GetWidgeText()
         {
-            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
-
+            
             if (comboBoxArgs == null)
             {
+                PDFViewer.SetMouseMode(MouseModes.FormEditTool);
                 comboBoxArgs = new WidgetComboBoxArgs();
                 comboBoxArgs.BgColor = Colors.White;
                 comboBoxArgs.FontFamily = "Courier New";
@@ -111,57 +480,75 @@ namespace PDF_Office.ViewModels.Form
                 comboBoxArgs.LineWidth = 1;
                 comboBoxArgs.FieldName = "ComBox";
                 PDFViewer.SetToolParam(comboBoxArgs);
+                isCreateWidget = true;
             }
             else
             {
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
+                isCreateWidget = false;
             }
 
-            
-           
-        }
-
-        //更改基类公共属性后,触发的事件
-        private void ChangeValue(object sender, FormAttributeType e)
-        {
-            switch (e)
-            {
-                case FormAttributeType.Name:
-                    break;
-
-                case FormAttributeType.ToolTip:
-
-                    break;
-
-                case FormAttributeType.IsSolid:
-                    break;
 
-                case FormAttributeType.IsLocked:
-                    break;
+            GetProperty();
 
-                case FormAttributeType.HeightSize:
-                    break;
-
-                case FormAttributeType.BorderThiness:
-                    break;
-
-                case FormAttributeType.BorderColor:
-                    break;
-
-                case FormAttributeType.ContentColor:
-                    break;
-
-                case FormAttributeType.IsReadOnly:
-                    break;
-
-                case FormAttributeType.WidthSize:
-                    break;
+            IsCurrentWidget = true;
+        }
 
-                case FormAttributeType.IsRequiredField:
-                    break;
 
+        private void GetProperty()
+        {
+            if (comboBoxArgs != null)
+            {
+                IsLocked = comboBoxArgs.Locked;
+                FieldName = comboBoxArgs.FieldName;
+                ToolTipStr = comboBoxArgs.Tooltip;
+                IsReadOnly = comboBoxArgs.ReadOnly;
+
+                FillColor = comboBoxArgs.BgColor;
+                ContentColor = comboBoxArgs.FontColor;
+                BorderColor = comboBoxArgs.LineColor;
+                BorderThiness = comboBoxArgs.LineWidth;
+                BorderStyle = comboBoxArgs.BorderStyle;
+
+                string fontWeightStyleStr = "";
+                if (comboBoxArgs.FontStyle == FontStyles.Normal)
+                {
+                    if (comboBoxArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Regular";
+                    else
+                        fontWeightStyleStr = "Bold";
+                }
+                else
+                {
+                    if (comboBoxArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Italic";
+                    else
+                        fontWeightStyleStr = "Bold Italic";
+                }
+                FontWeightStyleItem = new ComboDataItem(fontWeightStyleStr);
+
+                FontFamilyData = new ComboDataItem(comboBoxArgs.FontFamily);
+                //避免BorderStyle跟上一个值相同,而没触发更改IsSolid属性
+                if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
+                    IsSolid = true;
+                else
+                    IsSolid = false;
+
+                FontSizeData = new ComboDataItem(comboBoxArgs.FontSize);
+                if (isCreateWidget == false)
+                {
+                    HeightSize = comboBoxArgs.Height;
+                    WidthSize = comboBoxArgs.Width;
+                }
+                OptionsList = comboBoxArgs.ListOptions;
+                OptionItems.Clear();
+                foreach (string key in OptionsList.Keys)
+                {
+                    var item = new ComboDataItem(OptionsList[key], key);
+                    OptionItems.Add(item);
+                }
+                
             }
-
         }
         #endregion
     }

+ 357 - 91
PDF Office/ViewModels/Form/FormBaseVM.cs

@@ -1,75 +1,50 @@
-using Prism.Mvvm;
+using ComPDFKitViewer;
+using PDF_Office.Model.From;
+using Prism.Mvvm;
 using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Media;
+using System.Windows;
+using PDF_Office.CustomControl.CompositeControl;
+using ComPDFKit.PDFAnnotation;
+using PDF_Office.Helper;
 
 namespace PDF_Office.ViewModels.Form
 {
-    public enum FormAttributeType
-    {
-        Name,
-        ToolTip,
-        IsReadOnly,
-        IsRequiredField,
-        IsLocked,
-        //外观
-        BorderThiness,
-        IsSolid,
-        WidthSize,
-        HeightSize,
-        BorderColor,
-        ContentColor,
-        FillColor,
-        FontFamily
-    }
-    public class ResetColor : BindableBase
-    {
-        private SolidColorBrush _borderColor;
-        public SolidColorBrush BorderColor
-        {
-            get { return _borderColor; }
-            set { SetProperty(ref _borderColor, value); }
-        }
-
-        private SolidColorBrush _fontColor;
-        public SolidColorBrush FontColor
-        {
-            get { return _fontColor; }
-            set { SetProperty(ref _fontColor, value); }
-        }
 
-
-        private SolidColorBrush _fillColor;
-        public SolidColorBrush FillColor
-        {
-            get { return _fillColor; }
-            set { SetProperty(ref _fillColor, value); }
-        }
-    }
     public class FormBaseVM : BindableBase
     {
-        #region 触发事件
-        public event EventHandler<FormAttributeType> ChangeValueHandler;
+        #region 变量
+        public UpdateAttributeHelper AttribEvent;
+        public bool IsCurrentWidget = false;
+        public bool isCreateWidget = false;
         #endregion
-
         #region 一般
+        //名称
+        private string _fieldName;
+        public string FieldName
+        {
+            get { return _fieldName; }
+            set { SetProperty(ref _fieldName, value); ChangeValue(AnnotAttrib.FieldName, value); }
+        }
+
         //提示
         private string _toolTipStr;
         public string ToolTipStr
         {
             get { return _toolTipStr; }
-            set { SetProperty(ref _toolTipStr, value); ChangeValueHandler?.Invoke(value, FormAttributeType.ToolTip); }
+            set { SetProperty(ref _toolTipStr, value); ChangeValue(AnnotAttrib.Tooltip, value); }
         }
 
-        //名称
-        private string _nameStr;
-        public string NameStr
+        //表单域
+        private FormFieldType _formField;
+        public FormFieldType FormField
         {
-            get { return _nameStr; }
-            set { SetProperty(ref _nameStr, value); ChangeValueHandler?.Invoke(value, FormAttributeType.Name); }
+            get { return _formField; }
+            set { SetProperty(ref _formField, value); ChangeValue(AnnotAttrib.FormField, value); }
         }
 
         //只读
@@ -77,7 +52,7 @@ namespace PDF_Office.ViewModels.Form
         public bool IsReadOnly
         {
             get { return _isReadOnly; }
-            set { SetProperty(ref _isReadOnly, value); ChangeValueHandler?.Invoke(value, FormAttributeType.IsReadOnly); }
+            set { SetProperty(ref _isReadOnly, value); ChangeValue(AnnotAttrib.ReadOnly, value); }
         }
 
         //必填
@@ -85,7 +60,7 @@ namespace PDF_Office.ViewModels.Form
         public bool IsRequiredField
         {
             get { return _isRequiredField; }
-            set { SetProperty(ref _isRequiredField, value); ChangeValueHandler?.Invoke(value, FormAttributeType.IsRequiredField); }
+            set { SetProperty(ref _isRequiredField, value); ChangeValue(AnnotAttrib.IsRequired, value); }
         }
 
         //锁定
@@ -93,18 +68,75 @@ namespace PDF_Office.ViewModels.Form
         public bool IsLocked
         {
             get { return _isLocked; }
-            set { SetProperty(ref _isLocked, value); ChangeValueHandler?.Invoke(value, FormAttributeType.IsLocked); }
+            set { SetProperty(ref _isLocked, value); ChangeValue(AnnotAttrib.Locked, value); }
         }
 
         #endregion
 
         #region 外观
+
+        #region 四个选项:颜色样式
+
+        private ResetColor _resetColorOne = new ResetColor();
+        public ResetColor ResetColorOne
+        {
+            get { return _resetColorOne; }
+            set { SetProperty(ref _resetColorOne, value); }
+        }
+
+        private ResetColor _resetColorTwo = new ResetColor();
+        public ResetColor ResetColorTwo
+        {
+            get { return _resetColorTwo; }
+            set { SetProperty(ref _resetColorTwo, value); }
+        }
+
+        private ResetColor _resetColorThree = new ResetColor();
+        public ResetColor ResetColorThree
+        {
+            get { return _resetColorThree; }
+            set { SetProperty(ref _resetColorThree, value); }
+        }
+
+        private ResetColor _resetColorForth = new ResetColor();
+        public ResetColor ResetColorForth
+        {
+            get { return _resetColorForth; }
+            set { SetProperty(ref _resetColorForth, value); }
+        }
+
+        #endregion
+
+        //边框颜色
+        private Color _borderColor = Colors.Transparent;
+        public Color BorderColor
+        {
+            get { return _borderColor; }
+            set { SetProperty(ref _borderColor, value); ChangeValue(AnnotAttrib.Color, value); }
+        }
+
+        //内容颜色
+        private Color _contentColor = Colors.Transparent;
+        public Color ContentColor
+        {
+            get { return _contentColor; }
+            set { SetProperty(ref _contentColor, value); ChangeValue(AnnotAttrib.FontColor, value); }
+        }
+
+        //填充颜色
+        private Color _fillColor = Colors.Transparent;
+        public Color FillColor
+        {
+            get { return _fillColor; }
+            set { SetProperty(ref _fillColor, value); ChangeValue(AnnotAttrib.FillColor, value); }
+        }
+
         //边框大小
         private double _borderThiness = 0;
         public double BorderThiness
         {
             get { return _borderThiness; }
-            set { SetProperty(ref _borderThiness, value); ChangeValueHandler?.Invoke(value, FormAttributeType.BorderThiness); }
+            set { SetProperty(ref _borderThiness, value); ChangeValue(AnnotAttrib.Thickness, value); }
         }
 
         //是否为实线条
@@ -115,7 +147,7 @@ namespace PDF_Office.ViewModels.Form
             set { SetProperty(ref _isSolid, value);  }
         }
 
-        //是否为实线条
+        //线条样式
         private ComPDFKit.PDFAnnotation.C_BORDER_STYLE _borderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
         public ComPDFKit.PDFAnnotation.C_BORDER_STYLE BorderStyle
         {
@@ -127,7 +159,78 @@ namespace PDF_Office.ViewModels.Form
                 else
                     IsSolid = false;
 
-                ChangeValueHandler?.Invoke(value, FormAttributeType.IsSolid); }
+                ChangeValue(AnnotAttrib.LineStyle, value);
+            }
+        }
+
+
+        private ComboDataItem _fontFamilyData;
+        public ComboDataItem FontFamilyData
+        {
+            get { return _fontFamilyData; }
+            set
+            {
+                SetProperty(ref _fontFamilyData, value);
+                ChangeValue(AnnotAttrib.FontFamily, _fontFamilyData.ValueStr);
+            }
+        }
+
+
+        private FontStyle _fontStyle;
+        public FontStyle FontStyleItem
+        {
+            get { return _fontStyle; }
+            set { SetProperty(ref _fontStyle, value); ChangeValue(AnnotAttrib.FontStyle, value); }
+        }
+
+        private FontWeight _fontWeight;
+        public FontWeight FontWeightItem
+        {
+            get { return _fontWeight; }
+            set { SetProperty(ref _fontWeight, value); ChangeValue(AnnotAttrib.FontWeight, value); }
+        }
+
+        private ComboDataItem _fontWeightStyleItem;
+        public ComboDataItem FontWeightStyleItem
+        {
+            get { return _fontWeightStyleItem; }
+            set { SetProperty(ref _fontWeightStyleItem, value);
+                if (_fontWeightStyleItem.ValueStr != null && string.IsNullOrEmpty((string)_fontWeightStyleItem.ValueStr) == false)
+                {
+                    switch ((string)_fontWeightStyleItem.ValueStr)
+                    {
+                        case "Regular":
+                            FontStyleItem = FontStyles.Normal;
+                            FontWeightItem = FontWeights.Normal;
+                            break;
+
+                        case "Bold":
+                            FontStyleItem = FontStyles.Normal;
+                            FontWeightItem = FontWeights.Bold;
+                            break;
+
+                        case "Italic":
+                            FontStyleItem = FontStyles.Italic;
+                            FontWeightItem = FontWeights.Normal;
+                            break;
+
+                        case "Bold Italic":
+                            FontStyleItem = FontStyles.Italic;
+                            FontWeightItem = FontWeights.Bold;
+                            break;
+                    }
+
+                }
+            }
+        }
+
+        private ComboDataItem _fontSizeData = new ComboDataItem(6);
+        public ComboDataItem FontSizeData
+        {
+            get { return _fontSizeData; }
+            set { SetProperty(ref _fontSizeData, value);
+                if(_fontSizeData != null)
+                ChangeValue(AnnotAttrib.FontSize, (int)_fontSizeData.Value); }
         }
 
         //宽大小
@@ -135,7 +238,7 @@ namespace PDF_Office.ViewModels.Form
         public double WidthSize
         {
             get { return _widthSize; }
-            set { SetProperty(ref _widthSize, value); ChangeValueHandler?.Invoke(value, FormAttributeType.WidthSize); }
+            set { SetProperty(ref _widthSize, value); ChangeValue(AnnotAttrib.Width, value); }
         }
 
         //高大小
@@ -143,67 +246,230 @@ namespace PDF_Office.ViewModels.Form
         public double HeightSize
         {
             get { return _heightSize; }
-            set { SetProperty(ref _heightSize, value); ChangeValueHandler?.Invoke(value, FormAttributeType.HeightSize); }
+            set { SetProperty(ref _heightSize, value); ChangeValue(AnnotAttrib.Height, value); }
         }
 
-        //边框颜色
-        private Color _borderColor = Colors.Transparent;
-        public Color BorderColor
+
+
+        #endregion
+
+        #region 选项
+
+
+        private C_TEXT_ALIGNMENT _textAlignment;
+        public C_TEXT_ALIGNMENT TextAlignmentItem
         {
-            get { return _borderColor; }
-            set { SetProperty(ref _borderColor, value); ChangeValueHandler?.Invoke(value, FormAttributeType.BorderColor); }
+            get { return _textAlignment; }
+            set { SetProperty(ref _textAlignment, value); ChangeValue(AnnotAttrib.TextAlign, value); }
         }
 
+        private ComboDataItem _fextAlignmentData = new ComboDataItem("Left", "Left");
+        public ComboDataItem TextAlignmentData
+        {
+            get { return _fextAlignmentData; }
+            set
+            {
+                SetProperty(ref _fextAlignmentData, value);
+                if (_fextAlignmentData != null && string.IsNullOrEmpty(_fextAlignmentData.ValueStr) == false)
+                {
+                    switch(_fextAlignmentData.ValueStr)
+                    {
+                        case "Left":
+                            TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_LEFT;
+                            break;
+                        case "Center":
+                            TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_CENTER;
+                            break;
+                        case "Right":
+                            TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_RIGHT;
+                            break;
+                    }
+                }
+                   
+            }
+        }
 
-        //内容颜色
-        private Color _contentColor = Colors.Transparent;
-        public Color ContentColor
+        //内容
+        private string _content;
+        public string FormContent
         {
-            get { return _contentColor; }
-            set { SetProperty(ref _contentColor, value); ChangeValueHandler?.Invoke(value, FormAttributeType.ContentColor); }
+            get { return _content; }
+            set { SetProperty(ref _content, value); ChangeValue(AnnotAttrib.Text, value); }
         }
 
-        //填充颜色
-        private Color _fillColor = Colors.Transparent;
-        public Color FillColor
+        //默认值
+        private string _defaultValue;
+        public string DefaultValue
         {
-            get { return _fillColor; }
-            set { SetProperty(ref _fillColor, value); ChangeValueHandler?.Invoke(value, FormAttributeType.FillColor); }
+            get { return _defaultValue; }
+            set { SetProperty(ref _defaultValue, value); }
         }
 
-        #endregion
+        //多行
+        private bool _isMultiline = false;
+        public bool IsMultiLine
+        {
+            get { return _isMultiline; }
+            set { SetProperty(ref _isMultiline, value); ChangeValue(AnnotAttrib.IsMutilLine, value); }
+        }
 
-        #region 颜色样式
+        //滚动显示长文本
+        private bool _isScrollText = false;
+        public bool IsScrollText
+        {
+            get { return _isScrollText; }
+            set { SetProperty(ref _isScrollText, value); ChangeValue(AnnotAttrib.ScrollFlag, value); }
+        }
+        //下拉框Form,
+        private bool _isDefaultCheckBox = false;
+        public bool IsDefaultCheckBox
+        {
+            get { return _isDefaultCheckBox; }
+            set { SetProperty(ref _isDefaultCheckBox, value); ChangeValue(AnnotAttrib.IsChecked, value); }
+        }
 
-        private ResetColor _resetColorOne = new ResetColor();
-        public ResetColor ResetColorOne
+        //复选框的导出值
+        private string _exportedValues;
+        public string ExportedValues
         {
-            get { return _resetColorOne; }
-            set { SetProperty(ref _resetColorOne, value); }
+            get { return _exportedValues; }
+            set { SetProperty(ref _exportedValues, value); ChangeValue(AnnotAttrib.ExportValue, value); }
         }
 
-        private ResetColor _resetColorTwo = new ResetColor();
-        public ResetColor ResetColorTwo
+        //单选框Form,
+        private bool _isDefaultRadioBox = false;
+        public bool IsDefaultRadioBox
         {
-            get { return _resetColorTwo; }
-            set { SetProperty(ref _resetColorTwo, value); }
+            get { return _isDefaultRadioBox; }
+            set { SetProperty(ref _isDefaultRadioBox, value); ChangeValue(AnnotAttrib.IsChecked, value); }
         }
 
-        private ResetColor _resetColorThree = new ResetColor();
-        public ResetColor ResetColorThree
+        //复选框的导出值
+        private string _radioMemberName;
+        public string RadioMemberName
         {
-            get { return _resetColorThree; }
-            set { SetProperty(ref _resetColorThree, value); }
+            get { return _radioMemberName; }
+            set { SetProperty(ref _radioMemberName, value); ChangeValue(AnnotAttrib.RadioMemberName, value); }
         }
 
-        private ResetColor _resetColorForth = new ResetColor();
-        public ResetColor ResetColorForth
+        //Option
+        //是否可以输入内容
+        private bool _isInputOption = false;
+        public bool IsInputOption
         {
-            get { return _resetColorForth; }
-            set { SetProperty(ref _resetColorForth, value); }
+            get { return _isInputOption; }
+            set { SetProperty(ref _isInputOption, value); }
+        }
+
+        private bool _isUpOption = false;
+        public bool IsUpOption
+        {
+            get { return _isUpOption; }
+            set{ SetProperty(ref _isUpOption, value);  }
+        }
+
+        private bool _isDownOption = false;
+        public bool IsDownOption
+        {
+            get { return _isDownOption; }
+            set { SetProperty(ref _isDownOption, value); }
+        }
+
+        private bool _isRemoveOption = false;
+        public bool IsRemoveOption
+        {
+            get { return _isRemoveOption; }
+            set { SetProperty(ref _isRemoveOption, value); }
+        }
+
+        public int OptionSelectedIndex = -1;
+
+        private string _optionKey;
+        public string OptionKey
+        {
+            get { return _optionKey; }
+            set { SetProperty(ref _optionKey, value); }
+        }
+
+        private string _optionKeyValue;
+        public string OptionKeyValue
+        {
+            get { return _optionKeyValue; }
+            set { SetProperty(ref _optionKeyValue, value); }
+        }
+
+        private Dictionary<string, string> _optionsList;
+        public Dictionary<string, string> OptionsList
+        {
+            get { return _optionsList; }
+            set { SetProperty(ref _optionsList, value); }
         }
 
         #endregion
+
+        public void ChangeValue(AnnotAttrib annotAttrib,object obj)
+        {
+       
+            if(AttribEvent != null && IsCurrentWidget && AttribEvent.IsCreateForm() == false)
+            {
+                AttribEvent.UpdateAttrib(annotAttrib, obj);
+                AttribEvent.UpdateAnnot();
+            }
+        }
+
+        #region
+
+        public ResetColor InitResetColor(Color border, Color font, Color fill)
+        {
+            return new ResetColor()
+            {
+                BorderColor = new SolidColorBrush(border),
+                FontColor = new SolidColorBrush(font),
+                FillColor = new SolidColorBrush(fill)
+            };
+        }
+
+        //退出或切换属性面板,清除数据
+        public void ClearVMData()
+        {
+            isCreateWidget = false;
+            IsCurrentWidget = false;
+            OptionsList = null;
+            IsRemoveOption = false;
+            IsInputOption = false;
+            IsUpOption = false;
+            IsDownOption = false;
+            OptionSelectedIndex = -1;
+            OptionKey = "";
+            OptionKeyValue = "";
+        }
+        #endregion
+    }
+
+
+    public class ResetColor : BindableBase
+    {
+        private SolidColorBrush _borderColor;
+        public SolidColorBrush BorderColor
+        {
+            get { return _borderColor; }
+            set { SetProperty(ref _borderColor, value); }
+        }
+
+        private SolidColorBrush _fontColor;
+        public SolidColorBrush FontColor
+        {
+            get { return _fontColor; }
+            set { SetProperty(ref _fontColor, value); }
+        }
+
+
+        private SolidColorBrush _fillColor;
+        public SolidColorBrush FillColor
+        {
+            get { return _fillColor; }
+            set { SetProperty(ref _fillColor, value); }
+        }
     }
 
 }

+ 1 - 0
PDF Office/ViewModels/Form/FormsToolContentViewModel.cs

@@ -295,6 +295,7 @@ namespace PDF_Office.ViewModels.Form
         
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
+            UncheckedToolsBtnEvent?.Invoke(null, CurrentToolBtnType);
             CurrentToolBtnType = "";
         }
 

+ 447 - 93
PDF Office/ViewModels/Form/ListBoxPropertyViewModel.cs

@@ -1,14 +1,22 @@
-using ComPDFKitViewer.AnnotEvent;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl.CompositeControl;
 using PDF_Office.Helper;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
 using System.Windows.Media;
 
 namespace PDF_Office.ViewModels.Form
@@ -16,40 +24,42 @@ namespace PDF_Office.ViewModels.Form
 
     public class ListBoxPropertyViewModel : FormBaseVM, INavigationAware
     {
-        #region 属性
+        #region Command变量
+        public DelegateCommand<string> FieldNameTextChangedCommand { get; set; }
+        public DelegateCommand<string> ToolTipTextChangedCommand { get; set; }
 
-        #region 选项
+        //外观
 
-        //排序项目
-        private bool _isSortProject = false;
-        public bool IsSortProject
-        {
-            get { return _isSortProject; }
-            set { SetProperty(ref _isSortProject, value); }
-        }
-
-        //多重选择的
-        private bool _multipleSelection = false;
-        public bool MultipleSelection
-        {
-            get { return _multipleSelection; }
-            set { SetProperty(ref _multipleSelection, value); }
-        }
+        public DelegateCommand<object> ResetColorCommand { get; set; }
+        public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
 
-        #endregion
-
-        #endregion
+        public DelegateCommand<string> FormContentTextChangedCommand { get; set; }
 
-        #region Command
+        public DelegateCommand<object> LineStyleCommand { get; set; }
+        //选项
+        public DelegateCommand<object> AddOptionCommand { get; set; }
+        public DelegateCommand<object> RemoveOptionCommand { get; set; }
+        public DelegateCommand<object> UpItemOptionCommand { get; set; }
+        public DelegateCommand<object> DownItemOptionCommand { get; set; }
+        public DelegateCommand<string> OptionKeyTextChangedCommand { get; set; }
 
+        public DelegateCommand<string> OptionKeyValueTextChangedCommand { get; set; }
+        public DelegateCommand<object> OptionSelectionChangedCommand { get; set; }
         #endregion
 
         #region 变量
         private CPDFViewer PDFViewer;
         private WidgetListBoxArgs listBoxArgs;
-        public UpdateAttributeHelper AttribEvent;
+        private IDialogService dialogs;
+        public event EventHandler<int> SelectResetColorBtnHandler;
+        public List<ComboDataItem> FontFamilyItems { get; private set; }
+        public List<ComboDataItem> FontStyleItems { get; private set; }
+        public List<ComboDataItem> AglinmentItems { get; private set; }
+        public ObservableCollection<ComboDataItem> OptionItems { get; private set; }
+
         #endregion
 
+
         #region 初始化
         public ListBoxPropertyViewModel()
         {
@@ -60,54 +70,380 @@ namespace PDF_Office.ViewModels.Form
         private void InitVariable()
         {
 
-            ResetColorOne = new ResetColor()
+            InitAllResetColor();
+            InitFontFamilyComboBox();
+            InitFontStyleComboBox();
+            InitAglinmentItemsComboBox();
+            InitOptionItems();
+        }
+
+        private void InitOptionItems()
+        {
+            OptionItems = new ObservableCollection<ComboDataItem>();
+            OptionItems.CollectionChanged -= OptionItems_CollectionChanged;
+            OptionItems.CollectionChanged += OptionItems_CollectionChanged;
+        }
+
+        private void OptionItems_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+        {
+            if (OptionItems.Count == 0)
+                IsRemoveOption = false;
+        }
+
+        private void InitAllResetColor()
+        {
+            ResetColorOne = InitResetColor(Colors.Transparent, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorTwo = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorThree = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorForth = InitResetColor(Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Colors.Transparent);
+        }
+
+        private void InitFontFamilyComboBox()
+        {
+            FontFamilyItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Courier", "Courier New");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Helvetica", "Helvetica");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Times Roman", "Times New Roman");
+            FontFamilyItems.Add(item);
+        }
+
+        private void InitFontStyleComboBox()
+        {
+            FontStyleItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Regular", "Regular");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Bold", "Bold");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Italic", "Italic");
+            FontStyleItems.Add(item);
+
+            item = new ComboDataItem("Bold Italic", "Bold Italic");
+            FontStyleItems.Add(item);
+        }
+
+        private void InitAglinmentItemsComboBox()
+        {
+            AglinmentItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Left", "Left");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Center", "Center");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Right", "Right");
+            AglinmentItems.Add(item);
+        }
+
+        private void InitCommand()
+        {
+            //一般
+            FieldNameTextChangedCommand = new DelegateCommand<string>(FieldNameTextChanged);
+            ToolTipTextChangedCommand = new DelegateCommand<string>(ToolTipTextChanged);
+            //外观
+            ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
+            ResetColorCommand = new DelegateCommand<object>(ResetColorEvent);
+            LineStyleCommand = new DelegateCommand<object>(LineStyleBtnEvent);
+
+            //选项
+            FormContentTextChangedCommand = new DelegateCommand<string>(FormContentTextChanged);
+            AddOptionCommand = new DelegateCommand<object>(AddOption);
+            RemoveOptionCommand = new DelegateCommand<object>(RemoveOption);
+            UpItemOptionCommand = new DelegateCommand<object>(UpItemOption);
+            DownItemOptionCommand = new DelegateCommand<object>(DownItemOption);
+            OptionKeyTextChangedCommand = new DelegateCommand<string>(OptionKeyTextChanged);
+            OptionKeyValueTextChangedCommand = new DelegateCommand<string>(OptionKeyValueTextChanged);
+            OptionSelectionChangedCommand = new DelegateCommand<object>(OptionSelectionChanged);
+        }
+
+        #endregion
+
+
+        #region 事件
+
+
+        private void FieldNameTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
             {
-                BorderColor = new SolidColorBrush(Colors.Transparent),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
-            };
+                FieldName = obj;
+
+            }
+        }
 
-            ResetColorTwo = new ResetColor()
+        private void ToolTipTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
             {
-                BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
-            };
+                ToolTipStr = obj;
+            }
+        }
 
-            ResetColorThree = new ResetColor()
+
+        private void LineStyleBtnEvent(object obj)
+        {
+            if (obj != null)
             {
-                BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xBD, 0xDF, 0xFD))
-            };
+                switch ((string)obj)
+                {
+                    case "Solid":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
+                        break;
+                    case "Dotted":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
+                        break;
+                }
+            }
+        }
 
-            ResetColorForth = new ResetColor()
+
+        private void FormContentTextChanged(string obj)
+        {
+            if (obj != null && IsCurrentWidget == true)
             {
-                BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Colors.Transparent)
-            };
+                FormContent = obj;
+            }
         }
 
-        private void InitCommand()
+
+        private void OptionKeyValueTextChanged(string obj)
         {
-            ChangeValueHandler -= ChangeValue;
-            ChangeValueHandler += ChangeValue;
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                OptionKeyValue = obj;
+            }
+            UpdateIsInputOption();
         }
 
-        #endregion
+        private void OptionKeyTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                OptionKey = obj;
+            }
 
+            UpdateIsInputOption();
+        }
 
-        #region 一般处理
+        private void OptionSelectionChanged(object obj)
+        {
+            if (obj != null && obj is int == true)
+            {
+                UpdateAllOptionBtn((int)obj);
+            }
 
-        #endregion
+        }
+
+        //刷新所有Option有关的按钮状态
+        private void UpdateAllOptionBtn(int SelectedIndex)
+        {
+            var count = OptionItems.Count;
+            if (SelectedIndex <= -1)
+            {
+                IsDownOption = false;
+                IsUpOption = false;
+                IsRemoveOption = false;
+            }
+            else
+            {
+                IsRemoveOption = true;
+                IsUpOption = SelectedIndex == 0 ? false : true;
+                IsDownOption = (SelectedIndex == count - 1) ? false : true;
+            }
+            OptionSelectedIndex = SelectedIndex;
+        }
+
+        //Option是否可输入内容
+        private void UpdateIsInputOption()
+        {
+            if (string.IsNullOrEmpty(OptionKeyValue) || string.IsNullOrEmpty(OptionKey))
+            {
+                IsInputOption = false;
+            }
+            else
+            {
+                foreach (var item in OptionItems)
+                {
+                    if (item.ValueStr == OptionKeyValue || item.Content == OptionKey)
+                    {
+                        IsInputOption = false;
+                        return;
+                    }
+                }
+
+                IsInputOption = true;
+            }
+        }
+        //新增Option项
+        private void AddOption(object obj)
+        {
+
+            if (string.IsNullOrEmpty(OptionKey) || string.IsNullOrEmpty(OptionKeyValue))
+                return;
+
+            var item = new ComboDataItem(OptionKeyValue, OptionKey);
+            OptionItems.Add(item);
+            OptionsList[item.Content] = item.ValueStr;
+            ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+            OptionKey = "";
+            OptionKeyValue = "";
+            UpdateAllOptionBtn(OptionSelectedIndex);
+        }
+        //移除Option项
+        private void RemoveOption(object obj)
+        {
+            if (obj != null)
+            {
+                var item = (ComboDataItem)obj;
+                OptionsList.Remove(item.Content);
+                OptionItems.Remove(item);
+                ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                UpdateAllOptionBtn(-1);
+            }
+        }
+        //向下移项
+        private void DownItemOption(object obj)
+        {
+            if (obj != null)
+            {
+                var item = (ComboDataItem)obj;
+                var index = OptionItems.IndexOf(item);
+                if (index < OptionItems.Count - 1)
+                {
+                    OptionItems.Move(index, index + 1);
+                    UpdateAllOptionBtn(index + 1);
+                    OptionsList.Clear();
+                    foreach (var itemOption in OptionItems)
+                    {
+                        OptionsList[itemOption.Content] = itemOption.ValueStr;
+                    }
+                    ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                }
+            }
+        }
+        //向上移项
+        private void UpItemOption(object obj)
+        {
+            if (obj != null)
+            {
+                var item = (ComboDataItem)obj;
+                var index = OptionItems.IndexOf(item);
+                if (index > 0)
+                {
+                    OptionItems.Move(index, index - 1);
+                    UpdateAllOptionBtn(index - 1);
+                    OptionsList.Clear();
+                    foreach (var itemOption in OptionItems)
+                    {
+                        OptionsList[itemOption.Content] = itemOption.ValueStr;
+                    }
+                    ChangeValue(AnnotAttrib.ListOptions, OptionsList);
+                }
+            }
+        }
+
+
+        private void ResetColorCheckedBtn(object obj)
+        {
+            if (obj != null)
+            {
+                var str = obj as string;
+                if (str != null)
+                {
+                    switch (str)
+                    {
+                        case "One":
+                            BorderColor = ResetColorOne.BorderColor.Color;
+                            ContentColor = ResetColorOne.FontColor.Color;
+                            FillColor = ResetColorOne.FillColor.Color;
+                            break;
+
+                        case "Two":
+                            BorderColor = ResetColorTwo.BorderColor.Color;
+                            ContentColor = ResetColorTwo.FontColor.Color;
+                            FillColor = ResetColorTwo.FillColor.Color;
+                            break;
+
+                        case "Three":
+                            BorderColor = ResetColorThree.BorderColor.Color;
+                            ContentColor = ResetColorThree.FontColor.Color;
+                            FillColor = ResetColorThree.FillColor.Color;
+                            break;
+
+                        case "Forth":
+                            BorderColor = ResetColorForth.BorderColor.Color;
+                            ContentColor = ResetColorForth.FontColor.Color;
+                            FillColor = ResetColorForth.FillColor.Color;
+                            break;
+                    }
+                }
+            }
+        }
+
+        private void ResetColorEvent(object obj)
+        {
+            bool result = true;
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.PDFViewer, PDFViewer);
+            dialogs.ShowDialog(DialogNames.EditPresetColorsDialog, value, e =>
+            {
+                if (e.Result != ButtonResult.OK)
+                {
+                    result = false;
+                }
+                EditPresetColorsDialogViewModel DialogVM = e.Parameters.GetValue<EditPresetColorsDialogViewModel>(ParameterNames.DataModel);
+                if (DialogVM != null)
+                {
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
 
-        #region 外观处理
 
         #endregion
 
-        #region 选项处理
+        #region 外部XAML触发事件
+
+        private void UpdataSelectResetColorBtn()
+        {
+            int result = 0;
+            if (UpdataSelectResetColor(ResetColorOne))
+            {
+                result = 1;
+            }
+            else if (UpdataSelectResetColor(ResetColorTwo))
+            {
+                result = 2;
+            }
+            else if (UpdataSelectResetColor(ResetColorThree))
+            {
+                result = 3;
+            }
+            else if (UpdataSelectResetColor(ResetColorForth))
+            {
+                result = 4;
+            }
+
+            SelectResetColorBtnHandler?.Invoke(null, result);
+        }
+
+        private bool UpdataSelectResetColor(ResetColor reset)
+        {
+            if (reset.FillColor.Color == FillColor &&
+                reset.FontColor.Color == ContentColor &&
+                reset.BorderColor.Color == BorderColor
+                )
+            {
+                return true;
+            }
 
+            return false;
+        }
         #endregion
 
         #region Navegation
@@ -119,6 +455,7 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             listBoxArgs = null;
+            ClearVMData();
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
@@ -126,14 +463,15 @@ namespace PDF_Office.ViewModels.Form
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<WidgetListBoxArgs>("WidgetArgs", out listBoxArgs);
             navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
+            OptionsList = new Dictionary<string, string>();
 
             GetWidgeText();
+            UpdataSelectResetColorBtn();
         }
 
         private void GetWidgeText()
         {
-          
-
+         
             if (listBoxArgs == null)
             {
                 PDFViewer.SetMouseMode(MouseModes.FormEditTool);
@@ -144,60 +482,76 @@ namespace PDF_Office.ViewModels.Form
                 listBoxArgs.FontColor = Colors.Black;
                 listBoxArgs.LineColor = Colors.Black;
                 listBoxArgs.LineWidth = 1;
-                listBoxArgs.FieldName = "ListBox1";
 
                 PDFViewer.SetToolParam(listBoxArgs);
+                isCreateWidget = true;
             }
             else
             {
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
+                isCreateWidget = false;
             }
 
-            
-            
+            GetProperty();
+
+            IsCurrentWidget = true;
+
         }
 
-        //更改基类公共属性后,触发的事件
-        private void ChangeValue(object sender, FormAttributeType e)
+        private void GetProperty()
         {
-            switch (e)
+            if (listBoxArgs != null)
             {
-                case FormAttributeType.Name:
-                    break;
-
-                case FormAttributeType.ToolTip:
-
-                    break;
-
-                case FormAttributeType.IsSolid:
-                    break;
-
-                case FormAttributeType.IsLocked:
-                    break;
-
-                case FormAttributeType.HeightSize:
-                    break;
-
-                case FormAttributeType.BorderThiness:
-                    break;
-
-                case FormAttributeType.BorderColor:
-                    break;
-
-                case FormAttributeType.ContentColor:
-                    break;
-
-                case FormAttributeType.IsReadOnly:
-                    break;
-
-                case FormAttributeType.WidthSize:
-                    break;
-
-                case FormAttributeType.IsRequiredField:
-                    break;
+                IsLocked = listBoxArgs.Locked;
+                FieldName = listBoxArgs.FieldName;
+                ToolTipStr = listBoxArgs.Tooltip;
+                IsReadOnly = listBoxArgs.ReadOnly;
+
+                FillColor = listBoxArgs.BgColor;
+                ContentColor = listBoxArgs.FontColor;
+                BorderColor = listBoxArgs.LineColor;
+                BorderThiness = listBoxArgs.LineWidth;
+                BorderStyle = listBoxArgs.BorderStyle;
+
+                string fontWeightStyleStr = "";
+                if (listBoxArgs.FontStyle == FontStyles.Normal)
+                {
+                    if (listBoxArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Regular";
+                    else
+                        fontWeightStyleStr = "Bold";
+                }
+                else
+                {
+                    if (listBoxArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Italic";
+                    else
+                        fontWeightStyleStr = "Bold Italic";
+                }
+                FontWeightStyleItem = new ComboDataItem(fontWeightStyleStr);
+
+                FontFamilyData = new ComboDataItem(listBoxArgs.FontFamily);
+                //避免BorderStyle跟上一个值相同,而没触发更改IsSolid属性
+                if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
+                    IsSolid = true;
+                else
+                    IsSolid = false;
+                FontSizeData = new ComboDataItem(listBoxArgs.FontSize);
+                if (isCreateWidget == false)
+                {
+                    HeightSize = listBoxArgs.Height;
+                    WidthSize = listBoxArgs.Width;
+                }
+
+                OptionsList = listBoxArgs.ListOptions;
+                OptionItems.Clear();
+                foreach (string key in OptionsList.Keys)
+                {
+                    var item = new ComboDataItem(OptionsList[key], key);
+                    OptionItems.Add(item);
+                }
 
             }
-
         }
         #endregion
     }

+ 211 - 68
PDF Office/ViewModels/Form/RadioButtonPropertyViewModel.cs

@@ -1,8 +1,12 @@
-using ComPDFKitViewer.AnnotEvent;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Helper;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -15,37 +19,30 @@ namespace PDF_Office.ViewModels.Form
 
     public class RadioButtonPropertyViewModel : FormBaseVM, INavigationAware
     {
-        #region 属性
 
-        #region 选项
-        //单选按钮选项
-        private string _OptionContent;
-        public string OptionContent
-        {
-            get { return _OptionContent; }
-            set { SetProperty(ref _OptionContent, value); }
-        }
-
-        private bool _isDefaultChecked = false;
-        public bool IsDefaultChecked
-        {
-            get { return _isDefaultChecked; }
-            set { SetProperty(ref _isDefaultChecked, value); }
-        }
-        #endregion
+        #region Command
+        public DelegateCommand<string> FieldNameTextChangedCommand { get; set; }
+        public DelegateCommand<string> ToolTipTextChangedCommand { get; set; }
 
+        //外观
 
-        #endregion
+        public DelegateCommand<object> ResetColorCommand { get; set; }
+        public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
 
-        #region Command
+        public DelegateCommand<string> RadioMemberNameTextChangedCommand { get; set; }
 
+        public DelegateCommand<object> LineStyleCommand { get; set; }
         #endregion
 
         #region 变量
+
         private CPDFViewer PDFViewer;
         private WidgetRadioButtonArgs radioButtonArgs;
+        private IDialogService dialogs;
+        public event EventHandler<int> SelectResetColorBtnHandler;
         #endregion
 
+
         #region 初始化
         public RadioButtonPropertyViewModel()
         {
@@ -55,28 +52,182 @@ namespace PDF_Office.ViewModels.Form
 
         private void InitVariable()
         {
+            InitAllResetColor();
+        }
+        private void InitAllResetColor()
+        {
+            ResetColorOne = InitResetColor(Colors.Transparent, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorTwo = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
 
+            ResetColorThree = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorForth = InitResetColor(Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Colors.Transparent);
         }
 
         private void InitCommand()
         {
-            ChangeValueHandler -= ChangeValue;
-            ChangeValueHandler += ChangeValue;
+
+            //一般
+            FieldNameTextChangedCommand = new DelegateCommand<string>(FieldNameTextChanged);
+            ToolTipTextChangedCommand = new DelegateCommand<string>(ToolTipTextChanged);
+            //外观
+            ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
+            ResetColorCommand = new DelegateCommand<object>(ResetColorEvent);
+            LineStyleCommand = new DelegateCommand<object>(LineStyleBtnEvent);
+
+            //选项
+            RadioMemberNameTextChangedCommand = new DelegateCommand<string>(RadioMemberNameTextChanged);
         }
 
         #endregion
 
+        #region 事件
 
-        #region 一般处理
 
-        #endregion
+        private void FieldNameTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                FieldName = obj;
+
+            }
+        }
+
+        private void ToolTipTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                ToolTipStr = obj;
+            }
+        }
+
+
+        private void LineStyleBtnEvent(object obj)
+        {
+            if (obj != null)
+            {
+                switch ((string)obj)
+                {
+                    case "Solid":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
+                        break;
+                    case "Dotted":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
+                        break;
+                }
+            }
+        }
+
+
+        private void RadioMemberNameTextChanged(string obj)
+        {
+            if (obj != null && IsCurrentWidget == true)
+            {
+                RadioMemberName = obj;
+            }
+        }
+
+
+        private void ResetColorCheckedBtn(object obj)
+        {
+            if (obj != null)
+            {
+                var str = obj as string;
+                if (str != null)
+                {
+                    switch (str)
+                    {
+                        case "One":
+                            BorderColor = ResetColorOne.BorderColor.Color;
+                            ContentColor = ResetColorOne.FontColor.Color;
+                            FillColor = ResetColorOne.FillColor.Color;
+                            break;
+
+                        case "Two":
+                            BorderColor = ResetColorTwo.BorderColor.Color;
+                            ContentColor = ResetColorTwo.FontColor.Color;
+                            FillColor = ResetColorTwo.FillColor.Color;
+                            break;
+
+                        case "Three":
+                            BorderColor = ResetColorThree.BorderColor.Color;
+                            ContentColor = ResetColorThree.FontColor.Color;
+                            FillColor = ResetColorThree.FillColor.Color;
+                            break;
+
+                        case "Forth":
+                            BorderColor = ResetColorForth.BorderColor.Color;
+                            ContentColor = ResetColorForth.FontColor.Color;
+                            FillColor = ResetColorForth.FillColor.Color;
+                            break;
+                    }
+                }
+            }
+        }
+
+        private void ResetColorEvent(object obj)
+        {
+            bool result = true;
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.PDFViewer, PDFViewer);
+            dialogs.ShowDialog(DialogNames.EditPresetColorsDialog, value, e =>
+            {
+                if (e.Result != ButtonResult.OK)
+                {
+                    result = false;
+                }
+                EditPresetColorsDialogViewModel DialogVM = e.Parameters.GetValue<EditPresetColorsDialogViewModel>(ParameterNames.DataModel);
+                if (DialogVM != null)
+                {
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
 
-        #region 外观处理
 
         #endregion
 
-        #region 选项处理
+        #region 外部XAML触发事件
+
+        private void UpdataSelectResetColorBtn()
+        {
+            int result = 0;
+            if (UpdataSelectResetColor(ResetColorOne))
+            {
+                result = 1;
+            }
+            else if (UpdataSelectResetColor(ResetColorTwo))
+            {
+                result = 2;
+            }
+            else if (UpdataSelectResetColor(ResetColorThree))
+            {
+                result = 3;
+            }
+            else if (UpdataSelectResetColor(ResetColorForth))
+            {
+                result = 4;
+            }
+
+            SelectResetColorBtnHandler?.Invoke(null, result);
+        }
 
+        private bool UpdataSelectResetColor(ResetColor reset)
+        {
+            if (reset.FillColor.Color == FillColor &&
+                reset.FontColor.Color == ContentColor &&
+                reset.BorderColor.Color == BorderColor
+                )
+            {
+                return true;
+            }
+
+            return false;
+        }
         #endregion
 
         #region Navegation
@@ -88,80 +239,72 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             radioButtonArgs = null;
+            isCreateWidget = false;
+            IsCurrentWidget = false;
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
             navigationContext.Parameters.TryGetValue<WidgetRadioButtonArgs>("WidgetArgs", out radioButtonArgs);
 
             GetWidgeText();
+            UpdataSelectResetColorBtn();
         }
 
         private void GetWidgeText()
         {
-            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
 
             if (radioButtonArgs == null)
             {
+                PDFViewer.SetMouseMode(MouseModes.FormEditTool);
                 radioButtonArgs = new WidgetRadioButtonArgs();
-                radioButtonArgs.FieldName = NameStr;
                 radioButtonArgs.BgColor =  Colors.Transparent;
                 radioButtonArgs.FontColor = Colors.Black;
                 radioButtonArgs.LineColor = Colors.Black;
                 radioButtonArgs.LineWidth = 1;
                 PDFViewer.SetToolParam(radioButtonArgs);
+                isCreateWidget = true;
             }
             else
             {
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
+                isCreateWidget = false;
             }
-           
-           
-        }
-
-        //更改基类公共属性后,触发的事件
-        private void ChangeValue(object sender, FormAttributeType e)
-        {
-            switch (e)
-            {
-                case FormAttributeType.Name:
-                    break;
-
-                case FormAttributeType.ToolTip:
-
-                    break;
-
-                case FormAttributeType.IsSolid:
-                    break;
 
-                case FormAttributeType.IsLocked:
-                    break;
+            GetProperty();
 
-                case FormAttributeType.HeightSize:
-                    break;
-
-                case FormAttributeType.BorderThiness:
-                    break;
-
-                case FormAttributeType.BorderColor:
-                    break;
-
-                case FormAttributeType.ContentColor:
-                    break;
-
-                case FormAttributeType.IsReadOnly:
-                    break;
-
-                case FormAttributeType.WidthSize:
-                    break;
+            IsCurrentWidget = true;
+        }
 
-                case FormAttributeType.IsRequiredField:
-                    break;
 
+        private void GetProperty()
+        {
+            if (radioButtonArgs != null)
+            {
+                IsLocked = radioButtonArgs.Locked;
+                FieldName = radioButtonArgs.FieldName;
+                ToolTipStr = radioButtonArgs.Tooltip;
+                IsReadOnly = radioButtonArgs.ReadOnly;
+                IsRequiredField = radioButtonArgs.IsRequired;
+
+                FillColor = radioButtonArgs.BgColor;
+                ContentColor = radioButtonArgs.FontColor;
+                BorderColor = radioButtonArgs.LineColor;
+                BorderThiness = radioButtonArgs.LineWidth;
+                BorderStyle = radioButtonArgs.BorderStyle;
+                RadioMemberName = radioButtonArgs.RadioMemberName;
+                //避免BorderStyle跟上一个值相同,而没触发更改IsSolid属性
+                if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
+                    IsSolid = true;
+                else
+                    IsSolid = false;
+
+                IsDefaultRadioBox = radioButtonArgs.IsChecked;
             }
-
         }
+
         #endregion
     }
 }

+ 212 - 49
PDF Office/ViewModels/Form/SignPropertyViewModel.cs

@@ -1,8 +1,12 @@
-using ComPDFKitViewer.AnnotEvent;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Helper;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
+using Prism.Services.Dialogs;
 using System;
 using System.Collections.Generic;
 using System.Linq;
@@ -14,17 +18,27 @@ namespace PDF_Office.ViewModels.Form
 {
     public class SignPropertyViewModel : FormBaseVM, INavigationAware
     {
-        #region 属性
-
-        #endregion
 
         #region Command
+        public DelegateCommand<string> FieldNameTextChangedCommand { get; set; }
+        public DelegateCommand<string> ToolTipTextChangedCommand { get; set; }
+
+        //外观
+
+        public DelegateCommand<object> ResetColorCommand { get; set; }
+        public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
+
+        public DelegateCommand<string> ExportedValuesTextChangedCommand { get; set; }
 
+        public DelegateCommand<object> LineStyleCommand { get; set; }
         #endregion
 
         #region 变量
+
         private CPDFViewer PDFViewer;
         private WidgetSignArgs signArgs;
+        private IDialogService dialogs;
+        public event EventHandler<int> SelectResetColorBtnHandler;
         #endregion
 
         #region 初始化
@@ -36,28 +50,182 @@ namespace PDF_Office.ViewModels.Form
 
         private void InitVariable()
         {
+            InitAllResetColor();
+        }
+
+        private void InitAllResetColor()
+        {
+            ResetColorOne = InitResetColor(Colors.Transparent, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorTwo = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
 
+            ResetColorThree = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
+
+            ResetColorForth = InitResetColor(Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Colors.Transparent);
         }
 
         private void InitCommand()
         {
-            ChangeValueHandler -= ChangeValue;
-            ChangeValueHandler += ChangeValue;
+            //一般
+            FieldNameTextChangedCommand = new DelegateCommand<string>(FieldNameTextChanged);
+            ToolTipTextChangedCommand = new DelegateCommand<string>(ToolTipTextChanged);
+            //外观
+            ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
+            ResetColorCommand = new DelegateCommand<object>(ResetColorEvent);
+            LineStyleCommand = new DelegateCommand<object>(LineStyleBtnEvent);
+
+            //选项
+            ExportedValuesTextChangedCommand = new DelegateCommand<string>(ExportedValuesTextChanged);
         }
 
         #endregion
 
+        #region 事件
 
-        #region 一般处理
 
-        #endregion
+        private void FieldNameTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                FieldName = obj;
+
+            }
+        }
+
+        private void ToolTipTextChanged(string obj)
+        {
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            {
+                ToolTipStr = obj;
+            }
+        }
+
+
+        private void LineStyleBtnEvent(object obj)
+        {
+            if (obj != null)
+            {
+                switch ((string)obj)
+                {
+                    case "Solid":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
+                        break;
+                    case "Dotted":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
+                        break;
+                }
+            }
+        }
+
+
+        private void ExportedValuesTextChanged(string obj)
+        {
+            if (obj != null && IsCurrentWidget == true)
+            {
+                ExportedValues = obj;
+            }
+        }
+
+
+        private void ResetColorCheckedBtn(object obj)
+        {
+            if (obj != null)
+            {
+                var str = obj as string;
+                if (str != null)
+                {
+                    switch (str)
+                    {
+                        case "One":
+                            BorderColor = ResetColorOne.BorderColor.Color;
+                            ContentColor = ResetColorOne.FontColor.Color;
+                            FillColor = ResetColorOne.FillColor.Color;
+                            break;
+
+                        case "Two":
+                            BorderColor = ResetColorTwo.BorderColor.Color;
+                            ContentColor = ResetColorTwo.FontColor.Color;
+                            FillColor = ResetColorTwo.FillColor.Color;
+                            break;
+
+                        case "Three":
+                            BorderColor = ResetColorThree.BorderColor.Color;
+                            ContentColor = ResetColorThree.FontColor.Color;
+                            FillColor = ResetColorThree.FillColor.Color;
+                            break;
+
+                        case "Forth":
+                            BorderColor = ResetColorForth.BorderColor.Color;
+                            ContentColor = ResetColorForth.FontColor.Color;
+                            FillColor = ResetColorForth.FillColor.Color;
+                            break;
+                    }
+                }
+            }
+        }
+
+        private void ResetColorEvent(object obj)
+        {
+            bool result = true;
+            DialogParameters value = new DialogParameters();
+            value.Add(ParameterNames.PDFViewer, PDFViewer);
+            dialogs.ShowDialog(DialogNames.EditPresetColorsDialog, value, e =>
+            {
+                if (e.Result != ButtonResult.OK)
+                {
+                    result = false;
+                }
+                EditPresetColorsDialogViewModel DialogVM = e.Parameters.GetValue<EditPresetColorsDialogViewModel>(ParameterNames.DataModel);
+                if (DialogVM != null)
+                {
+                }
+            });
+            if (!result)
+            {
+                return;
+            }
+        }
 
-        #region 外观处理
 
         #endregion
 
-        #region 选项处理
+        #region 外部XAML触发事件
+
+        private void UpdataSelectResetColorBtn()
+        {
+            int result = 0;
+            if (UpdataSelectResetColor(ResetColorOne))
+            {
+                result = 1;
+            }
+            else if (UpdataSelectResetColor(ResetColorTwo))
+            {
+                result = 2;
+            }
+            else if (UpdataSelectResetColor(ResetColorThree))
+            {
+                result = 3;
+            }
+            else if (UpdataSelectResetColor(ResetColorForth))
+            {
+                result = 4;
+            }
+
+            SelectResetColorBtnHandler?.Invoke(null, result);
+        }
+
+        private bool UpdataSelectResetColor(ResetColor reset)
+        {
+            if (reset.FillColor.Color == FillColor &&
+                reset.FontColor.Color == ContentColor &&
+                reset.BorderColor.Color == BorderColor
+                )
+            {
+                return true;
+            }
 
+            return false;
+        }
         #endregion
 
         #region Navegation
@@ -69,76 +237,71 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             signArgs = null;
+            isCreateWidget = false;
+            IsCurrentWidget = false;
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<WidgetSignArgs>("WidgetArgs", out signArgs);
+            navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
 
             GetWidgeText();
+            UpdataSelectResetColorBtn();
         }
 
         private void GetWidgeText()
         {
-            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
+            
 
             if (signArgs == null)
             {
+                PDFViewer.SetMouseMode(MouseModes.FormEditTool);
                 signArgs = new WidgetSignArgs();
                 signArgs.LineWidth = 1;
                 signArgs.LineColor = Colors.Black;
                 PDFViewer.SetToolParam(signArgs);
+                isCreateWidget = true;
             }
             else
             {
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
+                isCreateWidget = false;
             }
 
-        }
-
-        //更改基类公共属性后,触发的事件
-        private void ChangeValue(object sender, FormAttributeType e)
-        {
-            switch (e)
-            {
-                case FormAttributeType.Name:
-                    break;
-
-                case FormAttributeType.ToolTip:
-
-                    break;
-
-                case FormAttributeType.IsSolid:
-                    break;
+            GetProperty();
 
-                case FormAttributeType.IsLocked:
-                    break;
+            IsCurrentWidget = true;
 
-                case FormAttributeType.HeightSize:
-                    break;
-
-                case FormAttributeType.BorderThiness:
-                    break;
-
-                case FormAttributeType.BorderColor:
-                    break;
-
-                case FormAttributeType.ContentColor:
-                    break;
-
-                case FormAttributeType.IsReadOnly:
-                    break;
-
-                case FormAttributeType.WidthSize:
-                    break;
+        }
 
-                case FormAttributeType.IsRequiredField:
-                    break;
 
+        private void GetProperty()
+        {
+            if (signArgs != null)
+            {
+                IsLocked = signArgs.Locked;
+                FieldName = signArgs.FieldName;
+                ToolTipStr = signArgs.Tooltip;
+                IsReadOnly = signArgs.ReadOnly;
+                IsRequiredField = signArgs.IsRequired;
+
+                FillColor = signArgs.BgColor;
+                ContentColor = signArgs.FontColor;
+                BorderColor = signArgs.LineColor;
+                BorderThiness = signArgs.LineWidth;
+                BorderStyle = signArgs.BorderStyle;
+                //ExportedValues = signArgs.ExportValue;
+                //避免BorderStyle跟上一个值相同,而没触发更改IsSolid属性
+                if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
+                    IsSolid = true;
+                else
+                    IsSolid = false;
+               
             }
-
         }
+
         #endregion
     }
 }

+ 146 - 426
PDF Office/ViewModels/Form/TextFieldPropertyViewModel.cs

@@ -23,313 +23,159 @@ namespace PDF_Office.ViewModels.Form
 {
     public class TextFieldPropertyViewModel : FormBaseVM, INavigationAware
     {
-        #region 属性
-
-        #region 一般
-        private FormFieldType _formPos;
-        public FormFieldType FormPos
-        {
-            get { return _formPos; }
-            set { SetProperty(ref _formPos, value); ChangeFieldValue("FormPos"); }
-        }
-
-        #endregion
-
-        #region 选项
-        //默认值
-        private string _defaultValue;
-        public string DefaultValue
-        {
-            get { return _defaultValue; }
-            set { SetProperty(ref _defaultValue, value); }
-        }
-
-        //多行
-        private bool _isMultiline = false;
-        public bool IsMultiLine
-        {
-            get { return _isMultiline; }
-            set { SetProperty(ref _isMultiline, value); ChangeFieldValue("IsMultiLine"); }
-        }
-
-        //滚动显示长文本
-        private bool _isScrollText = false;
-        public bool IsScrollText
-        {
-            get { return _isScrollText; }
-            set { SetProperty(ref _isScrollText, value); ChangeFieldValue("IsScrollText"); }
-        }
-
-        #endregion
-
-        private FontFamily _fontFamily;
-        public FontFamily FontFamilyItem
-        {
-            get { return _fontFamily; }
-            set { SetProperty(ref _fontFamily, value); ChangeFieldValue("FontFamilyItem"); }
-        }
-
-        private FontStyle _fontStyle;
-        public FontStyle FontStyleItem
-        {
-            get { return _fontStyle; }
-            set { SetProperty(ref _fontStyle, value); ChangeFieldValue("FontStyleItem"); }
-        }
-
-        private FontWeight _fontWeight;
-        public FontWeight FontWeightItem
-        {
-            get { return _fontWeight; }
-            set { SetProperty(ref _fontWeight, value); ChangeFieldValue("FontWeightItem"); }
-        }
-
-        private C_TEXT_ALIGNMENT _textAlignment;
-        public C_TEXT_ALIGNMENT TextAlignmentItem
-        {
-            get { return _textAlignment; }
-            set { SetProperty(ref _textAlignment, value); ChangeFieldValue("TextAlignmentItem"); }
-        }
-
-        private string _content;
-        public string FormContent
-        {
-            get { return _content; }
-            set { SetProperty(ref _content, value); ChangeFieldValue("FormContent"); }
-        }
-
-        #endregion
 
         #region Command变量
-        public DelegateCommand<string> NameTextChangedCommand { get; set; }
+        public DelegateCommand<string> FieldNameTextChangedCommand { get; set; }
         public DelegateCommand<string> ToolTipTextChangedCommand { get; set; }
 
-        public DelegateCommand<object> IsReadOnlyCheckedCommand { get; set; }
-        public DelegateCommand<object> RequiredFieldCheckedCommand { get; set; }
-
         //外观
-        public DelegateCommand<object> ThicknessChangedCommand { get; set; }
 
         public DelegateCommand<object> ResetColorCommand { get; set; }
         public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
-        public DelegateCommand<object> FontFamilyChangedCommand { get; set; }
-        public DelegateCommand<object> FontStyleChangedCommand { get; set; }
-
-        public DelegateCommand<object> AlignmentChangedCommand { get; set; }
+ 
         public DelegateCommand<string> FormContentTextChangedCommand { get; set; }
 
-        public DelegateCommand<object> IsMultiLineCheckedCommand { get; set; }
-        public DelegateCommand<object> IsScrollToDisplayCheckedCommand { get; set; }
         public DelegateCommand<object> LineStyleCommand { get; set; }
         #endregion
 
         #region 变量
-        public UpdateAttributeHelper AttribEvent;
         private CPDFViewer PDFViewer;
         private WidgetTextBoxArgs textBoxArgs;
-        private bool IsCurrentWidget = false;
         private IDialogService dialogs;
-        public List<ComboDataItem> Items { get; private set; }
+        public event EventHandler<int> SelectResetColorBtnHandler;
+        public List<ComboDataItem> FontFamilyItems { get; private set; }
+        public List<ComboDataItem> FontStyleItems { get; private set; }
+        public List<ComboDataItem> AglinmentItems { get; private set; }
 
         #endregion
 
         #region 初始化
         public TextFieldPropertyViewModel(IDialogService dialogService)
         {
-            dialogs = dialogService;
+            dialogs = dialogService; 
             InitVariable();
             InitCommand();
         }
 
         private void InitVariable()
         {
-            InitResetColor();
+            InitAllResetColor();
             InitFontFamilyComboBox();
+            InitFontStyleComboBox();
+            InitAglinmentItemsComboBox();
         }
 
-        private void InitResetColor()
+        private void InitAllResetColor()
         {
-            ResetColorOne = new ResetColor()
-            {
-                BorderColor = new SolidColorBrush(Colors.Transparent),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Colors.Transparent)
-            };
+            ResetColorOne = InitResetColor(Colors.Transparent, Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
 
-            ResetColorTwo = new ResetColor()
-            {
-                BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Colors.Transparent)
-            };
-
-            ResetColorThree = new ResetColor()
-            {
-                BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xBD, 0xDF, 0xFD))
-            };
+            ResetColorTwo = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
 
-            ResetColorForth = new ResetColor()
-            {
-                BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
-                FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
-                FillColor = new SolidColorBrush(Colors.Transparent)
-            };
+            ResetColorThree = InitResetColor(Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Color.FromArgb(0xFF, 0x00, 0x00, 0x00), Colors.Transparent);
 
+            ResetColorForth = InitResetColor(Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Color.FromArgb(0xFF, 0xff, 0x00, 0x00), Colors.Transparent);
         }
+
         private void InitFontFamilyComboBox()
         {
-            Items = new List<ComboDataItem>();
+            FontFamilyItems = new List<ComboDataItem>();
             ComboDataItem item = new ComboDataItem("Courier", "Courier New");
-            Items.Add(item);
-            item = new ComboDataItem("Arial", "Helvetica");
-            Items.Add(item);
-            item = new ComboDataItem("Times New Roman", "Times New Roman");
-            Items.Add(item);
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Helvetica", "Helvetica");
+            FontFamilyItems.Add(item);
+            item = new ComboDataItem("Times Roman", "Times New Roman");
+            FontFamilyItems.Add(item);
+        }
+
+        private void InitFontStyleComboBox()
+        {
+            FontStyleItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Regular", "Regular");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Bold", "Bold");
+            FontStyleItems.Add(item);
+            item = new ComboDataItem("Italic", "Italic");
+            FontStyleItems.Add(item);
+
+            item = new ComboDataItem("Bold Italic", "Bold Italic");
+            FontStyleItems.Add(item);
+        }
+
+        private void InitAglinmentItemsComboBox()
+        {
+            AglinmentItems = new List<ComboDataItem>();
+            ComboDataItem item = new ComboDataItem("Left", "Left");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Center", "Center");
+            AglinmentItems.Add(item);
+            item = new ComboDataItem("Right", "Right");
+            AglinmentItems.Add(item);
         }
 
         private void InitCommand()
         {
-            NameTextChangedCommand = new DelegateCommand<string>(NameTextChanged);
+            //一般
+            FieldNameTextChangedCommand = new DelegateCommand<string>(FieldNameTextChanged);
             ToolTipTextChangedCommand = new DelegateCommand<string>(ToolTipTextChanged);
-            IsReadOnlyCheckedCommand = new DelegateCommand<object>(IsReadOnlyChecked);
-            RequiredFieldCheckedCommand = new DelegateCommand<object>(RequiredFieldChecked);
             //外观
-            ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged);
+            ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
             ResetColorCommand = new DelegateCommand<object>(ResetColorEvent);
+            LineStyleCommand = new DelegateCommand<object>(LineStyleBtnEvent);
 
-            ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
-            FontFamilyChangedCommand = new DelegateCommand<object>(FontFamilyChanged);
-            FontStyleChangedCommand = new DelegateCommand<object>(FontStyleChanged);
-            AlignmentChangedCommand = new DelegateCommand<object>(AlignmentChanged);
+            //选项
             FormContentTextChangedCommand = new DelegateCommand<string>(FormContentTextChanged);
 
-            IsMultiLineCheckedCommand = new DelegateCommand<object>(IsMultiLineChecked);
-            IsScrollToDisplayCheckedCommand = new DelegateCommand<object>(IsScrollToDisplayChecked);
-            LineStyleCommand = new DelegateCommand<object>(LineStyleBtnEvent);
-            ChangeValueHandler -= ChangeValue;
-            ChangeValueHandler += ChangeValue;
         }
 
-        private void LineStyleBtnEvent(object obj)
-        {
-            if (obj != null)
-            {
-                switch ((string)obj)
-                {
-                    case "Solid":
-                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
-                        break;
-                    case "Dotted":
-                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
-                        break;
-                }
-            }
-        }
+        #endregion
 
+        #region 事件
+  
 
-        private void IsScrollToDisplayChecked(object obj)
+        private void FieldNameTextChanged(string obj)
         {
-           if(obj != null)
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
             {
-                IsScrollText = (bool)obj;
-            }
-        }
+                FieldName = obj;
 
-        private void IsMultiLineChecked(object obj)
-        {
-            if (obj != null)
-            {
-                IsMultiLine = (bool)obj;
             }
         }
 
-        private void FormContentTextChanged(string obj)
+        private void ToolTipTextChanged(string obj)
         {
-            if(obj != null)
+            if (string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
             {
-                FormContent = obj;
+                ToolTipStr = obj;
             }
         }
 
-        private void AlignmentChanged(object obj)
+
+        private void LineStyleBtnEvent(object obj)
         {
             if (obj != null)
             {
-                var combo = (ComboBoxItem)obj;
-                if (combo != null)
+                switch ((string)obj)
                 {
-                    switch (combo.Content)
-                    {
-                        case "Left":
-                            TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_LEFT;
-                            break;
-
-                        case "Center":
-                            TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_CENTER;
-                            break;
-
-                        case "Right":
-                            TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_RIGHT;
-                            break;
-
-                    }
+                    case "Solid":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_SOLID;
+                        break;
+                    case "Dotted":
+                        BorderStyle = ComPDFKit.PDFAnnotation.C_BORDER_STYLE.BS_DASHDED;
+                        break;
                 }
             }
         }
 
-        private void FontStyleChanged(object obj)
-        {
-           if(obj != null)
-            {
-                var combo = (ComboBoxItem)obj;
-                if(combo != null)
-                {
-                    switch(combo.Content)
-                    {
-                        case "Regular":
-                            FontStyleItem = FontStyles.Normal;
-                            FontWeightItem = FontWeights.Normal;
-                            break;
-
-                        case "Bold":
-                            FontStyleItem = FontStyles.Normal;
-                            FontWeightItem = FontWeights.Bold;
-                            break;
-
-                        case "Italic":
-                            FontStyleItem = FontStyles.Italic;
-                            FontWeightItem = FontWeights.Normal;
-                            break;
-
-                        case "Bold Italic":
-                            FontStyleItem = FontStyles.Italic;
-                            FontWeightItem = FontWeights.Bold;
-                            break;
-                    }
-                }
-            }
-        }
 
-        private void FontFamilyChanged(object obj)
+        private void FormContentTextChanged(string obj)
         {
-            if (obj != null && string.IsNullOrEmpty((string)obj) == false)
+            if (obj != null && IsCurrentWidget == true)
             {
-                switch ((string)obj)
-                {
-                    case "Courier":
-                        FontFamilyItem = new FontFamily("Courier");
-                        break;
-                    case "Helvetica":
-                        FontFamilyItem = new FontFamily("Helvetica");
-                        break;
-                    case "Times Roman":
-                        FontFamilyItem = new FontFamily("Times Roman");
-                        break;
-                }
+                FormContent = obj;
             }
         }
 
+
         private void ResetColorCheckedBtn(object obj)
         {
             if (obj != null)
@@ -367,51 +213,8 @@ namespace PDF_Office.ViewModels.Form
             }
         }
 
-        public event EventHandler<int> SelectResetColorBtnHandler;
-        private void UpdataSelectResetColorBtn()
-        {
-            int result = 0;
-            if (UpdataSelectResetColor(ResetColorOne))
-            {
-                result = 1;
-            }
-            else if (UpdataSelectResetColor(ResetColorTwo))
-            {
-                result = 2;
-            }
-            else if (UpdataSelectResetColor(ResetColorThree))
-            {
-                result = 3;
-            }
-            else if (UpdataSelectResetColor(ResetColorForth))
-            {
-                result = 4;
-            }
-
-            SelectResetColorBtnHandler?.Invoke(null, result);
-        }
-
-        private bool UpdataSelectResetColor(ResetColor reset)
-        {
-            if (reset.FillColor.Color == FillColor &&
-                reset.FontColor.Color == ContentColor &&
-                reset.BorderColor.Color == BorderColor
-                )
-            {
-                return true;
-            }
-
-            return false;
-        }
-
         private void ResetColorEvent(object obj)
         {
-            //if(obj != null && (ResetColor)obj != null)
-            // {
-            //     var resetcolor = obj as ResetColor;
-
-            // }
-
             bool result = true;
             DialogParameters value = new DialogParameters();
             value.Add(ParameterNames.PDFViewer, PDFViewer);
@@ -424,7 +227,6 @@ namespace PDF_Office.ViewModels.Form
                 EditPresetColorsDialogViewModel DialogVM = e.Parameters.GetValue<EditPresetColorsDialogViewModel>(ParameterNames.DataModel);
                 if (DialogVM != null)
                 {
-                   // CreateSignature(DialogVM);
                 }
             });
             if (!result)
@@ -433,61 +235,48 @@ namespace PDF_Office.ViewModels.Form
             }
         }
 
-        private void ThicknessChanged(object obj)
-        {
-            if(obj != null)
-            {
-                BorderThiness = (double)obj;
-            }
-        }
-
 
         #endregion
 
+        #region 外部XAML触发事件
 
-        #region 一般处理
-        private void NameTextChanged(string obj)
+        private void UpdataSelectResetColorBtn()
         {
-            if(string.IsNullOrEmpty(obj) == false && IsCurrentWidget == true)
+            int result = 0;
+            if (UpdataSelectResetColor(ResetColorOne))
             {
-                NameStr = obj;
-
+                result = 1;
             }
-        }
-
-        private void ToolTipTextChanged(string obj)
-        {
-            if (string.IsNullOrEmpty(obj) == false)
+            else if (UpdataSelectResetColor(ResetColorTwo))
             {
-                ToolTipStr = obj;
+                result = 2;
             }
-        }
-
-        private void IsReadOnlyChecked(object obj)
-        {
-            if(obj is bool)
+            else if (UpdataSelectResetColor(ResetColorThree))
             {
-                IsReadOnly = (bool)obj;
+                result = 3;
+            }
+            else if (UpdataSelectResetColor(ResetColorForth))
+            {
+                result = 4;
             }
-        }
 
+            SelectResetColorBtnHandler?.Invoke(null, result);
+        }
 
-        private void RequiredFieldChecked(object obj)
+        private bool UpdataSelectResetColor(ResetColor reset)
         {
-            if (obj is bool)
+            if (reset.FillColor.Color == FillColor &&
+                reset.FontColor.Color == ContentColor &&
+                reset.BorderColor.Color == BorderColor
+                )
             {
-                IsRequiredField = (bool)obj;
+                return true;
             }
-        }
-        #endregion
-
-        #region 外观处理
 
+            return false;
+        }
         #endregion
 
-        #region 选项处理
-
-        #endregion
 
         #region Navegation
         public bool IsNavigationTarget(NavigationContext navigationContext)
@@ -507,21 +296,18 @@ namespace PDF_Office.ViewModels.Form
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             navigationContext.Parameters.TryGetValue<UpdateAttributeHelper>(ParameterNames.AnnotEvent, out AttribEvent);
             navigationContext.Parameters.TryGetValue<WidgetTextBoxArgs>("WidgetArgs", out textBoxArgs);
-           
             GetWidgeText();
             UpdataSelectResetColorBtn();
         }
-        bool isCreateWidget = false;
+        
         private void GetWidgeText()
         {
-
             //新建的form表单
             if (textBoxArgs == null)
             {
                 PDFViewer.SetMouseMode(MouseModes.FormEditTool);
                 WidgetTextBoxArgs textArgs = new WidgetTextBoxArgs();
                 textArgs.BgColor = Colors.LightGray;
-                textArgs.FieldName = "TextBox";
                 textBoxArgs = textArgs;
                 PDFViewer.SetToolParam(textBoxArgs);
                 isCreateWidget = true;
@@ -530,144 +316,78 @@ namespace PDF_Office.ViewModels.Form
             {
                 PDFViewer.SetToolParam(new AnnotHandlerEventArgs());
                 isCreateWidget = false;
+
             }
 
-            GetProperty();
+           GetProperty();
+
             IsCurrentWidget = true;
         }
+
         private void GetProperty()
         {
             if (textBoxArgs != null)
             {
-                NameStr = textBoxArgs.FieldName;
-                IsRequiredField = textBoxArgs.IsRequired;
-                IsMultiLine = textBoxArgs.IsMultiLine;
                 IsLocked = textBoxArgs.Locked;
+                FieldName = textBoxArgs.FieldName;
                 ToolTipStr = textBoxArgs.Tooltip;
+                IsReadOnly = textBoxArgs.ReadOnly;
+                IsRequiredField = textBoxArgs.IsRequired;
+
                 FillColor = textBoxArgs.BgColor;
                 ContentColor = textBoxArgs.FontColor;
                 BorderColor = textBoxArgs.LineColor;
                 BorderThiness = textBoxArgs.LineWidth;
                 BorderStyle = textBoxArgs.BorderStyle;
+
+                FormField = (FormFieldType)textBoxArgs.FormField;
+
+                string fontWeightStyleStr = "";
+                if (textBoxArgs.FontStyle == FontStyles.Normal)
+                {
+                    if (textBoxArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Regular";
+                    else
+                        fontWeightStyleStr = "Bold";
+                }
+                else
+                {
+                    if (textBoxArgs.FontWeight == FontWeights.Normal)
+                        fontWeightStyleStr = "Italic";
+                    else
+                        fontWeightStyleStr = "Bold Italic";
+                }
+                FontWeightStyleItem = new ComboDataItem(fontWeightStyleStr);
+
+                FontFamilyData = new ComboDataItem(textBoxArgs.FontFamily);
                 //避免BorderStyle跟上一个值相同,而没触发更改IsSolid属性
                 if (BorderStyle == C_BORDER_STYLE.BS_SOLID)
                     IsSolid = true;
                 else
                     IsSolid = false;
-            }
-        }
-        //更改基类公共属性后,触发的事件
-        private void ChangeValue(object sender, FormAttributeType e)
-        {
+                FontSizeData = new ComboDataItem(textBoxArgs.FontSize);
+                if (isCreateWidget == false)
+                {
+                    HeightSize = textBoxArgs.Height;
+                    WidthSize = textBoxArgs.Width;
+                }
 
-            switch (e)
-            {
-                case FormAttributeType.Name:
-                    textBoxArgs.FieldName = NameStr;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.FieldName, NameStr);
-                    break;
-
-                case FormAttributeType.ToolTip:
-                    textBoxArgs.Tooltip = ToolTipStr;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.Tooltip, ToolTipStr);
-                    break;
-
-                case FormAttributeType.IsSolid:
-                    textBoxArgs.BorderStyle = BorderStyle;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.LineStyle, BorderStyle);
-                    break;
-
-                case FormAttributeType.IsLocked:
-                    textBoxArgs.Locked = IsLocked;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.Locked, IsLocked);
-                    break;
-
-                case FormAttributeType.HeightSize:
-                    textBoxArgs.Height = HeightSize;
-                    //AttribEvent?.UpdateAttrib(AnnotAttrib.w, HeightSize);
-                    break;
-
-                case FormAttributeType.BorderThiness:
-                    textBoxArgs.LineWidth = BorderThiness;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.Thickness, BorderThiness);
-                    break;
-
-                case FormAttributeType.BorderColor:
-                    textBoxArgs.BgColor = BorderColor;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.Color, BorderColor);
-                    break;
-
-                case FormAttributeType.ContentColor:
-                    textBoxArgs.FontColor = ContentColor;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.FontColor, ContentColor);
-                    break;
-                case FormAttributeType.FillColor:
-                    textBoxArgs.BgColor = FillColor;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.FillColor, FillColor);
-                    break;
-
-                case FormAttributeType.IsReadOnly:
-                    textBoxArgs.ReadOnly = IsReadOnly;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.ReadOnly, IsReadOnly);
-                    break;
-
-                case FormAttributeType.WidthSize:
-                    textBoxArgs.Width = WidthSize;
-
-                    break;
-
-                case FormAttributeType.IsRequiredField:
-                    textBoxArgs.IsRequired = IsRequiredField;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.IsRequired, IsRequiredField);
-                    break;
-
-                case FormAttributeType.FontFamily:
-                    textBoxArgs.FontFamily = FontFamilyItem.Source;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.FontFamily, FontFamilyItem.Source);
-                    break;
+                string alignmentStr = "";
 
-            }
-            AttribEvent?.UpdateAnnot();
-        }
+                if (textBoxArgs.Alignment == C_TEXT_ALIGNMENT.ALIGNMENT_LEFT)
+                    alignmentStr = "left";
+                else if (textBoxArgs.Alignment == C_TEXT_ALIGNMENT.ALIGNMENT_CENTER)
+                    alignmentStr = "Center";
+                else
+                    alignmentStr = "Right";
 
-        private void ChangeFieldValue(string tag)
-        {
-            switch (tag)
-            {
-                case "FormPos":
-                    textBoxArgs.FormField = FormField.Visible;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.FormField, FormPos);
-                    break;
-                case "FontFamilyItem":
-                    textBoxArgs.FontFamily = FontFamilyItem.Source;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.FontFamily, FontFamilyItem.Source);
-                    break;
-                case "FontStyleItem":
-                    textBoxArgs.FontStyle = FontStyleItem;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.FontStyle, FontStyleItem);
-                    break;
-                case "FontWeightItem":
-                    textBoxArgs.FontWeight = FontWeightItem;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.FontWeight, FontWeightItem);
-                    break;
-                case "TextAlignmentItem":
-                    textBoxArgs.Alignment = TextAlignmentItem;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignmentItem);
-                    break;
-                case "FormContent":
-                    textBoxArgs.Content = FormContent;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.Text, FormContent);
-                    break;
-                case "IsScrollText":
-                    textBoxArgs.ScrollFlag = IsScrollText;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.ScrollFlag, IsScrollText);
-                    break;
-                case "IsMultiLine":
-                    textBoxArgs.IsMultiLine = IsMultiLine;
-                    AttribEvent?.UpdateAttrib(AnnotAttrib.IsMutilLine, IsMultiLine);
-                    break;
+                TextAlignmentData = new ComboDataItem(alignmentStr, alignmentStr);
+
+                FormContent = textBoxArgs.Text;
+                IsMultiLine = textBoxArgs.IsMultiLine;
+                IsScrollText = textBoxArgs.ScrollFlag;
+               
             }
-            AttribEvent?.UpdateAnnot();
         }
 
         #endregion

+ 1 - 1
PDF Office/ViewModels/PageEdit/PageEditContentViewModel.cs

@@ -2241,7 +2241,7 @@ namespace PDF_Office.ViewModels.PageEdit
         {
             if(e.Key== "PageNum")
             {
-                NotifyUIToRefresh(new List<int> { (int)e.Value});
+                NotifyUIToRefresh(new List<int> { (e.Value as ComPDFKitViewer.RenderData).PageIndex});
             }
         }
         #endregion

+ 62 - 0
PDF Office/ViewModels/PropertyPanel/Scan/ScanPropertyPanelViewModel.cs

@@ -0,0 +1,62 @@
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Model;
+using Prism.Mvvm;
+using Prism.Regions;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace PDF_Office.ViewModels.PropertyPanel.Scan
+{
+    class ScanPropertyPanelViewModel : BindableBase, INavigationAware
+    {
+        private int pageCount;
+
+        public int PageCount
+        {
+            get { return pageCount; }
+            set
+            {
+                SetProperty(ref pageCount, value);
+            }
+        }
+
+        private string setPageRange;
+
+        public string SetPageRange
+        {
+            get { return setPageRange; }
+            set
+            {
+                SetProperty(ref setPageRange, value);
+            }
+        }
+
+
+        private CPDFViewer PDFViewer;
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            return;
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            if (PDFViewer == null)
+            {
+                return;
+            }
+            else
+            {
+                PageCount = PDFViewer.Document.PageCount;
+            }
+        }
+    }
+}

+ 15 - 3
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -4,6 +4,7 @@ using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using Microsoft.Win32;
 using PDF_Office.CustomControl;
+using PDF_Office.EventAggregators;
 using PDF_Office.Helper;
 using PDF_Office.Model;
 using PDF_Office.Properties;
@@ -11,6 +12,7 @@ using PDF_Office.ViewModels.PropertyPanel;
 using PDF_Office.Views.PropertyPanel.AnnotPanel;
 using PDFSettings;
 using Prism.Commands;
+using Prism.Events;
 using Prism.Mvvm;
 using Prism.Regions;
 using System;
@@ -28,10 +30,12 @@ namespace PDF_Office.ViewModels.Tools
 {
     public sealed partial class AnnotToolContentViewModel : BindableBase, INavigationAware
     {
-        public AnnotToolContentViewModel(IRegionManager regionManager)
+        private IEventAggregator events;
+
+        public AnnotToolContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
         {
             region = regionManager;
-
+            events = eventAggregator;
             MyToolsCommand = new DelegateCommand<CustomIconToggleBtn>(BtnMyTools_Click);
             PropertyRegionName = Guid.NewGuid().ToString();
             BindingEvent();
@@ -458,7 +462,15 @@ namespace PDF_Office.ViewModels.Tools
                 case CommandType.Context:
                     if (e.AnnotEventArgsList.Count > 0)
                     {
-                        e.PopupMenu = SelectAnnotContextMenu(sender);
+                        if (App.mainWindowViewModel.SelectedItem.IsInReadctonMode && e.AnnotEventArgsList[0].EventType == AnnotArgsType.AnnotRedaction)
+                        {
+                            //绑定标记密文处右键菜单
+                            events.GetEvent<RedactionCommandEvent>().Publish(new RedactionCommandEventArgs() { UniCode = App.mainWindowViewModel.SelectedItem.Unicode, Sender = sender, args = e });
+                        }
+                        else
+                        {
+                            e.PopupMenu = SelectAnnotContextMenu(sender);
+                        }
                         if (e.PopupMenu != null)
                         {
                             e.Handle = true;

+ 203 - 2
PDF Office/ViewModels/Tools/ScanContentViewModel.cs

@@ -1,18 +1,33 @@
-using ComPDFKitViewer.PdfViewer;
+using ComDocumentAIKit;
+using ComPDFKit.PDFDocument;
+using ComPDFKit.PDFPage;
+using ComPDFKit.PDFPage.Edit;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.Helper;
 using PDF_Office.Model;
+using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
 using System;
 using System.Collections.Generic;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
 
 namespace PDF_Office.ViewModels.Tools
 {
     class ScanContentViewModel : BindableBase, INavigationAware
     {
+        #region 模板与导航相关内容
+
         private CPDFViewer PDFViewer;
+
+        public ViewContentViewModel viewContentViewModel;
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;
@@ -20,12 +35,198 @@ namespace PDF_Office.ViewModels.Tools
 
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
-            return ;
+            return;
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+
+        }
+
+        #endregion
+
+        private IRegionManager regions;
+        public DelegateCommand NavigationCommand { get; set; }
+        public DelegateCommand EnhancedCommand { get; set; }
+        public List<string> EnhancedFilePathList;
+        public ScanContentViewModel(IRegionManager regionManager)
+        {
+            regions = regionManager;
+            NavigationCommand = new DelegateCommand(BtnNavigation);
+            EnhancedCommand = new DelegateCommand(EnhancedScan);
+            EnhancedFilePathList = new List<string>();
+        }
+
+        /// <summary>
+        ///导航到OCR的侧边栏
+        /// </summary>
+        private void BtnNavigation()
+        {
+            //替换属性面板的内容
+            NavigationParameters parameters = new NavigationParameters();
+            parameters.Add(ParameterNames.PDFViewer, PDFViewer);
+            parameters.Add(ParameterNames.PropertyPanelContentViewModel, null);
+            regions.RequestNavigate(RegionNames.PropertyRegionName, "ScanPropertyPanel", parameters);
+            //显示属性面板
+            viewContentViewModel.IsPropertyOpen = true;
+        }
+        private void EnhancedScan()
+        {
+            CPDFDocument CurrentDoc = PDFViewer.Document;
+            string path = App.CachePath.MergeFilePath;
+            string name = Guid.NewGuid().ToString();
+            path = Path.Combine(path, name);
+            string EnhancePath = Path.Combine(path, "Enhance");
+
+            Directory.CreateDirectory(path);
+            Directory.CreateDirectory(EnhancePath);
+
+            CIMEngine imEngine = new CIMEngine(App.modelFolderPath);
+            CErrorCode error = imEngine.SetModel();
+            for (int i = 0; i < CurrentDoc.PageCount; i++)
+            {
+                string pageImagePath = Path.Combine(path, i.ToString());
+                string pageEnhancePath = Path.Combine(EnhancePath, i.ToString() + ".png");
+                try
+                {
+                    CPDFPage pdfPage = CurrentDoc.PageAtIndex(i);
+                    float zoom = (float)(DpiHelpers.Dpi / 72D);
+                    int renderWidth = (int)(pdfPage.PageSize.Width * zoom);
+                    int renderHeight = (int)(pdfPage.PageSize.Height * zoom);
+                    byte[] renderData = new byte[renderWidth * renderHeight * 4];
+                    pdfPage.RenderPageBitmapWithMatrix(zoom, new Rect(0, 0, renderWidth, renderHeight), 0xFFFFFFFF, renderData, 0);
+                    WriteableBitmap bitmap = new WriteableBitmap(renderWidth, renderHeight, DpiHelpers.Dpi, DpiHelpers.Dpi, PixelFormats.Bgra32, null);
+                    bitmap.WritePixels(new Int32Rect(0, 0, renderWidth, renderHeight), renderData, bitmap.BackBufferStride, 0);
+                    BitmapEncoder encoder = new PngBitmapEncoder();
+                    encoder.Frames.Add(BitmapFrame.Create(bitmap));
+
+                    using (FileStream imageStream = File.Create(pageImagePath))
+                    {
+                        encoder.Save(imageStream);
+                        imageStream.Flush();
+                    }
+
+                    //File.Create(pageEnhancePath);
+                    error = imEngine.Process(pageImagePath, pageEnhancePath);
+                    EnhancedFilePathList.Add(pageEnhancePath);
+                }
+                catch
+                {
+
+                }
+            }
+        }
+
+        private void OCREnhancedScan()
+        {
+            CPDFDocument EnhanceDoc = CPDFDocument.CreateDocument();
+            COCREngine imEngine = new COCREngine(App.modelFolderPath);
+            //CIMEngine imEngine = new CIMEngine(App.modelFolderPath);
+
+            string path = App.CachePath.MergeFilePath;
+            string name = Guid.NewGuid().ToString();
+            path = Path.Combine(path, name);
+            string EnhancePath = Path.Combine(path, "Enhance");
+
+            Directory.CreateDirectory(path);
+            Directory.CreateDirectory(EnhancePath);
+
+            CPDFDocument CurrentDoc = PDFViewer.Document;
+            //CurrentDoc.FilePath;
+
+            CErrorCode error = imEngine.SetModel(COCRLanguage.Chinese_S);
+            //CErrorCode error = imEngine.SetModel();
+            for (int i = 0; i < 1; i++)
+            {
+                string pageImagePath = Path.Combine(path, i.ToString());
+                string pageEnhancePath = Path.Combine(EnhancePath, i.ToString() + ".png");
+                try
+                {
+                    CPDFPage pdfPage = CurrentDoc.PageAtIndex(i);
+                    float zoom = (float)(DpiHelpers.Dpi / 72D);
+                    int renderWidth = (int)(pdfPage.PageSize.Width * zoom);
+                    int renderHeight = (int)(pdfPage.PageSize.Height * zoom);
+                    byte[] renderData = new byte[renderWidth * renderHeight * 4];
+                    pdfPage.RenderPageBitmapWithMatrix(zoom, new Rect(0, 0, renderWidth, renderHeight), 0xFFFFFFFF, renderData, 0);
+                    WriteableBitmap bitmap = new WriteableBitmap(renderWidth, renderHeight, DpiHelpers.Dpi, DpiHelpers.Dpi, PixelFormats.Bgra32, null);
+                    bitmap.WritePixels(new Int32Rect(0, 0, renderWidth, renderHeight), renderData, bitmap.BackBufferStride, 0);
+                    BitmapEncoder encoder = new PngBitmapEncoder();
+                    encoder.Frames.Add(BitmapFrame.Create(bitmap));
+
+                    using (FileStream imageStream = File.Create(pageImagePath))
+                    {
+                        encoder.Save(imageStream);
+                        imageStream.Flush();
+                    }
+
+                    //File.Create(pageEnhancePath);
+                    //error = imEngine.Process(pageImagePath, pageEnhancePath);
+                    error = imEngine.Process(pageImagePath);
+
+                    if (imEngine.OCRResultList == null)
+                        return;
+
+                    List<KeyValuePair<Rect, string>> textRectList = new List<KeyValuePair<Rect, string>>();
+                    foreach (COCRResult ocrResult in imEngine.OCRResultList)
+                    {
+                        List<Point> rectPoints = new List<Point>();
+                        for (int j = 0; j < ocrResult.position.Length; j += 2)
+                        {
+                            rectPoints.Add(new Point(ocrResult.position[j], ocrResult.position[j + 1]));
+                        }
+                        int left = (int)rectPoints.AsEnumerable().Min(x => x.X);
+                        int right = (int)rectPoints.AsEnumerable().Max(x => x.X);
+                        int top = (int)rectPoints.AsEnumerable().Min(x => x.Y);
+                        int bottom = (int)rectPoints.AsEnumerable().Max(x => x.Y);
+
+                        textRectList.Add(new KeyValuePair<Rect, string>(new Rect(left, top, right - left, bottom - top), ocrResult.text));
+                    }
+
+                    CPDFEditPage editPage = pdfPage.GetEditPage();
+
+                    editPage.BeginEdit(CPDFEditType.EditText);
+                    for (int y = textRectList.Count - 1; y >= 0; y--)
+                    {
+                        KeyValuePair<Rect, string> textBlock = textRectList[y];
+                        int fontSize = 1;
+                        Rect pdfRect = DpiHelpers.GetRawRect(textBlock.Key);
+
+                        for (; fontSize < 100; fontSize++)
+                        {
+                            Rect cmpRect = pdfPage.GetTextContentRect(fontSize, "Helvetica", textBlock.Value);
+                            if (cmpRect.Width > pdfRect.Width || cmpRect.Height > pdfRect.Height)
+                            {
+                                fontSize -= 1;
+                                break;
+                            }
+                        }
+
+                        CPDFEditTextArea editArea = editPage.CreateNewTextArea(pdfRect, "Helvetica", fontSize, new byte[] { 0, 0, 0 });
+
+                        bool x = editArea.SetTextAreaAlign(TextAlignType.AlignChar);
+                        editArea.InsertText(textBlock.Value);
+
+                    }
+                    editPage.EndEdit();
+                }
+                catch (Exception e)
+                {
+                    throw;
+                }
+            }
+            //error = imEngine.Process("C:/test/9.png", "C:/test/9IM.png");
+            imEngine.Release();
+            PDFViewer.InvalidChildVisual(true);
+            return;
+
+            //更新预览
+            //int PageIndex = PDFViewer.CurrentIndex;
+            //PDFViewer.InitDocument(EnhanceDoc);
+            //PDFViewer.GoToPage(PageIndex);
+
         }
+
     }
 }

+ 19 - 0
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -538,6 +538,7 @@ namespace PDF_Office.ViewModels
             }
 
             PDFEditMode(currentBar);
+            FormMode(currentBar);
         }
 
         private void PDFEditMode(string currentBar)
@@ -561,6 +562,24 @@ namespace PDF_Office.ViewModels
             }
         }
 
+        private void FormMode(string currentBar)
+        {
+            if (currentBar == "TabItemForm")
+            {
+                if (PDFViewer != null)
+                {
+                    PDFViewer.SetMouseMode(MouseModes.FormEditTool);
+                }
+            }
+            else
+            {
+                if (PDFViewer != null && PDFViewer.MouseMode == MouseModes.FormEditTool)
+                {
+                    PDFViewer.SetMouseMode(MouseModes.PanTool);
+                }
+            }
+        }
+
         private void UndoManager_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
         {
             if (!isInPageEdit)

+ 22 - 3
PDF Office/Views/Dialog/Redaction/PageMarkDialog.xaml

@@ -7,8 +7,10 @@
     xmlns:local="clr-namespace:PDF_Office.Views.Dialog.Redaction"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
+    xmlns:redaction="clr-namespace:PDF_Office.ViewModels.Dialog.Redaction"
     Width="432"
     Height="296"
+    d:DataContext="{d:DesignInstance Type=redaction:PageMarkDialogViewModel}"
     d:DesignHeight="450"
     d:DesignWidth="800"
     prism:Dialog.WindowStyle="{StaticResource DialogWindowStyle}"
@@ -20,29 +22,39 @@
             <RadioButton
                 Height="22"
                 VerticalContentAlignment="Center"
+                Command="{Binding CheckedCommand}"
+                CommandParameter="Current"
                 Content="Mark current page"
                 IsChecked="True" />
             <RadioButton
                 Height="22"
                 Margin="0,8"
                 VerticalContentAlignment="Center"
+                Command="{Binding CheckedCommand}"
+                CommandParameter="All"
                 Content="Mark all page" />
             <RadioButton
                 Height="22"
                 VerticalContentAlignment="Center"
+                Command="{Binding CheckedCommand}"
+                CommandParameter="Odd"
                 Content="Mark odd page" />
             <RadioButton
                 Height="22"
                 Margin="0,8"
                 VerticalContentAlignment="Center"
+                Command="{Binding CheckedCommand}"
+                CommandParameter="Even"
                 Content="Mark even page" />
             <RadioButton
                 Name="RbtnCustomPage"
                 Height="22"
                 VerticalContentAlignment="Center"
+                Command="{Binding CheckedCommand}"
+                CommandParameter="Custom"
                 Content="Mark specific page range" />
             <StackPanel
-                Margin="0,8"
+                Margin="0,6,0,0"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Center"
                 Orientation="Horizontal">
@@ -51,11 +63,16 @@
                     Height="32"
                     CornerRadius="4"
                     IsEnabled="{Binding ElementName=RbtnCustomPage, Path=IsChecked}"
-                    PlaceholderText="e.g. 1,3-5,10" />
+                    PlaceholderText="e.g. 1,3-5,10"
+                    PreviewKeyDown="TextBoxEx_PreviewKeyDown"
+                    Text="{Binding CustomPage, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" />
                 <TextBlock
+                    Name="TBPageCount"
                     Margin="8,0,0,0"
                     VerticalAlignment="Center"
-                    Text="/" />
+                    FocusVisualStyle="{x:Null}"
+                    Focusable="True"
+                    Text="{Binding PageCount}" />
             </StackPanel>
         </StackPanel>
         <cus:DialogContent.BottmBar>
@@ -67,12 +84,14 @@
                     <Button
                         Width="80"
                         Height="32"
+                        Command="{Binding OkCommand}"
                         Content="Apply"
                         Style="{StaticResource Btn.cta}" />
                     <Button
                         Width="80"
                         Height="32"
                         Margin="16,0,0,0"
+                        Command="{Binding CancelCommand}"
                         Content="Cancel"
                         Style="{StaticResource btn.sec}" />
                 </StackPanel>

+ 8 - 0
PDF Office/Views/Dialog/Redaction/PageMarkDialog.xaml.cs

@@ -24,5 +24,13 @@ namespace PDF_Office.Views.Dialog.Redaction
         {
             InitializeComponent();
         }
+
+        private void TextBoxEx_PreviewKeyDown(object sender, KeyEventArgs e)
+        {
+            if(e.Key == Key.Enter)
+            {
+                TBPageCount.Focus();
+            }
+        }
     }
 }

+ 3 - 2
PDF Office/Views/Dialog/Redaction/RepeatMarkDialog.xaml

@@ -35,7 +35,7 @@
                 GroupName="Page" />
 
             <StackPanel
-                Margin="0,8"
+                Margin="0,7"
                 HorizontalAlignment="Left"
                 VerticalAlignment="Center"
                 Orientation="Horizontal">
@@ -55,7 +55,8 @@
                 <TextBlock
                     Margin="8,0,0,0"
                     VerticalAlignment="Center"
-                    Text="/" />
+                    Text="/ " />
+                <TextBlock VerticalAlignment="Center" Text="1" />
             </StackPanel>
         </StackPanel>
         <cus:DialogContent.BottmBar>

+ 9 - 2
PDF Office/Views/EditTools/Redaction/RedactionContent.xaml

@@ -2,6 +2,7 @@
     x:Class="PDF_Office.Views.EditTools.Redaction.RedactionContent"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:cus="clr-namespace:PDF_Office.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     xmlns:prism="http://prismlibrary.com/"
@@ -79,15 +80,15 @@
                     Height="24"
                     Margin="8,0"
                     Padding="8,0"
-                    Content="应用密文"
                     Command="{Binding ApplyCommmand}"
+                    Content="应用密文"
                     Style="{StaticResource Btn.cta}" />
                 <Button
                     Height="24"
                     Margin="8,0"
                     Padding="8,0"
-                    Content="擦除密文"
                     Command="{Binding RemoveCommand}"
+                    Content="擦除密文"
                     Style="{StaticResource Btn.cta}" />
                 <Button
                     Width="auto"
@@ -103,6 +104,12 @@
             <Grid>
                 <ContentControl prism:RegionManager.RegionName="{Binding RedactionDocumentRegionName}" />
             </Grid>
+            <cus:PaginationControl
+                Margin="24,24"
+                HorizontalAlignment="Left"
+                VerticalAlignment="Bottom"
+                CurrentPage="{Binding CurrentPage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
+                PageCount="{Binding PageCount}" />
         </Grid>
     </Grid>
 </UserControl>

+ 0 - 21
PDF Office/Views/EditTools/Redaction/RedactionDocumentContent.xaml

@@ -1,21 +0,0 @@
-<UserControl x:Class="PDF_Office.Views.EditTools.Redaction.RedactionDocumentContent"
-             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
-             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
-             xmlns:prism="http://prismlibrary.com/" xmlns:redaction="clr-namespace:PDF_Office.ViewModels.EditTools.Redaction" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             prism:ViewModelLocator.AutoWireViewModel="True">
-    <Grid Height="720" Width="1280">
-        <Border CornerRadius="4" Background="#323232"  HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="41,0,0,25" Height="53" Width="93"  Panel.ZIndex="1" >
-            <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
-                <TextBlock Text="{Binding CurrentPageIndex, Mode=TwoWay}" Foreground="White" FontSize="20"></TextBlock>
-                <TextBlock Text="/" Foreground="White" FontSize="20"></TextBlock>
-                <TextBlock  Text="{Binding PageRangeNumber, Mode=TwoWay}" FontSize="20"  Foreground="White"></TextBlock>
-            </StackPanel>
-        </Border>
-        <Grid Height="676" Width="1220" VerticalAlignment="Bottom" HorizontalAlignment="Right"> 
-            <ContentControl
-                x:Name="PDFViewerContent"
-                HorizontalAlignment="Stretch"
-                prism:RegionManager.RegionName="{Binding ViewerRegionName}" />
-        </Grid>
-    </Grid>
-</UserControl>

+ 0 - 15
PDF Office/Views/EditTools/Redaction/RedactionDocumentContent.xaml.cs

@@ -1,15 +0,0 @@
-using System.Windows.Controls;
-
-namespace PDF_Office.Views.EditTools.Redaction
-{
-    /// <summary>
-    /// Interaction logic for RedactionDocumentContent
-    /// </summary>
-    public partial class RedactionDocumentContent : UserControl
-    {
-        public RedactionDocumentContent()
-        {
-            InitializeComponent();
-        }
-    }
-}

File diff suppressed because it is too large
+ 410 - 2
PDF Office/Views/Form/ButtonProperty.xaml


+ 76 - 1
PDF Office/Views/Form/ButtonProperty.xaml.cs

@@ -1,4 +1,6 @@
-using System;
+using PDF_Office.CustomControl;
+using PDF_Office.ViewModels.Form;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -20,9 +22,82 @@ namespace PDF_Office.Views.Form
     /// </summary>
     public partial class ButtonProperty : UserControl
     {
+        public ButtonPropertyViewModel ViewModel => DataContext as ButtonPropertyViewModel;
         public ButtonProperty()
         {
             InitializeComponent();
+            this.Loaded += usercontrol_Loaded;
+            BindingEvent();
+        }
+
+        private void usercontrol_Loaded(object sender, RoutedEventArgs e)
+        {
+            BindingEvent();
+        }
+
+        private void BindingEvent()
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.SelectResetColorBtnHandler -= ViewModel_SelectResetColorBtnHandler;
+                ViewModel.SelectResetColorBtnHandler += ViewModel_SelectResetColorBtnHandler;
+            }
+        }
+
+        private void ViewModel_SelectResetColorBtnHandler(object sender, int e)
+        {
+            switch (e)
+            {
+                case 0:
+                    OneBtn.IsChecked = false;
+                    TwoBtn.IsChecked = false;
+                    ThreeBtn.IsChecked = false;
+                    ForthBtn.IsChecked = false;
+                    break;
+
+                case 1:
+                    OneBtn.IsChecked = true;
+                    break;
+
+                case 2:
+                    TwoBtn.IsChecked = true;
+                    break;
+
+                case 3:
+                    ThreeBtn.IsChecked = true;
+                    break;
+
+                case 4:
+                    ForthBtn.IsChecked = true;
+                    break;
+            }
+        }
+
+
+        private void EditMenuItem_Click(object sender, RoutedEventArgs e)
+        {
+            var Btnitem = sender as MenuItem;
+            if (Btnitem == null) return;
+            if (ViewModel != null)
+            {
+                // ViewModel.ResetColorCommand?.Execute(Btnitem);
+            }
+        }
+
+        private void BtnLineStyle_Click(object sender, RoutedEventArgs e)
+        {
+            var btn = sender as CustomIconToggleBtn;
+            foreach (var item in PnlLineStyle.Children)
+            {
+                var btnItem = item as CustomIconToggleBtn;
+                if (btnItem != null)
+                {
+                    if (btn != btnItem)
+                        btnItem.IsChecked = false;
+                    else
+                        btnItem.IsChecked = true;
+                }
+            }
         }
     }
 }

+ 16 - 139
PDF Office/Views/Form/CheckBoxProperty.xaml

@@ -67,7 +67,7 @@
             FontFamily="Segoe UI"
             FontSize="14"
             FontWeight="SemiBold"
-            Text="Text Field" />
+            Text="ChekcBox" />
         <TabControl
             Grid.Row="1"
             Margin="16,0"
@@ -84,10 +84,10 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Name" />
-                    <cus:TextBoxEx x:Name="TbName" Height="32" CornerRadius="4" Text="{Binding NameStr,Mode=TwoWay}" >
+                    <cus:TextBoxEx x:Name="TbName" Height="32" CornerRadius="4" Text="{Binding FieldName,Mode=TwoWay}" >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="TextChanged">
-                                <i:InvokeCommandAction Command="{Binding NameTextChangedCommand}" CommandParameter="{Binding ElementName=TbName,Path=Text}"/>
+                                <i:InvokeCommandAction Command="{Binding FieldNameTextChangedCommand}" CommandParameter="{Binding ElementName=TbName,Path=Text}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>
                     </cus:TextBoxEx>
@@ -95,7 +95,7 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="ToolTip" />
-                    <cus:TextBoxEx x:Name="TbToolTip" Height="32" CornerRadius="4" >
+                    <cus:TextBoxEx x:Name="TbToolTip" Height="32" CornerRadius="4" Text="{Binding ToolTipStr,Mode=TwoWay}">
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="TextChanged">
                                 <i:InvokeCommandAction Command="{Binding ToolTipTextChangedCommand}" CommandParameter="{Binding ElementName=TbToolTip,Path=Text}"/>
@@ -106,9 +106,9 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Form Field" />
-                    <form:FormFieldCombox x:Name="formCombox" Type="{Binding FormPos,Mode=OneWay}" Height="32" Margin="0,8,0,16" />
-                    <CheckBox x:Name="ReadOnlyCheckBox" Content="Read Only" Command="{Binding IsReadOnlyCheckedCommand}" CommandParameter="{Binding ElementName=ReadOnlyCheckBox,Path=IsChecked}"/>
-                    <CheckBox x:Name="RequiredFieldCheckBox" Margin="0,8" Content="Required field"  Command="{Binding RequiredFieldCheckedCommand}" CommandParameter="{Binding ElementName=RequiredFieldCheckBox,Path=IsChecked}"/>
+                    <form:FormFieldCombox x:Name="formCombox" Type="{Binding FormField,Mode=TwoWay}" Height="32" Margin="0,8,0,16" />
+                    <CheckBox x:Name="ReadOnlyCheckBox" Content="Read Only" IsChecked="{Binding IsReadOnly,Mode=TwoWay}"/>
+                    <CheckBox x:Name="RequiredFieldCheckBox" Margin="0,8" Content="Required field" IsChecked="{Binding IsRequiredField,Mode=TwoWay}" />
                 </StackPanel>
             </TabItem>
             <TabItem>
@@ -206,14 +206,7 @@
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Line" />
 
-
-                            <CompositeControl:SlidComboControl x:Name="thickness">
-                                <i:Interaction.Triggers>
-                                    <i:EventTrigger EventName="ValueChanged">
-                                        <i:InvokeCommandAction Command="{Binding ThicknessChangedCommand}" CommandParameter="{Binding ElementName=thickness,Path=Value}"/>
-                                    </i:EventTrigger>
-                                </i:Interaction.Triggers>
-                            </CompositeControl:SlidComboControl>
+                            <CompositeControl:SlidComboControl x:Name="thickness" Value="{Binding BorderThiness,Mode=TwoWay}"/>
 
                             <StackPanel
                 x:Name="PnlLineStyle"
@@ -226,7 +219,7 @@
                     Click="BtnLineStyle_Click"
                     Command="{Binding LineStyleCommand}"
                     CommandParameter="{Binding ElementName=BtnSolidLine, Path=Tag}"
-                    Style="{StaticResource ToggleBtnViewModeStyle}"
+                    Style="{StaticResource ToggleBtnViewModeStyle}" IsChecked="{Binding IsSolid}"
                     Tag="Solid">
                                     <Border
                         Width="108"
@@ -250,7 +243,7 @@
                     Click="BtnLineStyle_Click"
                     Command="{Binding LineStyleCommand}"
                     CommandParameter="{Binding ElementName=BtnDottedLine, Path=Tag}"
-                    Style="{StaticResource ToggleBtnViewModeStyle}"
+                    Style="{StaticResource ToggleBtnViewModeStyle}" IsChecked="{Binding IsSolid,Converter={StaticResource InvertBoolConvert}}"
                     Tag="Dotted">
                                     <Border
                         Width="108"
@@ -271,122 +264,6 @@
                             </StackPanel>
                         </StackPanel>
 
-
-
-                        <StackPanel>
-                            <TextBlock
-                        Margin="0,18,0,10"
-                        Style="{StaticResource PropertyHeaderLv2}"
-                        Text="文本" />
-
-                            <Grid Margin="0,6,0,0">
-                                <Grid.ColumnDefinitions>
-                                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                                    <ColumnDefinition Width="auto"></ColumnDefinition>
-                                </Grid.ColumnDefinitions>
-                                <Grid.RowDefinitions>
-                                    <RowDefinition Height="auto"></RowDefinition>
-                                    <RowDefinition Height="auto"></RowDefinition>
-                                    <RowDefinition Height="auto"></RowDefinition>
-                                </Grid.RowDefinitions>
-
-                                <Border BorderBrush="#E2E3E6" Grid.ColumnSpan="2"  Width="228" Height="32" Margin="12,0,4,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox IsReadOnly="True" Name="FontFamilyBox" Background="Transparent" Padding="10 10 0 0"  BorderThickness="1" BorderBrush="#FFE2E3E6">
-                                            <ComboBox.ItemContainerStyle>
-                                                <Style TargetType="{x:Type ComboBoxItem}">
-                                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                                </Style>
-                                            </ComboBox.ItemContainerStyle>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                                <TextBlock Text="Courier New" FontFamily="Courier New" Tag="Courier"  FontSize="14"/>
-                                            </ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                                <TextBlock Text="Arial" FontFamily="Arial" Tag="Helvetica" FontSize="14"/>
-                                            </ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                                <TextBlock Text="Times New Roman" FontFamily="Times New Roman" Tag="Times Roman" FontSize="14"/>
-                                            </ComboBoxItem>
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontFamilyChangedCommand}" CommandParameter="{Binding ElementName=FontFamilyBox,Path=SelectedIndex}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-
-                                        <TextBox Name="FontFamilyText" FontFamily="Segoe UI" FontSize="14" Background="White"  Padding="10 0 0 0" Margin="2,0,25,0" IsReadOnly="True"
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
-
-
-                                <Border Grid.Row="1" BorderBrush="#E2E3E6"  Width="148" Height="32" Margin="12,8,4,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox Name="FontStyleBox" IsReadOnly="True" BorderThickness="1" BorderBrush="#FFE2E3E6" Padding="10 10 0 0" Background="Transparent">
-                                            <ComboBox.ItemContainerStyle>
-                                                <Style TargetType="{x:Type ComboBoxItem}">
-                                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                                </Style>
-                                            </ComboBox.ItemContainerStyle>
-                                            <ComboBoxItem x:Name="RegularItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Regular</ComboBoxItem>
-                                            <ComboBoxItem x:Name="BoldItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold</ComboBoxItem>
-                                            <ComboBoxItem x:Name="ItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Italic</ComboBoxItem>
-                                            <ComboBoxItem x:Name="BoldItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold Italic</ComboBoxItem>
-
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontStyleChangedCommand}" CommandParameter="{Binding ElementName=FontStyleBox,Path=SelectedItem}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-                                        <TextBox Name="FontStyleText" IsReadOnly="True" FontFamily="Segoe UI" FontSize="14" Background="White" Padding="10 0 0 0" Height="20" Margin="2,0,35,0" 
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
-
-                                <Border Grid.Row="1" Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="-1,8,0,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox Name="FontSizeBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6"
-                                  MaxDropDownHeight="200">
-                                            <ComboBox.ItemContainerStyle>
-                                                <Style TargetType="{x:Type ComboBoxItem}">
-                                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                                </Style>
-                                            </ComboBox.ItemContainerStyle>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">6</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">8</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">9</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">10</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">12</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">14</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">18</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">20</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">22</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">24</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">26</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">28</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">32</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">36</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">48</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">72</ComboBoxItem>
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontSizeChangedCommand}" CommandParameter="{Binding ElementName=FontSizeBox,Path=SelectedItem}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-                                        <TextBox Name="FontSizeText" FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Padding="10 0 0 0" Margin="2,0,35,0" 
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" IsReadOnly="True">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
-
-                            </Grid>
-
-                        </StackPanel>
-
                         <StackPanel>
 
                             <TextBlock
@@ -395,10 +272,10 @@
                         Text="大小" />
                             <StackPanel Orientation="Horizontal">
                                 <Path Data="M12.9999 8.75012V10.8285L15.8284 8.00006L12.9999 5.17163V7.25012H2.82843V5.17175L0 8.00017L2.82843 10.8286V8.75012H12.9999Z" Fill="#616469"/>
-                                <cus:NumericUpDown Height="32" Width="90"/>
+                                <cus:NumericUpDown Height="32" Width="90"  Value="{Binding WidthSize,Mode=TwoWay}"/>
 
                                 <Path Data="M10.8284 2.82843H8.74999L8.74999 12.9999H10.8285L8.00005 15.8284L5.17163 12.9999H7.24999L7.24999 2.82843H5.17151L7.99994 0L10.8284 2.82843Z" Fill="#616469"/>
-                                <cus:NumericUpDown Height="32" Width="90"/>
+                                <cus:NumericUpDown Height="32" Width="90" Value="{Binding HeightSize,Mode=TwoWay}"/>
                             </StackPanel>
                         </StackPanel>
 
@@ -418,15 +295,15 @@
                 <Grid>
                     <StackPanel IsEnabled="{Binding ElementName=ChkLock, Path=IsChecked, Converter={StaticResource InvertBoolConvert}}">
                         <TextBlock Text="Default Value"/>
-                        <cus:TextBoxEx x:Name="DefaultValueBox" Height="32" CornerRadius="4" Text="{Binding FormContent,Mode=TwoWay}" >
+                        <cus:TextBoxEx x:Name="DefaultValueBox" Height="32" CornerRadius="4" Text="{Binding ExportedValues,Mode=TwoWay}" >
                             <i:Interaction.Triggers>
                                 <i:EventTrigger EventName="TextChanged">
-                                    <i:InvokeCommandAction Command="{Binding FormContentTextChangedCommand}" CommandParameter="{Binding ElementName=DefaultValueBox,Path=Text}"/>
+                                    <i:InvokeCommandAction Command="{Binding ExportedValuesTextChangedCommand}" CommandParameter="{Binding ElementName=DefaultValueBox,Path=Text}"/>
                                 </i:EventTrigger>
                             </i:Interaction.Triggers>
                         </cus:TextBoxEx>
 
-                        <CheckBox x:Name="DefaultCheckBox" Content="The checkbox is checked by default"  Command="{Binding DefaultCheckBoxCheckedCommand}" CommandParameter="{Binding ElementName=DefaultCheckBox,Path=IsChecked}"/>
+                        <CheckBox x:Name="DefaultCheckBox" Content="The checkbox is checked by default" IsChecked="{Binding IsDefaultCheckBox}"/>
 
                     </StackPanel>
                 </Grid>
@@ -446,7 +323,7 @@
             <CheckBox
                 Name="ChkLock"
                 Margin="16"
-                Content="Locked" />
+                Content="Locked" IsChecked="{Binding IsLocked,Mode=TwoWay}"/>
         </Border>
     </Grid>
 </UserControl>

+ 46 - 0
PDF Office/Views/Form/CheckBoxProperty.xaml.cs

@@ -26,8 +26,54 @@ namespace PDF_Office.Views.Form
         public CheckBoxProperty()
         {
             InitializeComponent();
+            this.Loaded += usercontrol_Loaded;
+            BindingEvent();
         }
 
+        private void usercontrol_Loaded(object sender, RoutedEventArgs e)
+        {
+            BindingEvent();
+        }
+
+        private void BindingEvent()
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.SelectResetColorBtnHandler -= ViewModel_SelectResetColorBtnHandler;
+                ViewModel.SelectResetColorBtnHandler += ViewModel_SelectResetColorBtnHandler;
+            }
+        }
+
+        private void ViewModel_SelectResetColorBtnHandler(object sender, int e)
+        {
+            switch (e)
+            {
+                case 0:
+                    OneBtn.IsChecked = false;
+                    TwoBtn.IsChecked = false;
+                    ThreeBtn.IsChecked = false;
+                    ForthBtn.IsChecked = false;
+                    break;
+
+                case 1:
+                    OneBtn.IsChecked = true;
+                    break;
+
+                case 2:
+                    TwoBtn.IsChecked = true;
+                    break;
+
+                case 3:
+                    ThreeBtn.IsChecked = true;
+                    break;
+
+                case 4:
+                    ForthBtn.IsChecked = true;
+                    break;
+            }
+        }
+
+
         private void EditMenuItem_Click(object sender, RoutedEventArgs e)
         {
             var Btnitem = sender as MenuItem;

File diff suppressed because it is too large
+ 434 - 2
PDF Office/Views/Form/ComboxProperty.xaml


+ 76 - 1
PDF Office/Views/Form/ComboxProperty.xaml.cs

@@ -1,4 +1,6 @@
-using System;
+using PDF_Office.CustomControl;
+using PDF_Office.ViewModels.Form;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -20,9 +22,82 @@ namespace PDF_Office.Views.Form
     /// </summary>
     public partial class ComboxProperty : UserControl
     {
+        public ComboxPropertyViewModel ViewModel => DataContext as ComboxPropertyViewModel;
         public ComboxProperty()
         {
             InitializeComponent();
+            this.Loaded += usercontrol_Loaded;
+            BindingEvent();
+        }
+
+        private void usercontrol_Loaded(object sender, RoutedEventArgs e)
+        {
+            BindingEvent();
+        }
+
+        private void BindingEvent()
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.SelectResetColorBtnHandler -= ViewModel_SelectResetColorBtnHandler;
+                ViewModel.SelectResetColorBtnHandler += ViewModel_SelectResetColorBtnHandler;
+            }
+        }
+
+        private void ViewModel_SelectResetColorBtnHandler(object sender, int e)
+        {
+            switch (e)
+            {
+                case 0:
+                    OneBtn.IsChecked = false;
+                    TwoBtn.IsChecked = false;
+                    ThreeBtn.IsChecked = false;
+                    ForthBtn.IsChecked = false;
+                    break;
+
+                case 1:
+                    OneBtn.IsChecked = true;
+                    break;
+
+                case 2:
+                    TwoBtn.IsChecked = true;
+                    break;
+
+                case 3:
+                    ThreeBtn.IsChecked = true;
+                    break;
+
+                case 4:
+                    ForthBtn.IsChecked = true;
+                    break;
+            }
+        }
+
+
+        private void EditMenuItem_Click(object sender, RoutedEventArgs e)
+        {
+            var Btnitem = sender as MenuItem;
+            if (Btnitem == null) return;
+            if (ViewModel != null)
+            {
+                // ViewModel.ResetColorCommand?.Execute(Btnitem);
+            }
+        }
+
+        private void BtnLineStyle_Click(object sender, RoutedEventArgs e)
+        {
+            var btn = sender as CustomIconToggleBtn;
+            foreach (var item in PnlLineStyle.Children)
+            {
+                var btnItem = item as CustomIconToggleBtn;
+                if (btnItem != null)
+                {
+                    if (btn != btnItem)
+                        btnItem.IsChecked = false;
+                    else
+                        btnItem.IsChecked = true;
+                }
+            }
         }
     }
 }

+ 66 - 119
PDF Office/Views/Form/ListBoxProperty.xaml

@@ -53,6 +53,11 @@
                     IsEnabled="True" />
 
             </ContextMenu>
+            <DataTemplate x:Key="numberData">
+                <Grid>
+                    <TextBlock Text="{Binding Content}" VerticalAlignment="Center" HorizontalAlignment="Center"/>
+                </Grid>
+            </DataTemplate>
         </ResourceDictionary>
     </UserControl.Resources>
     <Grid ScrollViewer.VerticalScrollBarVisibility="Auto">
@@ -84,10 +89,10 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Name" />
-                    <cus:TextBoxEx x:Name="TbName" Height="32" CornerRadius="4" Text="{Binding NameStr,Mode=TwoWay}" >
+                    <cus:TextBoxEx x:Name="TbName" Height="32" CornerRadius="4" Text="{Binding FieldName,Mode=TwoWay}" >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="TextChanged">
-                                <i:InvokeCommandAction Command="{Binding NameTextChangedCommand}" CommandParameter="{Binding ElementName=TbName,Path=Text}"/>
+                                <i:InvokeCommandAction Command="{Binding FieldNameTextChangedCommand}" CommandParameter="{Binding ElementName=TbName,Path=Text}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>
                     </cus:TextBoxEx>
@@ -95,7 +100,7 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="ToolTip" />
-                    <cus:TextBoxEx x:Name="TbToolTip" Height="32" CornerRadius="4" >
+                    <cus:TextBoxEx x:Name="TbToolTip" Height="32" CornerRadius="4" Text="{Binding ToolTipStr,Mode=TwoWay}">
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="TextChanged">
                                 <i:InvokeCommandAction Command="{Binding ToolTipTextChangedCommand}" CommandParameter="{Binding ElementName=TbToolTip,Path=Text}"/>
@@ -106,8 +111,9 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Form Field" />
-                    <form:FormFieldCombox x:Name="formCombox" Type="{Binding FormPos,Mode=OneWay}" Height="32" Margin="0,8,0,16" />
-                    <CheckBox x:Name="ReadOnlyCheckBox" Content="Read Only" Command="{Binding IsReadOnlyCheckedCommand}" CommandParameter="{Binding ElementName=ReadOnlyCheckBox,Path=IsChecked}"/>
+                    <form:FormFieldCombox x:Name="formCombox" Type="{Binding FormField,Mode=TwoWay}" Height="32" Margin="0,8,0,16" />
+                    <CheckBox x:Name="ReadOnlyCheckBox" Content="Read Only" IsChecked="{Binding IsReadOnly,Mode=TwoWay}"/>
+                    <CheckBox x:Name="RequiredFieldCheckBox" Margin="0,8" Content="Required field" IsChecked="{Binding IsRequiredField,Mode=TwoWay}" />
                 </StackPanel>
             </TabItem>
             <TabItem>
@@ -214,7 +220,6 @@
 
                             </Grid>
 
-
                         </StackPanel>
 
                         <StackPanel>
@@ -223,15 +228,7 @@
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Line" />
 
-
-                            <CompositeControl:SlidComboControl x:Name="thickness">
-                                <i:Interaction.Triggers>
-                                    <i:EventTrigger EventName="ValueChanged">
-                                        <i:InvokeCommandAction Command="{Binding ThicknessChangedCommand}" CommandParameter="{Binding ElementName=thickness,Path=Value}"/>
-                                    </i:EventTrigger>
-                                </i:Interaction.Triggers>
-                            </CompositeControl:SlidComboControl>
-
+                            <CompositeControl:SlidComboControl x:Name="thickness" Value="{Binding BorderThiness,Mode=TwoWay}"/>
                             <StackPanel
                 x:Name="PnlLineStyle"
                 Margin="0,20,0,0"
@@ -243,7 +240,7 @@
                     Click="BtnLineStyle_Click"
                     Command="{Binding LineStyleCommand}"
                     CommandParameter="{Binding ElementName=BtnSolidLine, Path=Tag}"
-                    Style="{StaticResource ToggleBtnViewModeStyle}"
+                    Style="{StaticResource ToggleBtnViewModeStyle}" IsChecked="{Binding IsSolid}"
                     Tag="Solid">
                                     <Border
                         Width="108"
@@ -267,7 +264,7 @@
                     Click="BtnLineStyle_Click"
                     Command="{Binding LineStyleCommand}"
                     CommandParameter="{Binding ElementName=BtnDottedLine, Path=Tag}"
-                    Style="{StaticResource ToggleBtnViewModeStyle}"
+                    Style="{StaticResource ToggleBtnViewModeStyle}" IsChecked="{Binding IsSolid,Converter={StaticResource InvertBoolConvert}}"
                     Tag="Dotted">
                                     <Border
                         Width="108"
@@ -307,98 +304,22 @@
                                     <RowDefinition Height="auto"></RowDefinition>
                                 </Grid.RowDefinitions>
 
-                                <Border BorderBrush="#E2E3E6" Grid.ColumnSpan="2"  Width="228" Height="32" Margin="12,0,4,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox IsReadOnly="True" Name="FontFamilyBox" Background="Transparent" Padding="10 10 0 0"  BorderThickness="1" BorderBrush="#FFE2E3E6">
-                                            <ComboBox.ItemContainerStyle>
-                                                <Style TargetType="{x:Type ComboBoxItem}">
-                                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                                </Style>
-                                            </ComboBox.ItemContainerStyle>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                                <TextBlock Text="Courier New" FontFamily="Courier New" Tag="Courier"  FontSize="14"/>
-                                            </ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                                <TextBlock Text="Arial" FontFamily="Arial" Tag="Helvetica" FontSize="14"/>
-                                            </ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">
-                                                <TextBlock Text="Times New Roman" FontFamily="Times New Roman" Tag="Times Roman" FontSize="14"/>
-                                            </ComboBoxItem>
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontFamilyChangedCommand}" CommandParameter="{Binding ElementName=FontFamilyBox,Path=SelectedIndex}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-
-                                        <TextBox Name="FontFamilyText" FontFamily="Segoe UI" FontSize="14" Background="White"  Padding="10 0 0 0" Margin="2,0,25,0" IsReadOnly="True"
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
-
-
-                                <Border Grid.Row="1" BorderBrush="#E2E3E6"  Width="148" Height="32" Margin="12,8,4,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox Name="FontStyleBox" IsReadOnly="True" BorderThickness="1" BorderBrush="#FFE2E3E6" Padding="10 10 0 0" Background="Transparent">
-                                            <ComboBox.ItemContainerStyle>
-                                                <Style TargetType="{x:Type ComboBoxItem}">
-                                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                                </Style>
-                                            </ComboBox.ItemContainerStyle>
-                                            <ComboBoxItem x:Name="RegularItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Regular</ComboBoxItem>
-                                            <ComboBoxItem x:Name="BoldItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold</ComboBoxItem>
-                                            <ComboBoxItem x:Name="ItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Italic</ComboBoxItem>
-                                            <ComboBoxItem x:Name="BoldItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold Italic</ComboBoxItem>
-
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontStyleChangedCommand}" CommandParameter="{Binding ElementName=FontStyleBox,Path=SelectedItem}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-                                        <TextBox Name="FontStyleText" IsReadOnly="True" FontFamily="Segoe UI" FontSize="14" Background="White" Padding="10 0 0 0" Height="20" Margin="2,0,35,0" 
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
-
-                                <Border Grid.Row="1" Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="-1,8,0,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox Name="FontSizeBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6"
-                                  MaxDropDownHeight="200">
-                                            <ComboBox.ItemContainerStyle>
-                                                <Style TargetType="{x:Type ComboBoxItem}">
-                                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                                </Style>
-                                            </ComboBox.ItemContainerStyle>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">6</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">8</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">9</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">10</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">12</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">14</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">18</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">20</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">22</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">24</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">26</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">28</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">32</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">36</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">48</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">72</ComboBoxItem>
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontSizeChangedCommand}" CommandParameter="{Binding ElementName=FontSizeBox,Path=SelectedItem}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-                                        <TextBox Name="FontSizeText" FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Padding="10 0 0 0" Margin="2,0,35,0" 
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" IsReadOnly="True">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
+                                <CompositeControl:CustomComboControl x:Name="FontFamilyBox" 
+                                                                     ItemSource="{Binding FontFamilyItems}" SelectedItems="{Binding FontFamilyData,Mode=TwoWay}"
+                                                                     IsValueContent="True" Grid.ColumnSpan="2"  Width="228" Height="32">
+                                </CompositeControl:CustomComboControl>
+
+                                <CompositeControl:CustomComboControl x:Name="FontStyleBox" Grid.Row="1"
+                                                                     Width="148" Height="32" Margin="12,8,4,0"
+                                                                     ItemSource="{Binding FontStyleItems}"  SelectedItems="{Binding FontWeightStyleItem,Mode=TwoWay}"
+                                                                     IsValueContent="True" Grid.Column="0">
+                                </CompositeControl:CustomComboControl>
+
+
+                                <CompositeControl:CustomComboControl x:Name="FontSizeBox" Grid.Row="1" Grid.Column="1" SelectedItems="{Binding FontSizeData,Mode=TwoWay}"
+                                                                     Width="80" Height="32" Margin="-1,8,0,0"
+                                                                     >
+                                </CompositeControl:CustomComboControl>
 
                             </Grid>
 
@@ -412,10 +333,10 @@
                         Text="大小" />
                             <StackPanel Orientation="Horizontal">
                                 <Path Data="M12.9999 8.75012V10.8285L15.8284 8.00006L12.9999 5.17163V7.25012H2.82843V5.17175L0 8.00017L2.82843 10.8286V8.75012H12.9999Z" Fill="#616469"/>
-                                <cus:NumericUpDown Height="32" Width="90"/>
+                                <cus:NumericUpDown Height="32" Width="90" Value="{Binding WidthSize,Mode=TwoWay}"/>
 
                                 <Path Data="M10.8284 2.82843H8.74999L8.74999 12.9999H10.8285L8.00005 15.8284L5.17163 12.9999H7.24999L7.24999 2.82843H5.17151L7.99994 0L10.8284 2.82843Z" Fill="#616469"/>
-                                <cus:NumericUpDown Height="32" Width="90"/>
+                                <cus:NumericUpDown Height="32" Width="90" Value="{Binding HeightSize,Mode=TwoWay}"/>
                             </StackPanel>
                         </StackPanel>
 
@@ -433,21 +354,27 @@
                     <Path Data="M4.91675 3.75V5H6.41675V1H4.91675V2.25H1.66675V3.75H4.91675ZM15.6667 3.75L7.66675 3.75V2.25L15.6667 2.25V3.75ZM1.66675 7.25V8.75H8.91675V10H10.4167V6H8.91675V7.25H1.66675ZM15.6667 8.75L11.6667 8.75V7.25L15.6667 7.25V8.75ZM7.66675 12.25V13.75L15.6667 13.75V12.25L7.66675 12.25ZM4.91675 13.75H1.66675V12.25H4.91675V11H6.41675V15H4.91675V13.75Z" Fill="{StaticResource color.light.gray.11}" />
                 </TabItem.Header>
                 <Grid>
-                  
+
                     <StackPanel  IsEnabled="{Binding ElementName=ChkLock, Path=IsChecked, Converter={StaticResource InvertBoolConvert}}">
                         <TextBlock
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Projects" />
                         <Grid>
-                            <cus:TextBoxEx
+                            <cus:TextBoxEx x:Name="TbOptionKey"
                             Width="188"
                             Height="32"
                             HorizontalAlignment="Left"
-                            CornerRadius="4" />
-                            <Button
+                            CornerRadius="4" Text="{Binding OptionKey,Mode=TwoWay}">
+                                <i:Interaction.Triggers>
+                                    <i:EventTrigger EventName="TextChanged">
+                                        <i:InvokeCommandAction Command="{Binding OptionKeyTextChangedCommand}" CommandParameter="{Binding ElementName=TbOptionKey,Path=Text}"/>
+                                    </i:EventTrigger>
+                                </i:Interaction.Triggers>
+                            </cus:TextBoxEx>
+                            <Button 
                             Width="32"
-                            HorizontalAlignment="Right"
+                            HorizontalAlignment="Right"  Command="{Binding AddOptionCommand}" IsEnabled="{Binding IsInputOption}"
                             Style="{StaticResource btn.sec-icon}">
                                 <Path Data="M7.25 8.75V14H8.75V8.75H14V7.25H8.75V2H7.25V7.25H2V8.75H7.25Z" />
                             </Button>
@@ -456,12 +383,26 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Exported Values" />
-                        <cus:TextBoxEx Height="32" CornerRadius="4" />
-                        <ListBox Height="98" Margin="0,8" />
+                        <cus:TextBoxEx x:Name="TbOptionKeyValue" Height="32" CornerRadius="4" Text="{Binding OptionKeyValue,Mode=TwoWay}">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="TextChanged">
+                                    <i:InvokeCommandAction Command="{Binding OptionKeyValueTextChangedCommand}" CommandParameter="{Binding ElementName=TbOptionKeyValue,Path=Text}"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </cus:TextBoxEx>
+                        <ListBox x:Name="optionList" Height="98" Margin="0,8" ItemsSource="{Binding OptionItems}" ItemTemplate="{StaticResource numberData}">
+                            <i:Interaction.Triggers>
+                                <i:EventTrigger EventName="SelectionChanged">
+                                    <i:InvokeCommandAction Command="{Binding OptionSelectionChangedCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedIndex}"/>
+                                </i:EventTrigger>
+                            </i:Interaction.Triggers>
+                        </ListBox>
                         <StackPanel Margin="0,0,0,8" Orientation="Horizontal">
                             <Button
                             Width="32"
                             Height="32"
+                                IsEnabled="{Binding IsRemoveOption}"
+                              Command="{Binding RemoveOptionCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedItem}" 
                             Style="{StaticResource btn.sec-icon}">
                                 <Path Data="M6 1.75H10V0.25H6V1.75ZM1 4.25H2.25V15C2.25 15.4142 2.58579 15.75 3 15.75H13C13.4142 15.75 13.75 15.4142 13.75 15V4.25H15V2.75H1V4.25ZM3.75 14.25V4.25H12.25V14.25H3.75ZM7.25 6.5V11.5H8.75V6.5H7.25Z" />
                             </Button>
@@ -469,12 +410,16 @@
                             Width="32"
                             Height="32"
                             Margin="8,0"
+                                IsEnabled="{Binding IsDownOption}"
+                             Command="{Binding DownItemOptionCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedItem}"    
                             Style="{StaticResource btn.sec-icon}">
                                 <Path Data="M8.72505 12.4147L8.72505 1.02539L7.22505 1.02539L7.22505 12.4147L4.9054 10.0951L3.84474 11.1557L7.44471 14.7557C7.7376 15.0486 8.21248 15.0486 8.50537 14.7557L12.1053 11.1557L11.0447 10.0951L8.72505 12.4147Z" />
                             </Button>
                             <Button
                             Width="32"
                             Height="32"
+                            IsEnabled="{Binding IsUpOption}"
+                             Command="{Binding UpItemOptionCommand}" CommandParameter="{Binding ElementName=optionList,Path=SelectedItem}"
                             Style="{StaticResource btn.sec-icon}">
                                 <Path Data="M8.77509 3.58605L11.0947 5.9057L12.1554 4.84504L8.55542 1.24506C8.26253 0.952167 7.78765 0.952167 7.49476 1.24506L3.89478 4.84504L4.95544 5.9057L7.27509 3.58605L7.27509 14.9754L8.77509 14.9754L8.77509 3.58605Z" />
                             </Button>
@@ -498,7 +443,9 @@
             <CheckBox
                 Name="ChkLock"
                 Margin="16"
-                Content="Locked" />
+                Content="Locked" IsChecked="{Binding IsLocked,Mode=TwoWay}">
+
+            </CheckBox>
         </Border>
     </Grid>
 </UserControl>

+ 46 - 0
PDF Office/Views/Form/ListBoxProperty.xaml.cs

@@ -26,8 +26,54 @@ namespace PDF_Office.Views.Form
         public ListBoxProperty()
         {
             InitializeComponent();
+            this.Loaded += usercontrol_Loaded;
+            BindingEvent();
         }
 
+        private void usercontrol_Loaded(object sender, RoutedEventArgs e)
+        {
+            BindingEvent();
+        }
+
+        private void BindingEvent()
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.SelectResetColorBtnHandler -= ViewModel_SelectResetColorBtnHandler;
+                ViewModel.SelectResetColorBtnHandler += ViewModel_SelectResetColorBtnHandler;
+            }
+        }
+
+        private void ViewModel_SelectResetColorBtnHandler(object sender, int e)
+        {
+            switch (e)
+            {
+                case 0:
+                    OneBtn.IsChecked = false;
+                    TwoBtn.IsChecked = false;
+                    ThreeBtn.IsChecked = false;
+                    ForthBtn.IsChecked = false;
+                    break;
+
+                case 1:
+                    OneBtn.IsChecked = true;
+                    break;
+
+                case 2:
+                    TwoBtn.IsChecked = true;
+                    break;
+
+                case 3:
+                    ThreeBtn.IsChecked = true;
+                    break;
+
+                case 4:
+                    ForthBtn.IsChecked = true;
+                    break;
+            }
+        }
+
+
         private void EditMenuItem_Click(object sender, RoutedEventArgs e)
         {
             var Btnitem = sender as MenuItem;

File diff suppressed because it is too large
+ 317 - 2
PDF Office/Views/Form/RadioButtonProperty.xaml


+ 76 - 1
PDF Office/Views/Form/RadioButtonProperty.xaml.cs

@@ -1,4 +1,6 @@
-using System;
+using PDF_Office.CustomControl;
+using PDF_Office.ViewModels.Form;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -20,9 +22,82 @@ namespace PDF_Office.Views.Form
     /// </summary>
     public partial class RadioButtonProperty : UserControl
     {
+        public RadioButtonPropertyViewModel ViewModel => DataContext as RadioButtonPropertyViewModel;
         public RadioButtonProperty()
         {
             InitializeComponent();
+            this.Loaded += usercontrol_Loaded;
+            BindingEvent();
+        }
+
+        private void usercontrol_Loaded(object sender, RoutedEventArgs e)
+        {
+            BindingEvent();
+        }
+
+        private void BindingEvent()
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.SelectResetColorBtnHandler -= ViewModel_SelectResetColorBtnHandler;
+                ViewModel.SelectResetColorBtnHandler += ViewModel_SelectResetColorBtnHandler;
+            }
+        }
+
+        private void ViewModel_SelectResetColorBtnHandler(object sender, int e)
+        {
+            switch (e)
+            {
+                case 0:
+                    OneBtn.IsChecked = false;
+                    TwoBtn.IsChecked = false;
+                    ThreeBtn.IsChecked = false;
+                    ForthBtn.IsChecked = false;
+                    break;
+
+                case 1:
+                    OneBtn.IsChecked = true;
+                    break;
+
+                case 2:
+                    TwoBtn.IsChecked = true;
+                    break;
+
+                case 3:
+                    ThreeBtn.IsChecked = true;
+                    break;
+
+                case 4:
+                    ForthBtn.IsChecked = true;
+                    break;
+            }
+        }
+
+
+        private void EditMenuItem_Click(object sender, RoutedEventArgs e)
+        {
+            var Btnitem = sender as MenuItem;
+            if (Btnitem == null) return;
+            if (ViewModel != null)
+            {
+                // ViewModel.ResetColorCommand?.Execute(Btnitem);
+            }
+        }
+
+        private void BtnLineStyle_Click(object sender, RoutedEventArgs e)
+        {
+            var btn = sender as CustomIconToggleBtn;
+            foreach (var item in PnlLineStyle.Children)
+            {
+                var btnItem = item as CustomIconToggleBtn;
+                if (btnItem != null)
+                {
+                    if (btn != btnItem)
+                        btnItem.IsChecked = false;
+                    else
+                        btnItem.IsChecked = true;
+                }
+            }
         }
     }
 }

File diff suppressed because it is too large
+ 289 - 2
PDF Office/Views/Form/SignProperty.xaml


+ 75 - 1
PDF Office/Views/Form/SignProperty.xaml.cs

@@ -1,4 +1,6 @@
-using System;
+using PDF_Office.CustomControl;
+using PDF_Office.ViewModels.Form;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -20,9 +22,81 @@ namespace PDF_Office.Views.Form
     /// </summary>
     public partial class SignProperty : UserControl
     {
+        public SignPropertyViewModel ViewModel => DataContext as SignPropertyViewModel;
         public SignProperty()
         {
             InitializeComponent();
+            this.Loaded += usercontrol_Loaded;
+            BindingEvent();
+        }
+        private void usercontrol_Loaded(object sender, RoutedEventArgs e)
+        {
+            BindingEvent();
+        }
+
+        private void BindingEvent()
+        {
+            if (ViewModel != null)
+            {
+                ViewModel.SelectResetColorBtnHandler -= ViewModel_SelectResetColorBtnHandler;
+                ViewModel.SelectResetColorBtnHandler += ViewModel_SelectResetColorBtnHandler;
+            }
+        }
+
+        private void ViewModel_SelectResetColorBtnHandler(object sender, int e)
+        {
+            switch (e)
+            {
+                case 0:
+                    OneBtn.IsChecked = false;
+                    TwoBtn.IsChecked = false;
+                    ThreeBtn.IsChecked = false;
+                    ForthBtn.IsChecked = false;
+                    break;
+
+                case 1:
+                    OneBtn.IsChecked = true;
+                    break;
+
+                case 2:
+                    TwoBtn.IsChecked = true;
+                    break;
+
+                case 3:
+                    ThreeBtn.IsChecked = true;
+                    break;
+
+                case 4:
+                    ForthBtn.IsChecked = true;
+                    break;
+            }
+        }
+
+
+        private void EditMenuItem_Click(object sender, RoutedEventArgs e)
+        {
+            var Btnitem = sender as MenuItem;
+            if (Btnitem == null) return;
+            if (ViewModel != null)
+            {
+                // ViewModel.ResetColorCommand?.Execute(Btnitem);
+            }
+        }
+
+        private void BtnLineStyle_Click(object sender, RoutedEventArgs e)
+        {
+            var btn = sender as CustomIconToggleBtn;
+            foreach (var item in PnlLineStyle.Children)
+            {
+                var btnItem = item as CustomIconToggleBtn;
+                if (btnItem != null)
+                {
+                    if (btn != btnItem)
+                        btnItem.IsChecked = false;
+                    else
+                        btnItem.IsChecked = true;
+                }
+            }
         }
     }
 }

+ 36 - 110
PDF Office/Views/Form/TextFieldProperty.xaml

@@ -87,10 +87,10 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Name" />
-                    <cus:TextBoxEx x:Name="TbName" Height="32" CornerRadius="4" Text="{Binding NameStr,Mode=TwoWay}" >
+                    <cus:TextBoxEx x:Name="TbName" Height="32" CornerRadius="4" Text="{Binding FieldName,Mode=TwoWay}" >
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="TextChanged">
-                                <i:InvokeCommandAction Command="{Binding NameTextChangedCommand}" CommandParameter="{Binding ElementName=TbName,Path=Text}"/>
+                                <i:InvokeCommandAction Command="{Binding FieldNameTextChangedCommand}" CommandParameter="{Binding ElementName=TbName,Path=Text}"/>
                             </i:EventTrigger>
                         </i:Interaction.Triggers>
                     </cus:TextBoxEx>
@@ -98,7 +98,7 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="ToolTip" />
-                    <cus:TextBoxEx x:Name="TbToolTip" Height="32" CornerRadius="4" >
+                    <cus:TextBoxEx x:Name="TbToolTip" Height="32" CornerRadius="4" Text="{Binding ToolTipStr,Mode=TwoWay}">
                         <i:Interaction.Triggers>
                             <i:EventTrigger EventName="TextChanged">
                                 <i:InvokeCommandAction Command="{Binding ToolTipTextChangedCommand}" CommandParameter="{Binding ElementName=TbToolTip,Path=Text}"/>
@@ -109,9 +109,9 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Form Field" />
-                    <form:FormFieldCombox x:Name="formCombox" Type="{Binding FormPos,Mode=OneWay}" Height="32" Margin="0,8,0,16" />
-                    <CheckBox x:Name="ReadOnlyCheckBox" Content="Read Only" Command="{Binding IsReadOnlyCheckedCommand}" CommandParameter="{Binding ElementName=ReadOnlyCheckBox,Path=IsChecked}"/>
-                    <CheckBox x:Name="RequiredFieldCheckBox" Margin="0,8" Content="Required field"  Command="{Binding RequiredFieldCheckedCommand}" CommandParameter="{Binding ElementName=RequiredFieldCheckBox,Path=IsChecked}"/>
+                    <form:FormFieldCombox x:Name="formCombox" Type="{Binding FormField,Mode=TwoWay}"  Height="32" Margin="0,8,0,16" />
+                    <CheckBox x:Name="ReadOnlyCheckBox" Content="Read Only" IsChecked="{Binding IsReadOnly,Mode=TwoWay}"/>
+                    <CheckBox x:Name="RequiredFieldCheckBox" Margin="0,8" Content="Required field" IsChecked="{Binding IsRequiredField,Mode=TwoWay}" />
                 </StackPanel>
             </TabItem>
             <TabItem>
@@ -206,16 +206,8 @@
                         Margin="0,18,0,10"
                         Style="{StaticResource PropertyHeaderLv2}"
                         Text="Line" />
-
-
-                            <CompositeControl:SlidComboControl x:Name="thickness">
-                                <i:Interaction.Triggers>
-                                    <i:EventTrigger EventName="ValueChanged">
-                                        <i:InvokeCommandAction Command="{Binding ThicknessChangedCommand}" CommandParameter="{Binding ElementName=thickness,Path=Value}"/>
-                                    </i:EventTrigger>
-                                </i:Interaction.Triggers>
-                            </CompositeControl:SlidComboControl>
-
+                            
+                            <CompositeControl:SlidComboControl x:Name="thickness" Value="{Binding BorderThiness,Mode=TwoWay}"/>
                             <StackPanel
                 x:Name="PnlLineStyle"
                 Margin="0,20,0,0"
@@ -291,76 +283,22 @@
                                     <RowDefinition Height="auto"></RowDefinition>
                                 </Grid.RowDefinitions>
 
-                                <CompositeControl:CustomComboControl x:Name="FontFamilyBox" ItemSource="{Binding Items}" IsValueContent="True" Grid.ColumnSpan="2"  Width="228" Height="32">
-                                    <i:Interaction.Triggers>
-                                        <i:EventTrigger EventName="ValueChanged">
-                                            <i:InvokeCommandAction Command="{Binding FontFamilyChangedCommand}" CommandParameter="{Binding ElementName=FontFamilyBox,Path=ValueStr}"/>
-                                        </i:EventTrigger>
-                                    </i:Interaction.Triggers>
+                                <CompositeControl:CustomComboControl x:Name="FontFamilyBox" 
+                                                                     ItemSource="{Binding FontFamilyItems}" SelectedItems="{Binding FontFamilyData,Mode=TwoWay}"
+                                                                     IsValueContent="True" Grid.ColumnSpan="2"  Width="228" Height="32">
                                 </CompositeControl:CustomComboControl>
-                              
-  
-                                <Border Grid.Row="1" BorderBrush="#E2E3E6"  Width="148" Height="32" Margin="12,8,4,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox Name="FontStyleBox" IsReadOnly="True" BorderThickness="1" BorderBrush="#FFE2E3E6" Padding="10 10 0 0" Background="Transparent">
-                                            <ComboBox.ItemContainerStyle>
-                                                <Style TargetType="{x:Type ComboBoxItem}">
-                                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                                </Style>
-                                            </ComboBox.ItemContainerStyle>
-                                            <ComboBoxItem x:Name="RegularItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Regular</ComboBoxItem>
-                                            <ComboBoxItem x:Name="BoldItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold</ComboBoxItem>
-                                            <ComboBoxItem x:Name="ItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Italic</ComboBoxItem>
-                                            <ComboBoxItem x:Name="BoldItalicItem" Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Bold Italic</ComboBoxItem>
 
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontStyleChangedCommand}" CommandParameter="{Binding ElementName=FontStyleBox,Path=SelectedItem}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-                                        <TextBox Name="FontStyleText" IsReadOnly="True" FontFamily="Segoe UI" FontSize="14" Background="White" Padding="10 0 0 0" Height="20" Margin="2,0,35,0" 
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
+                                <CompositeControl:CustomComboControl x:Name="FontStyleBox" Grid.Row="1"
+                                                                     Width="148" Height="32" Margin="12,8,4,0"
+                                                                     ItemSource="{Binding FontStyleItems}"  SelectedItems="{Binding FontWeightStyleItem,Mode=TwoWay}"
+                                                                     IsValueContent="True" Grid.Column="0">
+                                </CompositeControl:CustomComboControl>
 
-                                <Border Grid.Row="1" Grid.Column="1" BorderBrush="#E2E3E6"  Width="80" Height="32" Margin="-1,8,0,0"  BorderThickness="0">
-                                    <Grid>
-                                        <ComboBox Name="FontSizeBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6"
-                                  MaxDropDownHeight="200">
-                                            <ComboBox.ItemContainerStyle>
-                                                <Style TargetType="{x:Type ComboBoxItem}">
-                                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                                </Style>
-                                            </ComboBox.ItemContainerStyle>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">6</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">8</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">9</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">10</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">12</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">14</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">18</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">20</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">22</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">24</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">26</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">28</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">32</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">36</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">48</ComboBoxItem>
-                                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">72</ComboBoxItem>
-                                            <i:Interaction.Triggers>
-                                                <i:EventTrigger EventName="SelectionChanged">
-                                                    <i:InvokeCommandAction Command="{Binding FontSizeChangedCommand}" CommandParameter="{Binding ElementName=FontSizeBox,Path=SelectedItem}"/>
-                                                </i:EventTrigger>
-                                            </i:Interaction.Triggers>
-                                        </ComboBox>
-                                        <TextBox Name="FontSizeText" FontFamily="Segoe UI" FontSize="14" Background="White" Height="20" Padding="10 0 0 0" Margin="2,0,35,0" 
-                             BorderThickness="0" VerticalAlignment="Center" TextAlignment="Left" IsReadOnly="True">
-                                        </TextBox>
-                                    </Grid>
-                                </Border>
+
+                                <CompositeControl:CustomComboControl x:Name="FontSizeBox" Grid.Row="1" Grid.Column="1" SelectedItems="{Binding FontSizeData,Mode=TwoWay}"
+                                                                     Width="80" Height="32" Margin="-1,8,0,0"
+                                                                     >
+                                </CompositeControl:CustomComboControl>
 
                             </Grid>
 
@@ -374,10 +312,10 @@
                         Text="大小" />
                             <StackPanel Orientation="Horizontal">
                                 <Path Data="M12.9999 8.75012V10.8285L15.8284 8.00006L12.9999 5.17163V7.25012H2.82843V5.17175L0 8.00017L2.82843 10.8286V8.75012H12.9999Z" Fill="#616469"/>
-                                <cus:NumericUpDown Height="32" Width="90"/>
+                                <cus:NumericUpDown Height="32" Width="90" Value="{Binding WidthSize,Mode=TwoWay}"/>
 
                                 <Path Data="M10.8284 2.82843H8.74999L8.74999 12.9999H10.8285L8.00005 15.8284L5.17163 12.9999H7.24999L7.24999 2.82843H5.17151L7.99994 0L10.8284 2.82843Z" Fill="#616469"/>
-                                <cus:NumericUpDown Height="32" Width="90"/>
+                                <cus:NumericUpDown Height="32" Width="90" Value="{Binding HeightSize,Mode=TwoWay}"/>
                             </StackPanel>
                         </StackPanel>
                      
@@ -397,25 +335,14 @@
                 <Grid>
                     <StackPanel IsEnabled="{Binding ElementName=ChkLock, Path=IsChecked, Converter={StaticResource InvertBoolConvert}}">
                         <TextBlock Text="Alignment"/>
-                        <ComboBox Name="AlignmentBox" BorderThickness="1" Background="Transparent" BorderBrush="#FFE2E3E6"
-                                  MaxDropDownHeight="200">
-                            <ComboBox.ItemContainerStyle>
-                                <Style TargetType="{x:Type ComboBoxItem}">
-                                    <Setter Property="Padding" Value="10 0 0 0"/>
-                                </Style>
-                            </ComboBox.ItemContainerStyle>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Left</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Center</ComboBoxItem>
-                            <ComboBoxItem Height="32" VerticalContentAlignment="Center" Template="{StaticResource comboxitem}">Right</ComboBoxItem>
-                            <i:Interaction.Triggers>
-                                <i:EventTrigger EventName="SelectionChanged">
-                                    <i:InvokeCommandAction Command="{Binding AlignmentChangedCommand}" CommandParameter="{Binding ElementName=AlignmentBox,Path=SelectedItem}"/>
-                                </i:EventTrigger>
-                            </i:Interaction.Triggers>
-                        </ComboBox>
-
+                        <CompositeControl:CustomComboControl x:Name="AlignmentBox" Grid.Row="1" Grid.Column="1"
+                                                                   ItemSource="{Binding AglinmentItems}" SelectedItems="{Binding TextAlignmentData,Mode=TwoWay}"
+                                                             IsValueContent="True" Height="32" Margin="-1,8,0,0"
+                                                                     >
+                        </CompositeControl:CustomComboControl>
+                        
                         <TextBlock Text="Default Value"/>
-                        <cus:TextBoxEx x:Name="DefaultValueBox" Height="150" CornerRadius="4" Text="{Binding FormContent,Mode=TwoWay}" >
+                        <cus:TextBoxEx x:Name="DefaultValueBox" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" Height="150" CornerRadius="4" Text="{Binding FormContent,Mode=TwoWay}" >
                             <i:Interaction.Triggers>
                                 <i:EventTrigger EventName="TextChanged">
                                     <i:InvokeCommandAction Command="{Binding FormContentTextChangedCommand}" CommandParameter="{Binding ElementName=DefaultValueBox,Path=Text}"/>
@@ -423,8 +350,9 @@
                             </i:Interaction.Triggers>
                         </cus:TextBoxEx>
 
-                        <CheckBox x:Name="MultiLineCheck" Content="Nulti-line"  Command="{Binding IsMultiLineCheckedCommand}" CommandParameter="{Binding ElementName=MultiLineCheck,Path=IsChecked}"/>
-                        <CheckBox x:Name="ScrollToDisplayLongCheck" Content="Scroll to display long text"  Command="{Binding IsScrollToDisplayCheckedCommand}" CommandParameter="{Binding ElementName=ScrollToDisplayLongCheck,Path=IsChecked}"/>
+
+                        <CheckBox x:Name="MultiLineCheck" Content="Nulti-line" IsChecked="{Binding IsMultiLine,Mode=TwoWay}"/>
+                        <CheckBox x:Name="ScrollToDisplayLongCheck" Content="Scroll to display long text" IsChecked="{Binding IsScrollText,Mode=TwoWay}"/>
                     </StackPanel>
 
                     <StackPanel Visibility="Collapsed" IsEnabled="{Binding ElementName=ChkLock, Path=IsChecked, Converter={StaticResource InvertBoolConvert}}">
@@ -481,10 +409,6 @@
                 </Grid>
 
                
-
-
-
-               
             </TabItem>
 
         </TabControl>
@@ -495,7 +419,9 @@
             <CheckBox
                 Name="ChkLock"
                 Margin="16"
-                Content="Locked" />
+                Content="Locked" IsChecked="{Binding IsLocked,Mode=TwoWay}">
+            
+            </CheckBox>
         </Border>
     </Grid>
 </UserControl>

+ 5 - 0
PDF Office/Views/MainContent.xaml.cs

@@ -35,6 +35,11 @@ namespace PDF_Office.Views
         /// </summary>
         public Dictionary<string, string> RegionContentNames { get; set; }
 
+        /// <summary>
+        /// 是否处于标记密文模式
+        /// </summary>
+        public bool IsInReadctonMode { get; set; } = false;
+
         public MainContent()
         {
             InitializeComponent();

+ 35 - 0
PDF Office/Views/PropertyPanel/Scan/ScanPropertyPanel.xaml

@@ -0,0 +1,35 @@
+<UserControl x:Class="PDF_Office.Views.PropertyPanel.Scan.ScanPropertyPanel"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:PDF_Office.Views.PropertyPanel.Scan" xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl"
+             mc:Ignorable="d" >
+    <Grid>
+        <StackPanel>
+        <TextBlock Text="识别文本"/>
+            <customcontrol:PathRadioButton
+                MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6" 
+                HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
+                <customcontrol:PathRadioButton.Content >
+                    <TextBlock Text="页面识别"/>
+                </customcontrol:PathRadioButton.Content>
+            </customcontrol:PathRadioButton>
+            <customcontrol:PathRadioButton
+                MouseOverBackground="#EDEEF0" MouseDownBackground="#CED0D4" MouseDownBackgroundOpacity="0.6" 
+                HorizontalContentAlignment="Center" VerticalContentAlignment="Center">
+                <customcontrol:PathRadioButton.Content >
+                    <TextBlock Text="区域识别"/>
+                </customcontrol:PathRadioButton.Content>
+            </customcontrol:PathRadioButton>
+            <ComboBox SelectedIndex="0">
+                <TextBlock Text="English"/>
+                <TextBlock Text="Chinese Simplified"/>
+                <TextBlock Text="Chinese Traditional"/>
+                <TextBlock Text="French"/>
+            </ComboBox>
+            <customcontrol:WritableComboBox SelectedIndex="0" MaxPageRange="{Binding PageCount}" Text="{Binding SetPageRange,Mode=TwoWay}"/>
+            <Button Content="OCR"/>
+        </StackPanel>
+    </Grid>
+</UserControl>

+ 28 - 0
PDF Office/Views/PropertyPanel/Scan/ScanPropertyPanel.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace PDF_Office.Views.PropertyPanel.Scan
+{
+    /// <summary>
+    /// ScanPropertyPanel.xaml 的交互逻辑
+    /// </summary>
+    public partial class ScanPropertyPanel : UserControl
+    {
+        public ScanPropertyPanel()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 25 - 4
PDF Office/Views/Tools/ScanContent.xaml

@@ -3,10 +3,31 @@
              xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
              xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
              xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
-             xmlns:local="clr-namespace:PDF_Office.Views.Tools"
-             mc:Ignorable="d" 
-             d:DesignHeight="450" d:DesignWidth="800">
+             xmlns:local="clr-namespace:PDF_Office.Views.Tools" xmlns:customcontrol="clr-namespace:PDF_Office.CustomControl" xmlns:tools="clr-namespace:PDF_Office.ViewModels.Tools" d:DataContext="{d:DesignInstance Type=tools:ScanContentViewModel}"
+             mc:Ignorable="d" >
     <Grid>
-            
+        <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
+            <customcontrol:ImageButton HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
+            Padding="3" Command="{Binding EnhancedCommand}"
+            MouseOverBackground="#000000" MouseOverBackgroundOpacity="0.25"
+            Icon="pack://application:,,,/PDF Office;component/Resources/ToolBarIcon/Scan/enhance.png"  
+            IconPress="pack://application:,,,/PDF Office;component/Resources/ToolBarIcon/Scan/enhance.png"  
+            IconMouseOver="pack://application:,,,/PDF Office;component/Resources/ToolBarIcon/Scan/enhance.png"
+            Background="Transparent" Content="增强扫描"/>
+            <customcontrol:ImageButton HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
+            Padding="3" Command="{Binding NavigationCommand}"
+            MouseOverBackground="#000000" MouseOverBackgroundOpacity="0.25"                         
+            Icon="pack://application:,,,/PDF Office;component/Resources/ToolBarIcon/Scan/ocr.png"  
+            IconPress="pack://application:,,,/PDF Office;component/Resources/ToolBarIcon/Scan/ocr.png"  
+            IconMouseOver="pack://application:,,,/PDF Office;component/Resources/ToolBarIcon/Scan/ocr.png"
+            Background="Transparent" Content="识别文本"/>
+            <customcontrol:ImageButton HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
+            Padding="3"
+            MouseOverBackground="#000000" MouseOverBackgroundOpacity="0.25"
+            Icon="pack://application:,,,/PDF Office;component/Resources/ToolBarIcon/Scan/batch.png"  
+            IconPress="pack://application:,,,/PDF Office;component/Resources/ToolBarIcon/Scan/batch.png"  
+            IconMouseOver="pack://application:,,,/PDF Office;component/Resources/ToolBarIcon/Scan/batch.png"
+            Background="Transparent" Content="批量识别文本"/>
+        </StackPanel>
     </Grid>
 </UserControl>

+ 3 - 1
PDF Office/Views/ViewContent.xaml

@@ -278,7 +278,9 @@
             <ContentControl prism:RegionManager.RegionName="{Binding BOTARegionName}" />
             <GridSplitter
                 Grid.Column="1"
-                Width="0"
+                Width="3"
+                Background="Transparent"
+                Cursor="SizeWE"
                 FocusVisualStyle="{x:Null}"
                 ResizeBehavior="PreviousAndNext"
                 ShowsPreview="True" />

BIN
PDF Office/x64/ComPDFKit.dll