浏览代码

Merge branch 'dev' of http://git.kdan.cc:8865/Windows/PDFOffice_Windows_exe into dev

zhuyi 2 年之前
父节点
当前提交
84cea22242
共有 26 个文件被更改,包括 1518 次插入442 次删除
  1. 二进制
      PDF Office/ComPDFKit.Viewer.dll
  2. 8 0
      PDF Office/PDF Office.csproj
  3. 39 4
      PDF Office/Styles/ButtonStyle.xaml
  4. 1 0
      PDF Office/Styles/TabControlStyle.xaml
  5. 33 4
      PDF Office/ViewModels/EditTools/Redaction/RedactionContentViewModel.cs
  6. 127 0
      PDF Office/ViewModels/Form/ButtonPropertyViewModel.cs
  7. 117 0
      PDF Office/ViewModels/Form/CheckBoxPropertyViewModel.cs
  8. 111 0
      PDF Office/ViewModels/Form/ComboxPropertyViewModel.cs
  9. 101 0
      PDF Office/ViewModels/Form/FormBaseVM.cs
  10. 79 3
      PDF Office/ViewModels/Form/FormsToolContentViewModel.cs
  11. 115 0
      PDF Office/ViewModels/Form/ListBoxPropertyViewModel.cs
  12. 114 0
      PDF Office/ViewModels/Form/RadioButtonPropertyViewModel.cs
  13. 94 0
      PDF Office/ViewModels/Form/SignPropertyViewModel.cs
  14. 129 0
      PDF Office/ViewModels/Form/TextFieldPropertyViewModel.cs
  15. 294 373
      PDF Office/ViewModels/PropertyPanel/TextEditPropertyViewModel.cs
  16. 6 0
      PDF Office/ViewModels/ViewContentViewModel.cs
  17. 53 27
      PDF Office/Views/EditTools/Redaction/RedactionContent.xaml
  18. 2 0
      PDF Office/Views/Form/ButtonProperty.xaml
  19. 2 0
      PDF Office/Views/Form/CheckBoxProperty.xaml
  20. 2 0
      PDF Office/Views/Form/ComboxProperty.xaml
  21. 2 0
      PDF Office/Views/Form/ListBoxProperty.xaml
  22. 2 0
      PDF Office/Views/Form/RadioButtonProperty.xaml
  23. 2 0
      PDF Office/Views/Form/SignProperty.xaml
  24. 2 0
      PDF Office/Views/Form/TextFieldProperty.xaml
  25. 77 31
      PDF Office/Views/MainWindow.xaml
  26. 6 0
      PDF Office/Views/MainWindow.xaml.cs

二进制
PDF Office/ComPDFKit.Viewer.dll


+ 8 - 0
PDF Office/PDF Office.csproj

@@ -378,7 +378,15 @@
     <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" />
+    <Compile Include="ViewModels\Form\FormBaseVM.cs" />
     <Compile Include="ViewModels\Form\FormsToolContentViewModel.cs" />
+    <Compile Include="ViewModels\Form\ListBoxPropertyViewModel.cs" />
+    <Compile Include="ViewModels\Form\RadioButtonPropertyViewModel.cs" />
+    <Compile Include="ViewModels\Form\SignPropertyViewModel.cs" />
+    <Compile Include="ViewModels\Form\TextFieldPropertyViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\PDFTools\PDFToolsContentViewModel.cs" />
     <Compile Include="ViewModels\HomePanel\PDFTools\QuickToolsContentViewModel.cs" />
     <Compile Include="ViewModels\PropertyPanel\AnnotPanel\SignatureAnnotPropertyViewModel.cs" />

+ 39 - 4
PDF Office/Styles/ButtonStyle.xaml

@@ -1,4 +1,7 @@
 <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
+    <ResourceDictionary.MergedDictionaries>
+        <ResourceDictionary Source="pack://application:,,,/PDF Office;component/Styles/CustomBtnStyle.xaml" />
+    </ResourceDictionary.MergedDictionaries>
 
     <Style x:Key="FocusVisual">
         <Setter Property="Control.Template">
@@ -92,16 +95,14 @@
                     </Border>
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="true">
-                            <Setter TargetName="border" Property="Background" Value="{StaticResource Button.MouseOver.Background}" />
+                            <Setter TargetName="border" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
                             <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.MouseOver.Border}" />
                         </Trigger>
                         <Trigger Property="IsPressed" Value="true">
-                            <Setter TargetName="border" Property="Background" Value="{StaticResource Button.Pressed.Background}" />
+                            <Setter TargetName="border" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
                             <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Pressed.Border}" />
                         </Trigger>
                         <Trigger Property="IsEnabled" Value="false">
-                            <Setter TargetName="border" Property="Background" Value="{StaticResource Button.Disabled.Background}" />
-                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.Disabled.Border}" />
                             <Setter TargetName="contentPresenter" Property="TextElement.Foreground" Value="{StaticResource Button.Disabled.Foreground}" />
                             <Setter TargetName="contentPresenter" Property="Opacity" Value="0.5" />
                         </Trigger>
@@ -111,6 +112,40 @@
         </Setter>
     </Style>
 
+    <Style
+        x:Key="CloseBtn"
+        BasedOn="{StaticResource TitleBarBtn}"
+        TargetType="{x:Type Button}">
+        <Setter Property="Template">
+            <Setter.Value>
+                <ControlTemplate TargetType="{x:Type Button}">
+                    <Border
+                        x:Name="border"
+                        Background="{TemplateBinding Background}"
+                        BorderBrush="{TemplateBinding BorderBrush}"
+                        BorderThickness="{TemplateBinding BorderThickness}"
+                        SnapsToDevicePixels="true">
+                        <ContentPresenter
+                            x:Name="contentPresenter"
+                            Margin="{TemplateBinding Padding}"
+                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
+                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                            Focusable="False"
+                            RecognizesAccessKey="True"
+                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
+                    </Border>
+                    <ControlTemplate.Triggers>
+                        <Trigger Property="IsMouseOver" Value="true">
+                            <Setter TargetName="border" Property="Background" Value="{StaticResource CloseButton.MouseOver.Foreground}" />
+                            <Setter TargetName="border" Property="BorderBrush" Value="{StaticResource Button.MouseOver.Border}" />
+                            <Setter TargetName="contentPresenter" Property="Opacity" Value="0.8" />
+                        </Trigger>
+                    </ControlTemplate.Triggers>
+                </ControlTemplate>
+            </Setter.Value>
+        </Setter>
+    </Style>
+
     <!--  只有内容的按钮(普通状态下,没有固定的边框和背景色)  -->
     <!--<Setter Property="Background" Value="{StaticResource Button.Static.Background}" />
     <Setter Property="BorderBrush" Value="{StaticResource Button.Static.Border}" />-->

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

@@ -226,6 +226,7 @@
         </Setter>
     </Style>
 
+    <!--  Design Token TabItem ControlTemplate  for Forms Property Title  -->
     <ControlTemplate x:Key="Segmented" TargetType="{x:Type TabItem}">
         <Grid x:Name="templateRoot" SnapsToDevicePixels="True">
             <Border

+ 33 - 4
PDF Office/ViewModels/EditTools/Redaction/RedactionContentViewModel.cs

@@ -1,4 +1,5 @@
-using ComPDFKitViewer.PdfViewer;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
 using PDF_Office.EventAggregators;
 using PDF_Office.Model;
 using Prism.Commands;
@@ -9,6 +10,7 @@ using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Windows;
+using System.Windows.Media;
 
 namespace PDF_Office.ViewModels.EditTools.Redaction
 {
@@ -41,6 +43,9 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
 
         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 });
         }
 
@@ -56,9 +61,33 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
-            NavigationParameters param = new NavigationParameters();
-            param.Add(ParameterNames.PDFViewer, PDFViewer);
-            redactionRegion.RequestNavigate(RedactionDocumentRegionName, RedactionDocumentName, param);
+            if(!redactionRegion.Regions[RedactionDocumentRegionName].Views.Contains(PDFViewer))
+            {
+                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 = "";
+                //}
+                annotArgs = redactionArgs;
+                if (annotArgs != null)
+                {
+                    //annotArgs.Author = Settings.Default.AppProperties.Description.Author;
+                    PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                    PDFViewer.SetToolParam(annotArgs);
+                }
+                redactionRegion.AddToRegion(RedactionDocumentRegionName, PDFViewer);
+            }
+  
         }
     }
 }

+ 127 - 0
PDF Office/ViewModels/Form/ButtonPropertyViewModel.cs

@@ -0,0 +1,127 @@
+using ComPDFKitViewer.AnnotEvent;
+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;
+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
+
+
+        #endregion
+
+        #region Command
+
+        #endregion
+
+        #region 变量
+        private CPDFViewer PDFViewer;
+        private WidgetPushButtonArgs pushButtonArgs;
+        #endregion
+
+        #region 初始化
+        public ButtonPropertyViewModel()
+        {
+            InitVariable();
+            InitCommand();
+        }
+
+        private void InitVariable()
+        {
+
+        }
+
+        private void InitCommand()
+        {
+
+        }
+
+        #endregion
+
+
+        #region 一般处理
+
+        #endregion
+
+        #region 外观处理
+
+        #endregion
+
+        #region 选项处理
+
+        #endregion
+
+        #region Navegation
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            pushButtonArgs = null;
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<WidgetPushButtonArgs>("WidgetArgs", out pushButtonArgs);
+
+            GetWidgeText();
+        }
+
+        private void GetWidgeText()
+        {
+            if (pushButtonArgs == null)
+            {
+                WidgetPushButtonArgs pushButtonArgs = new WidgetPushButtonArgs();
+                pushButtonArgs.BgColor = Colors.White;
+                pushButtonArgs.FontFamily = "Courier New";
+                pushButtonArgs.FontSize = 12;
+                pushButtonArgs.FontColor = Colors.Black;
+                pushButtonArgs.LineColor = Colors.Black;
+                pushButtonArgs.LineWidth = 1;
+                var action = new Dictionary<ComPDFKit.PDFDocument.Action.C_ACTION_TYPE, string>();
+                action.Add(ComPDFKit.PDFDocument.Action.C_ACTION_TYPE.ACTION_TYPE_URI, "");
+                pushButtonArgs.ActionDict = action;
+                pushButtonArgs.FieldName = "PushButton";
+                pushButtonArgs.Text = "PushButton";
+
+                this.pushButtonArgs = pushButtonArgs;
+            }
+
+            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
+            PDFViewer.SetToolParam(pushButtonArgs);
+        }
+
+
+        #endregion
+    }
+}

+ 117 - 0
PDF Office/ViewModels/Form/CheckBoxPropertyViewModel.cs

@@ -0,0 +1,117 @@
+using ComPDFKitViewer.AnnotEvent;
+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;
+using System.Windows.Media;
+
+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); }
+        }
+
+
+        #endregion
+
+        #endregion
+
+        #region Command
+
+        #endregion
+
+        #region 变量
+        private CPDFViewer PDFViewer;
+        private WidgetCheckBoxArgs checkBoxArgs;
+        #endregion
+
+        #region 初始化
+        public CheckBoxPropertyViewModel()
+        {
+            InitVariable();
+            InitCommand();
+        }
+
+        private void InitVariable()
+        {
+
+        }
+
+        private void InitCommand()
+        {
+
+        }
+
+        #endregion
+
+
+        #region 一般处理
+
+        #endregion
+
+        #region 外观处理
+
+        #endregion
+
+        #region 选项处理
+
+        #endregion
+
+        #region Navegation
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            checkBoxArgs = null;
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<WidgetCheckBoxArgs>("WidgetArgs", out checkBoxArgs);
+
+            GetWidgeText();
+        }
+
+        private void GetWidgeText()
+        {
+            if (checkBoxArgs == null)
+            {
+                checkBoxArgs = new WidgetCheckBoxArgs();
+            }
+
+            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
+            PDFViewer.SetToolParam(checkBoxArgs);
+        }
+
+
+        #endregion
+    }
+}

+ 111 - 0
PDF Office/ViewModels/Form/ComboxPropertyViewModel.cs

@@ -0,0 +1,111 @@
+using ComPDFKitViewer.AnnotEvent;
+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.Form
+{
+    public class ComboxPropertyViewModel : FormBaseVM, INavigationAware
+    {
+        #region 属性
+
+        #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
+
+        #region Command
+
+        #endregion
+
+        #region 变量
+        private CPDFViewer PDFViewer;
+        private WidgetComboBoxArgs comboBoxArgs;
+        #endregion
+
+        #region 初始化
+        public ComboxPropertyViewModel()
+        {
+            InitVariable();
+            InitCommand();
+        }
+
+        private void InitVariable()
+        {
+
+        }
+
+        private void InitCommand()
+        {
+
+        }
+
+        #endregion
+
+
+        #region 一般处理
+
+        #endregion
+
+        #region 外观处理
+
+        #endregion
+
+        #region 选项处理
+
+        #endregion
+
+        #region Navegation
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            comboBoxArgs = null;
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<WidgetComboBoxArgs>("WidgetArgs", out comboBoxArgs);
+
+            GetWidgeText();
+        }
+
+        private void GetWidgeText()
+        {
+            if (comboBoxArgs == null)
+            {
+                comboBoxArgs = new WidgetComboBoxArgs();
+            }
+
+            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
+            PDFViewer.SetToolParam(comboBoxArgs);
+        }
+
+
+        #endregion
+    }
+}

+ 101 - 0
PDF Office/ViewModels/Form/FormBaseVM.cs

@@ -0,0 +1,101 @@
+using Prism.Mvvm;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media;
+
+namespace PDF_Office.ViewModels.Form
+{
+    public class FormBaseVM : BindableBase
+    {
+        #region 一般
+        //提示
+        private string _toolTipStr;
+        public string ToolTipStr
+        {
+            get { return _toolTipStr; }
+            set { SetProperty(ref _toolTipStr, value); }
+        }
+        //名称
+        private string _nameStr;
+        public string NameStr
+        {
+            get { return _nameStr; }
+            set { SetProperty(ref _nameStr, value); }
+        }
+
+        //只读
+        public bool _isReadOnly = false;
+        public bool IsReadOnly
+        {
+            get { return _isReadOnly; }
+            set { SetProperty(ref _isReadOnly, value); }
+        }
+
+        //必填
+        public bool _isRequiredField = false;
+        public bool IsRequiredField
+        {
+            get { return _isRequiredField; }
+            set { SetProperty(ref _isRequiredField, value); }
+        }
+        //锁定
+        public bool _isLocked = false;
+        public bool IsLocked
+        {
+            get { return _isLocked; }
+            set { SetProperty(ref _isLocked, value); }
+        }
+
+        #endregion
+
+        #region 外观
+        //边框大小
+        private double _borderThiness = 0;
+        private double BorderThiness
+        {
+            get { return _borderThiness; }
+            set { SetProperty(ref _borderThiness, value); }
+        }
+        //是否为实线条
+        private bool _isSolid = true;
+        private bool IsSolid
+        {
+            get { return _isSolid; }
+            set { SetProperty(ref _isSolid, value); }
+        }
+        //宽大小
+        private double _widthSize = 150;
+        private double WidthSize
+        {
+            get { return _widthSize; }
+            set { SetProperty(ref _widthSize, value); }
+        }
+        //高大小
+        private double _heightSize = 22;
+        private double HeightSize
+        {
+            get { return _heightSize; }
+            set { SetProperty(ref _heightSize, value); }
+        }
+        //边框颜色
+        private Color _borderColor = Colors.Transparent;
+        private Color BorderColor
+        {
+            get { return _borderColor; }
+            set { SetProperty(ref _borderColor, value); }
+        }
+        //内容颜色
+        private Color _contentColor = Colors.Transparent;
+        private Color ContentColo
+        {
+            get { return _contentColor; }
+            set { SetProperty(ref _contentColor, value); }
+        }
+
+
+        #endregion
+    }
+}

+ 79 - 3
PDF Office/ViewModels/Form/FormsToolContentViewModel.cs

@@ -1,4 +1,6 @@
-using ComPDFKitViewer.PdfViewer;
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
 using PDF_Office.Model;
 using Prism.Commands;
 using Prism.Mvvm;
@@ -67,13 +69,76 @@ namespace PDF_Office.ViewModels.Form
         /// </summary>
         /// <param name="type"></param>
         private void CheckedEvent(string type)
+        {
+            AddToPropertyPanel(type);
+
+        }
+
+        private void AddToPropertyPanel(string type, WidgetArgs widget = null)
         {
             if (btnToProperty.ContainsKey(type))
             {
-                regions.RequestNavigate(RegionNames.PropertyRegionName, btnToProperty[type]);
+                NavigationParameters parameters = new NavigationParameters();
+                parameters.Add(ParameterNames.PDFViewer, PDFViewer);
+                parameters.Add("WidgetArgs", widget);
+                regions.RequestNavigate(RegionNames.PropertyRegionName, btnToProperty[type], parameters);
+                ShowPropertyPanel(true);
             }
         }
 
+        #region 获取Form
+
+        private void GetTextField()
+        {
+            
+        }
+
+        private void GetButton()
+        {
+
+        }
+
+        private void GeCheckBox()
+        {
+
+        }
+
+        private void GetCombox()
+        {
+
+        }
+
+        private void GetListBox()
+        {
+
+        }
+
+        private void GetRadioButton()
+        {
+
+        }
+
+        private void GetSign()
+        {
+
+        }
+
+
+        #endregion
+
+        private void ShowPropertyPanel(bool show = true)
+        {
+            viewContentViewModel.IsPropertyOpen = show;
+        }
+
+        #region 表单内部触发的事件(比如选中表单行为等)
+        private void PDFViewer_WidgetClickHander(object sender, WidgetArgs e)
+        {
+
+        }
+
+        #endregion
+
         #region Navegation
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
@@ -88,7 +153,18 @@ namespace PDF_Office.ViewModels.Form
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
             navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel,out viewContentViewModel);
-            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.ViewContentViewModel, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+
+            BindingFormHandler();
+        }
+
+        private void BindingFormHandler()
+        {
+            if(PDFViewer != null)
+            {
+                PDFViewer.WidgetClickHander -= PDFViewer_WidgetClickHander;
+                PDFViewer.WidgetClickHander += PDFViewer_WidgetClickHander;
+            }
         }
         #endregion
     }

+ 115 - 0
PDF Office/ViewModels/Form/ListBoxPropertyViewModel.cs

@@ -0,0 +1,115 @@
+using ComPDFKitViewer.AnnotEvent;
+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.Form
+{
+
+    public class ListBoxPropertyViewModel : FormBaseVM, INavigationAware
+    {
+        #region 属性
+
+        #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); }
+        }
+
+        #endregion
+
+        #endregion
+
+        #region Command
+
+        #endregion
+
+        #region 变量
+        private CPDFViewer PDFViewer;
+        private WidgetListBoxArgs listBoxArgs;
+        #endregion
+
+        #region 初始化
+        public ListBoxPropertyViewModel()
+        {
+            InitVariable();
+            InitCommand();
+        }
+
+        private void InitVariable()
+        {
+
+        }
+
+        private void InitCommand()
+        {
+
+        }
+
+        #endregion
+
+
+        #region 一般处理
+
+        #endregion
+
+        #region 外观处理
+
+        #endregion
+
+        #region 选项处理
+
+        #endregion
+
+        #region Navegation
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            listBoxArgs = null;
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<WidgetListBoxArgs>("WidgetArgs", out listBoxArgs);
+
+            GetWidgeText();
+        }
+
+        private void GetWidgeText()
+        {
+            if (listBoxArgs == null)
+            {
+                listBoxArgs = new WidgetListBoxArgs();
+            }
+
+            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
+            PDFViewer.SetToolParam(listBoxArgs);
+        }
+
+
+        #endregion
+    }
+}

+ 114 - 0
PDF Office/ViewModels/Form/RadioButtonPropertyViewModel.cs

@@ -0,0 +1,114 @@
+using ComPDFKitViewer.AnnotEvent;
+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;
+using System.Windows.Media;
+
+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
+
+
+        #endregion
+
+        #region Command
+
+        #endregion
+
+        #region 变量
+        private CPDFViewer PDFViewer;
+        private WidgetRadioButtonArgs radioButtonArgs;
+        #endregion
+
+        #region 初始化
+        public RadioButtonPropertyViewModel()
+        {
+            InitVariable();
+            InitCommand();
+        }
+
+        private void InitVariable()
+        {
+
+        }
+
+        private void InitCommand()
+        {
+
+        }
+
+        #endregion
+
+
+        #region 一般处理
+
+        #endregion
+
+        #region 外观处理
+
+        #endregion
+
+        #region 选项处理
+
+        #endregion
+
+        #region Navegation
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            radioButtonArgs = null;
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<WidgetRadioButtonArgs>("WidgetArgs", out radioButtonArgs);
+
+            GetWidgeText();
+        }
+
+        private void GetWidgeText()
+        {
+            if (radioButtonArgs == null)
+            {
+                radioButtonArgs = new WidgetRadioButtonArgs();
+            }
+
+            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
+            PDFViewer.SetToolParam(radioButtonArgs);
+        }
+
+
+        #endregion
+    }
+}

+ 94 - 0
PDF Office/ViewModels/Form/SignPropertyViewModel.cs

@@ -0,0 +1,94 @@
+using ComPDFKitViewer.AnnotEvent;
+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.Form
+{
+    public class SignPropertyViewModel : BindableBase, INavigationAware
+    {
+        #region 属性
+
+        #endregion
+
+        #region Command
+
+        #endregion
+
+        #region 变量
+        private CPDFViewer PDFViewer;
+        private WidgetSignArgs signArgs;
+        #endregion
+
+        #region 初始化
+        public SignPropertyViewModel()
+        {
+            InitVariable();
+            InitCommand();
+        }
+
+        private void InitVariable()
+        {
+
+        }
+
+        private void InitCommand()
+        {
+
+        }
+
+        #endregion
+
+
+        #region 一般处理
+
+        #endregion
+
+        #region 外观处理
+
+        #endregion
+
+        #region 选项处理
+
+        #endregion
+
+        #region Navegation
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            signArgs = null;
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<WidgetSignArgs>("WidgetArgs", out signArgs);
+
+            GetWidgeText();
+        }
+
+        private void GetWidgeText()
+        {
+            if (signArgs == null)
+            {
+                signArgs = new WidgetSignArgs();
+            }
+
+            PDFViewer.SetMouseMode(MouseModes.FormEditTool);
+            PDFViewer.SetToolParam(signArgs);
+        }
+
+
+        #endregion
+    }
+}

+ 129 - 0
PDF Office/ViewModels/Form/TextFieldPropertyViewModel.cs

@@ -0,0 +1,129 @@
+using ComPDFKitViewer.AnnotEvent;
+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;
+using System.Windows.Media;
+
+namespace PDF_Office.ViewModels.Form
+{
+    public class TextFieldPropertyViewModel : FormBaseVM, INavigationAware
+    {
+        #region 属性
+
+
+        #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); }
+        }
+
+        //滚动显示长文本
+        private bool _isScrollText = false;
+        public bool IsScrollText
+        {
+            get { return _isScrollText; }
+            set { SetProperty(ref _isScrollText, value); }
+        }
+
+        #endregion
+
+        #endregion
+
+        #region Command
+
+        #endregion
+
+        #region 变量
+        private CPDFViewer PDFViewer;
+        private WidgetTextBoxArgs textBoxArgs;
+        #endregion
+
+        #region 初始化
+        public TextFieldPropertyViewModel()
+        {
+            InitVariable();
+            InitCommand();
+        }
+
+        private void InitVariable()
+        {
+
+        }
+
+        private void InitCommand()
+        {
+
+        }
+
+        #endregion
+
+
+        #region 一般处理
+
+        #endregion
+
+        #region 外观处理
+
+        #endregion
+
+        #region 选项处理
+
+        #endregion
+
+        #region Navegation
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+            textBoxArgs = null;
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            navigationContext.Parameters.TryGetValue<WidgetTextBoxArgs>("WidgetArgs", out textBoxArgs);
+           
+            GetWidgeText();
+        }
+
+        private void GetWidgeText()
+        {
+            if (textBoxArgs == null)
+            {
+                WidgetTextBoxArgs textArgs = new WidgetTextBoxArgs();
+                textArgs.BgColor = Colors.Transparent;
+                textArgs.FontSize = 12;
+                textArgs.FontFamily = "Courier New";
+                textArgs.FontColor = Colors.Black;
+                textArgs.FieldName = "TextBox";
+                textBoxArgs = textArgs;
+            }
+
+            PDFViewer.SetMouseMode(MouseModes.FormEditTool); 
+            PDFViewer.SetToolParam(textBoxArgs);
+        }
+
+       
+        #endregion
+    }
+}

+ 294 - 373
PDF Office/ViewModels/PropertyPanel/TextEditPropertyViewModel.cs

@@ -23,83 +23,41 @@ namespace PDF_Office.ViewModels.PropertyPanel
         #region 属性
 
         #region 编辑PDF全局
-
+        //多选时,选中的既是文本也是图像
         private bool _isSelectTextAndImg = false;
-        public bool IsSelectTextAndImg
-        {
-            get { return _isSelectTextAndImg; }
-            set
-            {
-                SetProperty(ref _isSelectTextAndImg, value);
-
-            }
-        }
+        public bool IsSelectTextAndImg{get { return _isSelectTextAndImg; } set {SetProperty(ref _isSelectTextAndImg, value);}}
 
+        //平均对齐布局
         private bool _isLayoutAvgAlign = false;
-        public bool IsLayoutAvgAlign
-        {
-            get { return _isLayoutAvgAlign; }
-            set
-            {
-                SetProperty(ref _isLayoutAvgAlign, value);
-
-            }
-        }
+        public bool IsLayoutAvgAlign { get { return _isLayoutAvgAlign; }set {SetProperty(ref _isLayoutAvgAlign, value); }}
+        //对齐布局
 
         private bool _isLayoutAlign = false;
-        public bool IsLayoutAlign
-        {
-            get { return _isLayoutAlign; }
-            set
-            {
-                SetProperty(ref _isLayoutAlign, value);
-
-            }
-        }
+        public bool IsLayoutAlign {get { return _isLayoutAlign; }set{SetProperty(ref _isLayoutAlign, value);}}
+        //是否为文本
 
         private bool _isTextEdit = true;
-        public bool IsTextEdit
-        {
-            get { return _isTextEdit; }
-            set
-            {
-                SetProperty(ref _isTextEdit, value);
-
-            }
-        }
+        public bool IsTextEdit {get { return _isTextEdit; }set{ SetProperty(ref _isTextEdit, value);} }
 
 
         #endregion
 
 
-
         #region 文本属性
 
         private double _angle;
-        public double Angle
-        {
-            get { return _angle; }
-            set
-            {
-                SetProperty(ref _angle, value);
-
-            }
-        }
+        public double Angle{ get { return _angle; }set{ SetProperty(ref _angle, value);}}
 
         private Brush selectColor = new SolidColorBrush(Colors.Black);
-        public Brush SelectColor
-        {
+        public Brush SelectColor {
             get { return selectColor; }
-            set
-            {
+            set{
                 SetProperty(ref selectColor, value);
 
                 if (TextEditEvent != null)
                 {
-                    bool isok = TextEditEvent.FontColor.A != (SelectColor as SolidColorBrush).Color.A ||
-                         TextEditEvent.FontColor.B != (SelectColor as SolidColorBrush).Color.B ||
-                         TextEditEvent.FontColor.G != (SelectColor as SolidColorBrush).Color.G ||
-                         TextEditEvent.FontColor.R != (SelectColor as SolidColorBrush).Color.R;
+                    bool isok = TextEditEvent.FontColor.A != (SelectColor as SolidColorBrush).Color.A ||TextEditEvent.FontColor.B != (SelectColor as SolidColorBrush).Color.B ||
+                         TextEditEvent.FontColor.G != (SelectColor as SolidColorBrush).Color.G ||TextEditEvent.FontColor.R != (SelectColor as SolidColorBrush).Color.R;
 
                     if (isok)
                     {
@@ -109,7 +67,6 @@ namespace PDF_Office.ViewModels.PropertyPanel
 
                 }
 
-
             }
         }
 
@@ -158,7 +115,6 @@ namespace PDF_Office.ViewModels.PropertyPanel
             }
         }
 
-
         private int fontSize = 24;
         public int TextFontSize
         {
@@ -198,7 +154,7 @@ namespace PDF_Office.ViewModels.PropertyPanel
             }
         }
 
-
+        //选中的图像
         private System.Windows.Media.Imaging.BitmapSource _currentImg;
         public System.Windows.Media.Imaging.BitmapSource CurrentImg
         {
@@ -214,9 +170,13 @@ namespace PDF_Office.ViewModels.PropertyPanel
 
         #endregion
 
-
         #region Command
 
+        #region 全局
+
+        public event EventHandler ClearCheckedAglin;
+        #endregion
+
         #region 文本Command
         public DelegateCommand AddTextCommand { get; set; }
         public DelegateCommand AddImgCommand { get; set; }
@@ -253,17 +213,19 @@ namespace PDF_Office.ViewModels.PropertyPanel
 
         #endregion
 
-        public event EventHandler ClearCheckedAglin;
+        #endregion
 
+        #region 变量
+        private PDFEditEvent TextEditEvent;
+        private CPDFViewer PDFViewer;
         #endregion
 
-        private ComPDFKitViewer.PDFEditEvent TextEditEvent;
+        #region 初始化
         public TextEditPropertyViewModel()
         {
             InitVariable();
             InitCommand();
         }
-
         private void InitVariable()
         {
             InitFontStyles();
@@ -297,137 +259,25 @@ namespace PDF_Office.ViewModels.PropertyPanel
             CancelCropCommand = new DelegateCommand(CancelCropImg);
         }
 
-        private void ImgAlignChecked(object obj)
-        {
-            if (obj != null)
-            {
-                switch((string)obj)
-                {
-                    case "AlignLeft":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignLeft);
-                        break;
-                    case "AlignHorizonCenter":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignHorizonCenter);
-                        break;
-                    case "AlignRight":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignRight);
-                        break;
-                    case "DistributeHorizontal":
-                        PDFViewer.SetPDFEditAligment(AlignModes.DistributeHorizontal);
-                        break;
-                    case "AlignTop":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignTop);
-                        break;
-                    case "AlignVerticalCenter":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignVerticalCenter);
-                        break;
-                    case "AlignBottom":
-                        PDFViewer.SetPDFEditAligment(AlignModes.AlignBottom);
-                        break;
-                    case "DistributeVertical":
-                        PDFViewer.SetPDFEditAligment(AlignModes.DistributeVertical);
-                        break;
-                }
-              
-            }
-        }
-
-        private void CancelCropImg()
-        {
-            if (TextEditEvent != null)
-            {
-                TextEditEvent.ClipImage = false;
-                TextEditEvent.CancelClip();
-                
-                TextEditEvent.UpdatePDFEditByEventArgs();
-                IsCrop = false;
-            }
-        }
-
-        private void CropImg()
-        {
-           if(TextEditEvent != null)
-            {
-                TextEditEvent.SaveClip();
-                TextEditEvent.ClipImage = false;
-                TextEditEvent.UpdatePDFEditByEventArgs();
-                IsCrop = false;
-            }
-        }
-
-        private void ExportImg()
-        {
-            if (PDFViewer == null || TextEditEvent == null || TextEditEvent.EditType != ComPDFKit.PDFPage.CPDFEditType.EditImage) return;
-
-            //SaveFileDialog saveFileDialog = new SaveFileDialog();
-            //saveFileDialog.Filter = "png|*.png;|Image|*.gif;*.jpg;*.jpeg;*.bmp;*.jfif;*.png;";
-            //saveFileDialog.FileName = "编辑PDF导出图片";
-
-            System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowserDialog();
-            folder.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
-
-            if (folder.ShowDialog() == System.Windows.Forms.DialogResult.OK)
-            {
-                if (string.IsNullOrEmpty(folder.SelectedPath))
-                    return;
-
-                var keyValueList = PDFViewer.GetSelectedImages();
-                int i = 0;
-                foreach (var bitmap in keyValueList)
-                {
-                   foreach(var bitmapItem in bitmap.Value)
-                    {
-                        bitmapItem.Save(folder.SelectedPath + "\\" + i + ".png", System.Drawing.Imaging.ImageFormat.Png);
-                        i++;
-                    }
-                }
-
+        #endregion
 
-                
-            }
-        }
+        #region 文本处理
 
-        private void AddImg()
+        private void AddText()
         {
-            OpenFileDialog openFileDialog = new OpenFileDialog();
-            openFileDialog.Filter = "png|*.png;|Image|*.gif;*.jpg;*.jpeg;*.bmp;*.jfif;*.png;";
-            openFileDialog.Multiselect = true;
-            if ((bool)openFileDialog.ShowDialog())
-            {
-                if (string.IsNullOrEmpty(openFileDialog.FileName) == false)
-                {
-                    PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
-                    PDFViewer.AddPDFEditImage(openFileDialog.FileName);
-                }
-            }
+            PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditText);
         }
 
-        private void ReplaceImg()
+        private void EditTextMode()
         {
-            OpenFileDialog openFileDialog = new OpenFileDialog();
-            openFileDialog.Filter = "png|*.png;|Image|*.gif;*.jpg;*.jpeg;*.bmp;*.jfif;*.png;";
-            openFileDialog.Multiselect = true;
-            if ((bool)openFileDialog.ShowDialog())
-            {
-                if (string.IsNullOrEmpty(openFileDialog.FileName) == false)
-                {
-                    PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
-                    TextEditEvent.ReplaceImagePath = openFileDialog.FileName;
-                    TextEditEvent.UpdatePDFEditByEventArgs();
-                }
-            }
-        }
 
-        private void AddText()
-        {
-            PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditText);
         }
 
         private void TextAlignChecked(object obj)
         {
-           if((string)obj != null && TextEditEvent != null)
+            if ((string)obj != null && TextEditEvent != null)
             {
-                switch((string)obj)
+                switch ((string)obj)
                 {
                     case "AlignLeft":
                         TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignLeft;
@@ -440,7 +290,7 @@ namespace PDF_Office.ViewModels.PropertyPanel
                     case "AlignRight":
                         TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignRight;
                         break;
-                        
+
                     case "Align":
                         TextEditEvent.TextAlign = ComPDFKit.PDFPage.Edit.TextAlignType.AlignNone;
                         break;
@@ -462,16 +312,6 @@ namespace PDF_Office.ViewModels.PropertyPanel
         }
 
 
-        private void CropMode()
-        {
-            IsCrop = true;
-            if(TextEditEvent != null)
-            {
-                TextEditEvent.ClipImage = true;
-                TextEditEvent.UpdatePDFEditByEventArgs();
-            }
-        }
-
         private void SelectedColor(object obj)
         {
             if (obj != null)
@@ -494,79 +334,52 @@ namespace PDF_Office.ViewModels.PropertyPanel
             }
         }
 
-
         private void FontFamilyChanged(object obj)
         {
-            if (obj != null)
+            if (obj != null && (int)obj > -1)
             {
-                if ((int)obj > -1)
+                switch ((int)obj)
                 {
-                    if ((int)obj == 0)
-                    {
-
-                        TextFontFamily = new FontFamily("Courier");
-                    }
-
-
-                    if ((int)obj == 1)
-                    {
-                        TextFontFamily = new FontFamily("Helvetica");
-
-                    }
-
-
-                    if ((int)obj == 2)
-                    {
-                        TextFontFamily = new FontFamily("Times");
-
-                    }
-
+                    case 0: TextFontFamily = new FontFamily("Courier"); break;
+                    case 1: TextFontFamily = new FontFamily("Helvetica"); break;
+                    case 2: TextFontFamily = new FontFamily("Times"); break;
                 }
             }
 
         }
 
-
-
         private void FontStyleChanged(object obj)
         {
-            if (obj != null)
+            if (obj != null && (ComboBoxItem)obj != null)
             {
                 var item = (ComboBoxItem)obj;
                 var content = (string)item.Content;
                 if (content != null)
                 {
-                    if (content == "Regular")
-                    {
-                        TextFontWeights = FontWeights.Normal;
-                        TextFontStyle = FontStyles.Normal;
-                    }
-
-
-                    if (content == "Bold")
-                    {
-                        TextFontWeights = FontWeights.Bold;
-                        TextFontStyle = FontStyles.Normal;
-                    }
-
-
-                    if (content == "Italic")
+                    switch (content)
                     {
-                        TextFontWeights = FontWeights.Normal;
-                        TextFontStyle = FontStyles.Italic;
-                    }
-
-                    if (content == "Bold Italic")
-                    {
-                        TextFontWeights = FontWeights.Bold;
-                        TextFontStyle = FontStyles.Italic;
+                        case "Regular":
+                            TextFontWeights = FontWeights.Normal;
+                            TextFontStyle = FontStyles.Normal;
+                            break;
+                        case "Bold":
+                            TextFontWeights = FontWeights.Bold;
+                            TextFontStyle = FontStyles.Normal;
+                            break;
+                        case "Italic":
+                            TextFontWeights = FontWeights.Normal;
+                            TextFontStyle = FontStyles.Italic;
+                            break;
+                        case "Bold Italic":
+                            TextFontWeights = FontWeights.Bold;
+                            TextFontStyle = FontStyles.Italic;
+                            break;
                     }
 
                 }
             }
         }
 
-
         private void FontSizeChanged(object obj)
         {
             if (obj != null)
@@ -582,211 +395,307 @@ namespace PDF_Office.ViewModels.PropertyPanel
         }
 
 
-        private CPDFViewer PDFViewer;
+        #endregion
 
-        public void OnNavigatedTo(NavigationContext navigationContext)
-        {
+        #region 图像处理
 
-            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
-            if (PDFViewer != null)
+        private void CancelCropImg()
+        {
+            if (TextEditEvent != null)
             {
-                PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
-                PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
+                TextEditEvent.ClipImage = false;
+                TextEditEvent.CancelClip();
 
-                PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
-                PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
-               
+                TextEditEvent.UpdatePDFEditByEventArgs();
+                IsCrop = false;
             }
         }
 
-        public bool IsNavigationTarget(NavigationContext navigationContext)
-        {
-            return true;
-        }
-
-       
-        public void OnNavigatedFrom(NavigationContext navigationContext)
+        private void CropImg()
         {
+            if (TextEditEvent != null)
+            {
+                TextEditEvent.SaveClip();
+                TextEditEvent.ClipImage = false;
+                TextEditEvent.UpdatePDFEditByEventArgs();
+                IsCrop = false;
+            }
         }
 
-        private void PDFViewer_PDFEditCommandHandler(object sender, PDFEditCommand e)
+        private void ExportImg()
         {
+            if (PDFViewer == null || TextEditEvent == null || TextEditEvent.EditType != ComPDFKit.PDFPage.CPDFEditType.EditImage) return;
 
-            if (e == null)
-                return;
+            System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowserDialog();
+            folder.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
 
-            switch (e.CommandType)
+            if (folder.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
-                case CommandType.Context:
-                   
-                    if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)
-                    {
-                        e.PopupMenu = EmptyStateMenu(sender);
-                       
-                    }
-                    else if(e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
+                if (string.IsNullOrEmpty(folder.SelectedPath))
+                    return;
+
+                var keyValueList = PDFViewer.GetSelectedImages();
+                int i = 0;
+                foreach (var bitmap in keyValueList)
+                {
+                    foreach (var bitmapItem in bitmap.Value)
                     {
-                        e.PopupMenu = SelectPDFEdit(sender);
+                        bitmapItem.Save(folder.SelectedPath + "\\" + i + ".png", System.Drawing.Imaging.ImageFormat.Png);
+                        i++;
                     }
-                    else if(e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
-                    {
-                        //文字编辑
-                        if(e.PressOnBorder == true)
-                        {
-                            e.PopupMenu = SelectTextBorder(sender);
-                        }
+                }
 
-                        if(e.PressOnSelectedText == true)
-                        {
-                            e.PopupMenu = SelectTextContent(sender);
-                        }
-                    }
 
-                    break;
 
-                default:
-                    e.DoCommand();
-                    break;
+            }
+        }
 
+        private void AddImg()
+        {
+            OpenFileDialog openFileDialog = new OpenFileDialog();
+            openFileDialog.Filter = "png|*.png;|Image|*.gif;*.jpg;*.jpeg;*.bmp;*.jfif;*.png;";
+            openFileDialog.Multiselect = true;
+            if ((bool)openFileDialog.ShowDialog())
+            {
+                if (string.IsNullOrEmpty(openFileDialog.FileName) == false)
+                {
+                    PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
+                    PDFViewer.AddPDFEditImage(openFileDialog.FileName);
+                }
             }
-            if (e.PopupMenu != null)
+        }
+
+        private void ReplaceImg()
+        {
+            OpenFileDialog openFileDialog = new OpenFileDialog();
+            openFileDialog.Filter = "png|*.png;|Image|*.gif;*.jpg;*.jpeg;*.bmp;*.jfif;*.png;";
+            openFileDialog.Multiselect = true;
+            if ((bool)openFileDialog.ShowDialog())
             {
-                e.Handle = true;
+                if (string.IsNullOrEmpty(openFileDialog.FileName) == false)
+                {
+                    PDFViewer.SetPDFEditCreateType(ComPDFKit.PDFPage.CPDFEditType.EditImage);
+                    TextEditEvent.ReplaceImagePath = openFileDialog.FileName;
+                    TextEditEvent.UpdatePDFEditByEventArgs();
+                }
             }
         }
-        private void EditTextMode()
+
+        private void CropMode()
+        {
+            IsCrop = true;
+            if (TextEditEvent != null)
+            {
+                TextEditEvent.ClipImage = true;
+                TextEditEvent.UpdatePDFEditByEventArgs();
+            }
+        }
+
+        #endregion
+
+        #region 布局处理
+        private void ImgAlignChecked(object obj)
+        {
+            if (obj != null)
+            {
+                switch ((string)obj)
+                {
+                    case "AlignLeft":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignLeft);
+                        break;
+                    case "AlignHorizonCenter":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignHorizonCenter);
+                        break;
+                    case "AlignRight":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignRight);
+                        break;
+                    case "DistributeHorizontal":
+                        PDFViewer.SetPDFEditAligment(AlignModes.DistributeHorizontal);
+                        break;
+                    case "AlignTop":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignTop);
+                        break;
+                    case "AlignVerticalCenter":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignVerticalCenter);
+                        break;
+                    case "AlignBottom":
+                        PDFViewer.SetPDFEditAligment(AlignModes.AlignBottom);
+                        break;
+                    case "DistributeVertical":
+                        PDFViewer.SetPDFEditAligment(AlignModes.DistributeVertical);
+                        break;
+                }
+
+            }
+        }
+
+        private void ReLoadLayoutAlign(int count)
         {
-            
+            if (count >= 2)
+                IsLayoutAlign = true;
+            else
+                IsLayoutAlign = false;
+
+            if (count >= 3)
+                IsLayoutAvgAlign = true;
+            else
+                IsLayoutAvgAlign = false;
         }
+        #endregion
+
+        #region 右键菜单
 
+        //点击空白处时
         private ContextMenu EmptyStateMenu(object sender)
         {
             var popMenu = App.Current.FindResource("NoneMenu") as ContextMenu;
             if (popMenu != null && popMenu.Items.Count == 3)
             {
-                //复制
-                MenuItem menuItem = popMenu.Items[0] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Paste;
+                //粘贴
+                SetPopMenuItem(popMenu.Items[0] as MenuItem, sender, ApplicationCommands.Paste);
                 //添加文本
-                menuItem = popMenu.Items[1] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = AddTextCommand;
+                SetPopMenuItem(popMenu.Items[1] as MenuItem, sender, AddTextCommand);
                 //添加图像
-                menuItem = popMenu.Items[2] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = AddImgCommand;
+                SetPopMenuItem(popMenu.Items[2] as MenuItem, sender, AddImgCommand);
             }
+
             return popMenu;
         }
-
-        private ContextMenu SelectPDFEdit(object sender)
+        //选中图像时
+        private ContextMenu SelectImgPDFEdit(object sender)
         {
             var popMenu = App.Current.FindResource("SelectImgMenu") as ContextMenu;
             if (popMenu != null && popMenu.Items.Count == 7)
             {
                 //复制
-                MenuItem menuItem = popMenu.Items[0] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Copy;
+                SetPopMenuItem(popMenu.Items[0] as MenuItem, sender, ApplicationCommands.Copy);
                 //剪切
-                menuItem = popMenu.Items[1] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Cut;
+                SetPopMenuItem(popMenu.Items[1] as MenuItem, sender, ApplicationCommands.Cut);
                 //粘贴
-                menuItem = popMenu.Items[2] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Paste;
+                SetPopMenuItem(popMenu.Items[2] as MenuItem, sender, ApplicationCommands.Paste);
                 //删除
-                menuItem = popMenu.Items[3] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Delete;
+                SetPopMenuItem(popMenu.Items[3] as MenuItem, sender, ApplicationCommands.Delete);
                 //裁剪
-                menuItem = popMenu.Items[4] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = CropModeCommand;
+                SetPopMenuItem(popMenu.Items[4] as MenuItem, sender, CropModeCommand);
                 //替换
-                menuItem = popMenu.Items[5] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ReplaceImgCommand;
+                SetPopMenuItem(popMenu.Items[5] as MenuItem, sender, ReplaceImgCommand);
                 //导出
-                menuItem = popMenu.Items[6] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ExportImgCommand;
-                
+                SetPopMenuItem(popMenu.Items[6] as MenuItem, sender, ExportImgCommand);
             }
             return popMenu;
         }
 
-
+        //选中文字的框
         private ContextMenu SelectTextBorder(object sender)
         {
             var popMenu = App.Current.FindResource("SelectTextMenu") as ContextMenu;
             if (popMenu != null && popMenu.Items.Count == 5)
             {
                 //编辑
-                MenuItem menuItem = popMenu.Items[0] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = EditTextModeCommand;
+                SetPopMenuItem(popMenu.Items[0] as MenuItem, sender, EditTextModeCommand);
                 //复制
-                menuItem = popMenu.Items[1] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Copy;
+                SetPopMenuItem(popMenu.Items[1] as MenuItem, sender, ApplicationCommands.Copy);
                 //剪切
-                menuItem = popMenu.Items[2] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Cut;
+                SetPopMenuItem(popMenu.Items[2] as MenuItem, sender, ApplicationCommands.Cut);
                 //粘贴
-                menuItem = popMenu.Items[3] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Paste;
+                SetPopMenuItem(popMenu.Items[3] as MenuItem, sender, ApplicationCommands.Paste);
                 //删除
-                menuItem = popMenu.Items[4] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Delete;
+                SetPopMenuItem(popMenu.Items[4] as MenuItem, sender, ApplicationCommands.Delete);
 
             }
             return popMenu;
         }
 
-
+        //选中文字内容
         private ContextMenu SelectTextContent(object sender)
         {
             var popMenu = App.Current.FindResource("SelectContentMenu") as ContextMenu;
             if (popMenu != null && popMenu.Items.Count == 6)
             {
                 //复制
-                MenuItem menuItem = popMenu.Items[0] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Copy;
+                SetPopMenuItem(popMenu.Items[0] as MenuItem, sender, ApplicationCommands.Copy);
                 //剪切
-                menuItem = popMenu.Items[1] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Cut;
+                SetPopMenuItem(popMenu.Items[1] as MenuItem, sender, ApplicationCommands.Cut);
                 //粘贴
-                menuItem = popMenu.Items[2] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Paste;
+                SetPopMenuItem(popMenu.Items[2] as MenuItem, sender, ApplicationCommands.Paste);
                 //粘贴并匹配样式
-                menuItem = popMenu.Items[3] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Paste;
+                SetPopMenuItem(popMenu.Items[3] as MenuItem, sender, ApplicationCommands.Paste);
                 //删除
-                menuItem = popMenu.Items[4] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.Delete;
-                //全部选定
-                menuItem = popMenu.Items[4] as MenuItem;
-                menuItem.CommandTarget = (UIElement)sender;
-                menuItem.Command = ApplicationCommands.SelectAll;
+                SetPopMenuItem(popMenu.Items[4] as MenuItem, sender, ApplicationCommands.Delete);
+                ////全部选定
+                SetPopMenuItem(popMenu.Items[5] as MenuItem, sender, ApplicationCommands.SelectAll);
+
             }
 
             return popMenu;
         }
 
+        private void SetPopMenuItem(MenuItem menu, object sender, ICommand command)
+        {
+            MenuItem menuItem = menu;
+            menuItem.CommandTarget = (UIElement)sender;
+            menuItem.Command = command;
+        }
+
+        #endregion
+
+
+        #region 编辑PDF内容触发的事件
+
+        /// <summary>
+        /// 右键菜单的事件
+        /// </summary>
+        private void PDFViewer_PDFEditCommandHandler(object sender, PDFEditCommand e)
+        {
+
+            if (e == null)
+                return;
+
+            switch (e.CommandType)
+            {
+                case CommandType.Context:
+
+                    if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.None)
+                    {
+                        e.PopupMenu = EmptyStateMenu(sender);
+
+                    }
+                    else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditImage)
+                    {
+                        e.PopupMenu = SelectImgPDFEdit(sender);
+                    }
+                    else if (e.EditType == ComPDFKit.PDFPage.CPDFEditType.EditText)
+                    {
+                        //文字编辑
+                        if (e.PressOnBorder == true)
+                        {
+                            e.PopupMenu = SelectTextBorder(sender);
+                        }
+
+                        if (e.PressOnSelectedText == true)
+                        {
+                            e.PopupMenu = SelectTextContent(sender);
+                        }
+                    }
+
+                    break;
+
+                default:
+                    e.DoCommand();
+                    break;
+
+            }
+            if (e.PopupMenu != null)
+            {
+                e.Handle = true;
+            }
+        }
+        /// <summary>
+        /// 选中编辑PDF内容的事件
+        /// </summary>
         private void PDFViewer_PDFEditActiveHandler(object sender, List<PDFEditEvent> e)
         {
-            if(e != null && e.Count > 0)
+            if (e != null && e.Count > 0)
             {
 
                 ReLoadLayoutAlign(e.Count);
@@ -853,22 +762,34 @@ namespace PDF_Office.ViewModels.PropertyPanel
                 IsTextEdit = true;
 
                 ClearCheckedAglin?.Invoke(null, null);
-               
+
             }
         }
 
-        private void ReLoadLayoutAlign(int count)
+        #endregion
+
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
         {
-            if (count >= 2)
-                IsLayoutAlign = true;
-            else
-                IsLayoutAlign = false;
 
-            if (count >= 3)
-                IsLayoutAvgAlign = true;
-            else
-                IsLayoutAvgAlign = false;
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+            if (PDFViewer != null)
+            {
+                PDFViewer.PDFEditActiveHandler -= PDFViewer_PDFEditActiveHandler;
+                PDFViewer.PDFEditActiveHandler += PDFViewer_PDFEditActiveHandler;
+
+                PDFViewer.PDFEditCommandHandler -= PDFViewer_PDFEditCommandHandler;
+                PDFViewer.PDFEditCommandHandler += PDFViewer_PDFEditCommandHandler;
+               
+            }
         }
 
+        public bool IsNavigationTarget(NavigationContext navigationContext){   return true; }
+
+       
+        public void OnNavigatedFrom(NavigationContext navigationContext){}
+
+
+
     }
 }

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

@@ -1039,6 +1039,12 @@ namespace PDF_Office.ViewModels
                 PDFViewer.ReloadDocument();
             }
 
+            //如果是其他工具共用一个PDFview,退出工具模式后,需要重新添加到Region,否则不会显示
+            if (!region.Regions[ViwerRegionName].Views.Contains(PDFViewer))
+            {
+                region.AddToRegion(ViwerRegionName, PDFViewer);
+            }
+
             CurrentBar = "TabItemTool";
             EnterSelectedBar(CurrentBar);
         }

+ 53 - 27
PDF Office/Views/EditTools/Redaction/RedactionContent.xaml

@@ -1,46 +1,72 @@
-<UserControl 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:prism="http://prismlibrary.com/"             
-             prism:ViewModelLocator.AutoWireViewModel="True"
-             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
-             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:redaction="clr-namespace:PDF_Office.ViewModels.EditTools.Redaction" d:DataContext="{d:DesignInstance Type=redaction:RedactionContentViewModel}"
-             mc:Ignorable =" d"
-             d:DesignHeight="760"
-             d:DesignWidth="1280">
+<UserControl
+    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:d="http://schemas.microsoft.com/expression/blend/2008"
+    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    xmlns:redaction="clr-namespace:PDF_Office.ViewModels.EditTools.Redaction"
+    d:DataContext="{d:DesignInstance Type=redaction:RedactionContentViewModel}"
+    d:DesignHeight="760"        
+    d:DesignWidth="1280"
+    prism:ViewModelLocator.AutoWireViewModel="True"
+    mc:Ignorable=" d">
     <Grid Background="#FFFFFF">
         <Grid.RowDefinitions>
-            <RowDefinition Height="40"></RowDefinition>
-            <RowDefinition></RowDefinition>
+            <RowDefinition Height="40" />
+            <RowDefinition />
         </Grid.RowDefinitions>
         <Grid>
             <WrapPanel HorizontalAlignment="Center">
-                <Button Style="{StaticResource InsideBarBtnStyle }">
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                <Button Style="{StaticResource InsideBarBtnStyle}">
+                    <StackPanel Margin="12,0,12,0" Orientation="Horizontal">
                         <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="文本和图像标记密文" VerticalAlignment="Center"></TextBlock>
+                            <Border
+                                Width="30"
+                                Height="30"
+                                Background="LightSeaGreen" />
+                        </StackPanel>
+                        <TextBlock VerticalAlignment="Center" Text="文本和图像标记密文" />
                     </StackPanel>
                 </Button>
-                <Button Style="{StaticResource InsideBarBtnStyle }">
-                    <StackPanel Orientation="Horizontal" Margin="12 0 12 0">
+                <Button Style="{StaticResource InsideBarBtnStyle}">
+                    <StackPanel Margin="12,0,12,0" Orientation="Horizontal">
                         <StackPanel Margin="0,0,8,0">
-                            <Border Height="30" Width="30" Background="LightSeaGreen" ></Border>
-                        </StackPanel >
-                        <TextBlock Text="页面标记密文" VerticalAlignment="Center"></TextBlock>
+                            <Border
+                                Width="30"
+                                Height="30"
+                                Background="LightSeaGreen" />
+                        </StackPanel>
+                        <TextBlock VerticalAlignment="Center" Text="页面标记密文" />
                     </StackPanel>
                 </Button>
             </WrapPanel>
             <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
-                <Button Content="应用密文" Height="24" Padding="10,2,10,2"></Button>
-                <Button Content="擦除密文" Height="24"  Margin="8,0,8,0" Padding="10,2,10,2"></Button>
-                <Button Content="关闭" Height="24" Padding="10,2,10,2"  Margin="0,0,16,0"  Command="{Binding CloseEditToolCommand}"></Button>
+                <Button
+                    Height="24"
+                    Margin="8,0"
+                    Padding="8,0"
+                    Content="应用密文"
+                    Style="{StaticResource Btn.cta}" />
+                <Button
+                    Height="24"
+                    Margin="8,0"
+                    Padding="8,0"
+                    Content="擦除密文"
+                    Style="{StaticResource Btn.cta}" />
+                <Button
+                    Width="auto"
+                    Height="24"
+                    Margin="8,0,16,0"
+                    Padding="8,0"
+                    Command="{Binding CloseEditToolCommand}"
+                    Content="关闭"
+                    Style="{StaticResource btn.sec}" />
             </StackPanel>
         </Grid>
         <Grid Grid.Row="1" Background="#E7E9EC">
-            <Grid Margin="60,12,0,0">
-                <ContentControl prism:RegionManager.RegionName="{Binding RedactionDocumentRegionName}" Visibility ="Visible"></ContentControl>
+            <Grid>
+                <ContentControl prism:RegionManager.RegionName="{Binding RedactionDocumentRegionName}" Visibility="Visible" />
             </Grid>
         </Grid>
     </Grid>

+ 2 - 0
PDF Office/Views/Form/ButtonProperty.xaml

@@ -4,6 +4,8 @@
              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.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/CheckBoxProperty.xaml

@@ -4,6 +4,8 @@
              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.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/ComboxProperty.xaml

@@ -4,6 +4,8 @@
              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.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/ListBoxProperty.xaml

@@ -4,6 +4,8 @@
              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.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/RadioButtonProperty.xaml

@@ -4,6 +4,8 @@
              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.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/SignProperty.xaml

@@ -4,6 +4,8 @@
              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.Form"
+             xmlns:prism="http://prismlibrary.com/"
+             prism:ViewModelLocator.AutoWireViewModel="True"
              mc:Ignorable="d" 
              d:DesignHeight="450" d:DesignWidth="800">
     <Grid>

+ 2 - 0
PDF Office/Views/Form/TextFieldProperty.xaml

@@ -8,6 +8,8 @@
     xmlns:form="clr-namespace:PDF_Office.CustomControl.Form"
     xmlns:local="clr-namespace:PDF_Office.Views.Form"
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+    xmlns:prism="http://prismlibrary.com/"
+    prism:ViewModelLocator.AutoWireViewModel="True"
     d:DesignHeight="750"
     d:DesignWidth="260"
     Background="{StaticResource color.sys.layout.mg}"

+ 77 - 31
PDF Office/Views/MainWindow.xaml

@@ -2,6 +2,7 @@
     x:Class="PDF_Office.Views.MainWindow"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+    xmlns:convert="clr-namespace:PDF_Office.DataConvert"
     xmlns:cus="clr-namespace:PDF_Office.CustomControl"
     xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
     xmlns:dragablz="http://dragablz.net/winfx/xaml/dragablz"
@@ -25,6 +26,7 @@
         <ResourceDictionary>
             <Style x:Key="DragablzItemStyle" TargetType="{x:Type dragablz:DragablzItem}">
                 <Setter Property="WindowChrome.IsHitTestVisibleInChrome" Value="True" />
+                <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv2}" />
                 <Setter Property="Template">
                     <Setter.Value>
                         <ControlTemplate TargetType="dragablz:DragablzItem">
@@ -38,9 +40,9 @@
                                     Width="184"
                                     Height="34"
                                     Margin="4,6,0,2"
-                                    BorderBrush="#A0A2AE"
-                                    BorderThickness="1,1,1,0"
-                                    CornerRadius="5,5,0,0"
+                                    BorderBrush="{StaticResource color.sys.border.neutral.lv3}"
+                                    BorderThickness="0,0,0,1"
+                                    CornerRadius="4,4,0,0"
                                     WindowChrome.IsHitTestVisibleInChrome="True">
                                     <Grid>
                                         <Grid.ColumnDefinitions>
@@ -48,13 +50,25 @@
                                             <ColumnDefinition Width="*" MinWidth="10" />
                                             <ColumnDefinition Width="auto" />
                                         </Grid.ColumnDefinitions>
-                                        <TextBlock
-                                            x:Name="TextTitle"
-                                            MaxWidth="145"
-                                            Margin="8,4,0,4"
-                                            FontFamily="Segoe UI,Microsoft YaHei"
-                                            Text="{Binding DataContext.FileName}"
-                                            TextTrimming="WordEllipsis" />
+                                        <StackPanel Orientation="Horizontal">
+                                            <Path
+                                                Name="Ico_Home"
+                                                Width="20"
+                                                Height="20"
+                                                Margin="8,7,0,7"
+                                                Data="M3.8655 5.79659C3.32363 6.16983 3 6.78571 3 7.44369V15.0001C3 16.1046 3.89543 17.0001 5 17.0001H9V12.1786H11V17.0001H15C16.1046 17.0001 17 16.1046 17 15.0001V7.44369C17 6.78571 16.6764 6.16983 16.1345 5.79659L11.1345 2.35266C10.4514 1.88212 9.54865 1.88212 8.8655 2.35266L3.8655 5.79659Z"
+                                                Fill="{TemplateBinding Foreground}"
+                                                Visibility="Collapsed" />
+                                            <TextBlock
+                                                x:Name="TextTitle"
+                                                MaxWidth="145"
+                                                Margin="8,7"
+                                                VerticalAlignment="Center"
+                                                FontFamily="Segoe UI,Microsoft YaHei"
+                                                Foreground="{TemplateBinding Foreground}"
+                                                Text="{Binding DataContext.FileName}"
+                                                TextTrimming="WordEllipsis" />
+                                        </StackPanel>
                                         <Thumb
                                             x:Name="PART_Thumb"
                                             Grid.ColumnSpan="2"
@@ -76,6 +90,7 @@
                                             Margin="3,4,2,0"
                                             HorizontalAlignment="Left"
                                             VerticalAlignment="Top"
+                                            Foreground="{TemplateBinding Foreground}"
                                             IsHitTestVisible="False"
                                             Text="*"
                                             Visibility="{Binding DataContext.FileChanged}" />
@@ -87,24 +102,25 @@
                                             Background="Transparent"
                                             BorderThickness="0"
                                             Command="{Binding DataContext.CloseTab}"
-                                            CommandParameter="{Binding}"
-                                            Content="X" />
+                                            CommandParameter="{Binding}">
+                                            <Path Data="M6.50006 7.06072L9.96973 10.5304L11.0304 9.46973L7.56072 6.00006L11.0304 2.53039L9.96973 1.46973L6.50006 4.9394L3.03039 1.46973L1.96973 2.53039L5.4394 6.00006L1.96973 9.46973L3.03039 10.5304L6.50006 7.06072Z" Fill="{StaticResource color.icon.base.neutral.norm.lv2}" />
+                                        </Button>
                                     </Grid>
                                 </Border>
                             </Grid>
                             <ControlTemplate.Triggers>
                                 <Trigger Property="IsSelected" Value="True">
-                                    <Setter TargetName="Title" Property="Background" Value="#FFFFFF" />
-                                    <Setter TargetName="Title" Property="BorderThickness" Value="1,1,1,0" />
-                                    <Setter TargetName="TextTitle" Property="Foreground" Value="#477EDE" />
-                                    <Setter TargetName="ChangeIcon" Property="Foreground" Value="#477EDE" />
+                                    <Setter TargetName="Title" Property="Background" Value="{StaticResource color.sys.border.neutral.lv3}" />
+                                    <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
                                 </Trigger>
                                 <Trigger Property="IsSelected" Value="False">
                                     <Setter TargetName="Title" Property="Background" Value="TransParent" />
-                                    <Setter TargetName="Title" Property="BorderThickness" Value="1,1,1,0" />
-                                    <Setter TargetName="TextTitle" Property="Foreground" Value="#666666" />
-                                    <Setter TargetName="ChangeIcon" Property="Foreground" Value="#666666" />
-                                    <!--<Setter TargetName="btnPath" Property="Path.Fill" Value="#FF666666"/>-->
+                                </Trigger>
+                                <Trigger Property="IsMouseOver" Value="True">
+                                    <Setter TargetName="Title" Property="Background" Value="{StaticResource color.item-state.hov.bg}" />
+                                </Trigger>
+                                <Trigger SourceName="TextTitle" Property="Text" Value="Home">
+                                    <Setter TargetName="Ico_Home" Property="Visibility" Value="Visible" />
                                 </Trigger>
                                 <MultiDataTrigger>
                                     <MultiDataTrigger.Conditions>
@@ -112,8 +128,7 @@
                                         <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
                                     </MultiDataTrigger.Conditions>
                                     <Setter TargetName="Title" Property="Background" Value="#0D000000" />
-                                    <Setter TargetName="TextTitle" Property="Foreground" Value="black" />
-                                    <Setter TargetName="ChangeIcon" Property="Foreground" Value="black" />
+                                    <Setter Property="Foreground" Value="{StaticResource color.sys.text.neutral.lv1}" />
                                     <!--<Setter TargetName="btnPath" Property="Path.Fill" Value="Black"/>-->
                                 </MultiDataTrigger>
                             </ControlTemplate.Triggers>
@@ -121,10 +136,12 @@
                     </Setter.Value>
                 </Setter>
             </Style>
+
+            <convert:UnVisivleConvert x:Key="UnvisibleConvert" />
         </ResourceDictionary>
     </Window.Resources>
     <Border>
-        <Grid Background="#DFDFE0">
+        <Grid Background="{StaticResource color.sys.layout.bg.tabbar}">
             <Grid.RowDefinitions>
                 <RowDefinition Height="40" />
                 <RowDefinition Height="*" />
@@ -141,15 +158,21 @@
                 <dragablz:TabablzControl.HeaderSuffixContent>
                     <Button
                         x:Name="BtnAdd"
-                        Width="16"
-                        Height="16"
-                        Margin="9,7,200,5"
+                        Width="20"
+                        Height="20"
+                        Margin="9,13,0,7"
+                        Padding="0"
                         HorizontalAlignment="Left"
                         Background="Transparent"
                         BorderThickness="0"
                         Command="{Binding AddTab}"
-                        Content="+"
-                        WindowChrome.IsHitTestVisibleInChrome="True" />
+                        WindowChrome.IsHitTestVisibleInChrome="True">
+                        <Path
+                            Width="20"
+                            Height="20"
+                            Data="M9 11V16H11V11H16V9H11V4H9V9H4L4 11H9Z"
+                            Fill="{StaticResource color.icon.base.neutral.norm.lv1}" />
+                    </Button>
                 </dragablz:TabablzControl.HeaderSuffixContent>
                 <dragablz:TabablzControl.HeaderPrefixContent>
                     <Grid
@@ -171,14 +194,35 @@
                     Background="Transparent"
                     BorderThickness="0"
                     Click="BtnMiniSize_Click"
-                    Content="--" />
+                    Style="{StaticResource TitleBarBtn}">
+                    <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 7 14 8 2 8 2 7">
+                        <Polygon.RenderTransform>
+                            <TransformGroup>
+                                <TranslateTransform Y="-3" />
+                            </TransformGroup>
+                        </Polygon.RenderTransform>
+                    </Polygon>
+                </Button>
                 <Button
                     Name="BtnReStore"
                     Width="40"
                     Height="40"
                     Background="Transparent"
                     BorderThickness="0"
-                    Click="BtnReStore_Click" />
+                    Click="BtnReStore_Click"
+                    Style="{StaticResource TitleBarBtn}">
+                    <Grid>
+                        <Path
+                            x:Name="ico_max"
+                            Data="M14,2 L14,14 L2,14 L2,2 L14,2 Z M13,3 L3,3 L3,13 L13,13 L13,3 Z"
+                            Fill="{StaticResource color.btn.sec.text.def}"
+                            Visibility="Collapsed" />
+                        <Grid x:Name="ico_mini" Visibility="{Binding ElementName=ico_max, Path=Visibility, Converter={StaticResource UnvisibleConvert}}">
+                            <Path Data="M11,5 L11,14 L2,14 L2,5 L11,5 Z M10,6 L3,6 L3,13 L10,13 L10,6 Z" Fill="{StaticResource color.btn.sec.text.def}" />
+                            <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="14 2 14 11 11 11 11 10 13 10 13 3 6 3 6 5 5 5 5 2" />
+                        </Grid>
+                    </Grid>
+                </Button>
                 <Button
                     Name="BtnClose"
                     Width="40"
@@ -186,7 +230,9 @@
                     Background="Transparent"
                     BorderThickness="0"
                     Click="BtnClose_Click"
-                    Content="X" />
+                    Style="{StaticResource CloseBtn}">
+                    <Polygon Fill="{StaticResource color.btn.sec.text.def}" Points="11.2919922 12 12 11.2919922 6.70800781 6 12 0.708007813 11.2919922 0 6 5.29199219 0.708007812 9.76996262e-15 -2.27456942e-13 0.708007813 5.29199219 6 0 11.2919922 0.708007812 12 6 6.70800781" />
+                </Button>
             </StackPanel>
         </Grid>
     </Border>

+ 6 - 0
PDF Office/Views/MainWindow.xaml.cs

@@ -64,9 +64,15 @@ namespace PDF_Office.Views
         private void BtnReStore_Click(object sender, RoutedEventArgs e)
         {
             if (this.WindowState == WindowState.Maximized)
+            {
                 System.Windows.SystemCommands.RestoreWindow(this);
+                ico_max.Visibility = Visibility.Visible;
+            }
             else
+            {
                 System.Windows.SystemCommands.MaximizeWindow(this);
+                ico_max.Visibility = Visibility.Collapsed;
+            }
         }
 
         private void Window_Activated(object sender, EventArgs e)