ソースを参照

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

ZhouJieSheng 1 年間 前
コミット
657ba88b81

+ 3 - 0
PDF Office/App.config

@@ -39,6 +39,9 @@
     <setting name="IsGuidPDFUpdated" serializeAs="String">
      <value>True</value>
     </setting>
+    <setting name="IsNewInViewContent" serializeAs="String">
+     <value>True</value>
+    </setting>
    </PDF_Master.Properties.Settings>
   </userSettings>
 </configuration>

+ 1 - 5
PDF Office/App.xaml.cs

@@ -126,9 +126,6 @@ namespace PDF_Master
         /// </summary>
         public static bool IsLogin = false;
 
-        //是否需要显示注册弹窗
-        //app第一次进入阅读页时需要弹出注册弹窗
-        public static bool IsShowRegist = false;
 
         /// <summary>
         /// 记录开始拖拽的窗口句柄,用于判断是否为跨窗口拖拽
@@ -185,7 +182,6 @@ namespace PDF_Master
 
                 Settings.Default.Upgrade();
                 Settings.Default.UpdateSettings = false;
-                App.IsShowRegist = true;
                 //重置用于弹窗的记录参数
             }
             if (Settings.Default.ADDate == null)
@@ -308,7 +304,7 @@ namespace PDF_Master
             InitSettings();
 
 #if DEBUG
-            IsLogin = true;
+            IsLogin = false;
 #endif
 
             CachePath = CacheFilePath.Instance;

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

@@ -282,5 +282,17 @@ namespace PDF_Master.Properties {
                 this["ADDate"] = value;
             }
         }
+        
+        [global::System.Configuration.UserScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute("True")]
+        public bool IsNewInViewContent {
+            get {
+                return ((bool)(this["IsNewInViewContent"]));
+            }
+            set {
+                this["IsNewInViewContent"] = value;
+            }
+        }
     }
 }

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

@@ -71,5 +71,8 @@
     <Setting Name="ADDate" Type="PDFSettings.ADDate" Scope="User">
       <Value Profile="(Default)" />
     </Setting>
+    <Setting Name="IsNewInViewContent" Type="System.Boolean" Scope="User">
+      <Value Profile="(Default)">True</Value>
+    </Setting>
   </Settings>
 </SettingsFile>

+ 36 - 20
PDF Office/ViewModels/FillAndSign/FillAndSignContentViewModel.cs

@@ -1543,13 +1543,13 @@ namespace PDF_Master.ViewModels.FillAndSign
 
         private void PDFViewer_AnnotEditHandler(object sender, List<AnnotEditEvent> e)
         {
-            bool IsSign = false;
+            bool IsAdd = false;
             if (e != null && e.Count > 0)
             {
                 int i = 0;
                 Dictionary<int, List<int>> selectAnnotDicts = new Dictionary<int, List<int>>();
 
-                for ( i = 0; i < e.Count; i++)
+                for (i = 0; i < e.Count; i++)
                 {
                     AnnotEditEvent editEvent = e[i];
                     int pageindex = editEvent.PageIndex;
@@ -1558,17 +1558,17 @@ namespace PDF_Master.ViewModels.FillAndSign
                     {
                         case ActionType.Add:
 
-                           
-                                if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
-                                {
-                                    selectAnnotDicts.Add(editEvent.PageIndex, new List<int>());
-                                    selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
-                                }
-                                else
-                                {
-                                    selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
-                                }
-                            
+                            IsAdd = true;
+                            if (selectAnnotDicts.ContainsKey(editEvent.PageIndex) == false)
+                            {
+                                selectAnnotDicts.Add(editEvent.PageIndex, new List<int>());
+                                selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
+                            }
+                            else
+                            {
+                                selectAnnotDicts[editEvent.PageIndex].Add(editEvent.AnnotIndex);
+                            }
+
                             //if (editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotFreehand)
                             //{
                             //    //if (IsSelectShape)
@@ -1603,9 +1603,10 @@ namespace PDF_Master.ViewModels.FillAndSign
                                         PDFViewer.SelectAnnotation(pageindex, annotindex);
                                     }
                                 }
-                               
+
                             }
-                            if (editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotFreehand&&i==0) {
+                            if (editEvent.EditAnnotArgs.EventType == AnnotArgsType.AnnotFreehand && i == 0)
+                            {
                                 PDFViewer.SelectAnnotation(pageindex, annotindex);
                             }
                             //else
@@ -1627,7 +1628,7 @@ namespace PDF_Master.ViewModels.FillAndSign
                             break;
                     }
                 }
-                if (i>1)
+                if (i > 1 && IsAdd)
                 {
                     PDFViewer.SelectAnnotation(selectAnnotDicts);
                 }
@@ -1807,7 +1808,7 @@ namespace PDF_Master.ViewModels.FillAndSign
 
             }
         }
-        private void ShowPropertyPanel(bool show = true)
+        public void ShowPropertyPanel(bool show = true)
         {
             viewContentViewModel.IsPropertyOpen = show;
         }
@@ -1859,7 +1860,20 @@ namespace PDF_Master.ViewModels.FillAndSign
         //        IsCopyShape = false;
         //    }
         //}
-
+        public void ExitAnnotationTool()
+        {
+            PDFViewer.DisableClearSelectAnnot(false);
+            PDFViewer.ClearSelectAnnots();
+            PDFViewer.SetMouseMode(MouseModes.PanTool);
+            if (PDFViewer.MouseMode != MouseModes.AnnotCreate)
+            {
+                PDFViewer.SetMouseMode(MouseModes.AnnotCreate);
+                var annotArgs = new SelectToolArgs();
+                PDFViewer.SetToolParam(annotArgs);
+            }
+            viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
+            ShowPropertyPanel(false);
+        }
         #region Navigation
 
         public bool IsNavigationTarget(NavigationContext navigationContext)
@@ -1880,14 +1894,16 @@ namespace PDF_Master.ViewModels.FillAndSign
 
         public void OnNavigatedTo(NavigationContext navigationContext)
         {
+            
             IsFillAndSign = true;
             navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
             navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
             BindingPDFViewerHandler();
+            ExitAnnotationTool();
             HookShapeIsCheck = true;
             HookShapeIsCheck = false;
-            ShowPropertyPanel(false);
-            PDFViewer.SetMouseMode(MouseModes.PanTool);
+            //ShowPropertyPanel(false);
+            //PDFViewer.SetMouseMode(MouseModes.PanTool);
             // InitCheckedEvent("RbtnTick");
             IsEdit = false;
 

+ 6 - 1
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Command.cs

@@ -466,6 +466,10 @@ namespace PDF_Master.ViewModels.Tools
                         }
                         return;
                     }
+                    if (StrAnnotToolChecked == "Freehand")
+                    {
+                        GetFreehand();
+                    }
                 }
             }
 
@@ -665,7 +669,7 @@ namespace PDF_Master.ViewModels.Tools
                         //    viewContentViewModel.SelectedPrpoertyPanel("PropertyPanelContent", null);
                         //else
                         //    GetSelectedAnnots(e);
-                        #endregion
+                        #endregion MVP 在对多选注释做处理
                     }
                 }
             }
@@ -1061,6 +1065,7 @@ namespace PDF_Master.ViewModels.Tools
                                 PDFViewer.EnableZoom(true);
                                 PDFViewer.EnableScroll(true);
                                 PDFViewer.SetMouseMode(MouseModes.PanTool);
+                                HandToolIsCheckedEvent(false);
                                 break;
                         }
                     }

+ 16 - 4
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -287,14 +287,24 @@ namespace PDF_Master.ViewModels.Tools
                             annotArgs = GetArrowLine("Line");
                             break;
                     }
+                    break;
+                case "RectKey":
+                    //选中时需设置以及点击图形按钮选中("Rect"->即代表按钮标识有代表矩形图案(将快捷键矩形改名为RectKey))
+                    StrAnnotToolChecked = "Rect";
+                    PropertyPanel.IsSharpAnnotSelected = true;
+                    annotArgs = GetRect();
                     break;
 
                 case "Circle"://圆
+                    StrAnnotToolChecked = "Rect";
+                    PropertyPanel.IsSharpAnnotSelected = true;
                     annotArgs = GetCircle();
                     break;
 
                 case "Arrow"://箭头
                 case "Line"://线
+                    StrAnnotToolChecked = "Rect";
+                    PropertyPanel.IsSharpAnnotSelected = true;
                     annotArgs = GetArrowLine(tag);
                     break;
 
@@ -617,10 +627,12 @@ namespace PDF_Master.ViewModels.Tools
                 }
                 else
                 {
-                    freehandArgs = PropertyPanel.LastAnnotDict[AnnotArgsType.AnnotFreehand] as FreehandAnnotArgs;
-                    freehandArgs.AnnotIndex = -1;
-                    freehandArgs.PageIndex = -1;
-                    freehandArgs.ClientRect = Rect.Empty;
+                    FreehandAnnotArgs freehandAnnotArgs = PropertyPanel.LastAnnotDict[AnnotArgsType.AnnotFreehand] as FreehandAnnotArgs;
+                    freehandArgs = new FreehandAnnotArgs();
+                    freehandArgs.InkColor = freehandAnnotArgs.InkColor;
+                    freehandArgs.Transparency = freehandAnnotArgs.Transparency;
+                    freehandArgs.LineWidth = freehandAnnotArgs.LineWidth;
+                    freehandArgs.LineDash = freehandAnnotArgs.LineDash;
                 }
 
                 selectedArgs = new List<AnnotHandlerEventArgs>();

+ 14 - 8
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -205,7 +205,9 @@ namespace PDF_Master.ViewModels.Tools
         //点击注释工具
         private void BtnMyTools_Click(CustomIconToggleBtn annotBtn)
         {
-            if (PDFViewer == null || annotBtn == null || annotBtn.Tag == null) return;
+            if (PDFViewer == null || annotBtn == null || annotBtn.Tag == null) return;
+            //if(viewContentViewModel.OpenBOTA==false)
+            this.events.GetEvent<CleanSelectAllEvent>().Publish(new CleanSelectAllArgs() { Unicode = App.mainWindowViewModel.SelectedItem.Unicode, IsCleanSelectAll = true });
 
             //不创建注释,属于注释模板
             Dictionary<string, bool> dictVar = new Dictionary<string, bool>();
@@ -1818,9 +1820,12 @@ namespace PDF_Master.ViewModels.Tools
         /// </summary>
         private void AnnotToolCtrlAltKey()
         {
+            
             var tuple = GetCtrlAltKey();
             if (tuple != null)
             {
+                //进入快捷键时清除选中
+                PDFViewer.ClearSelectAnnots();
                 if (tuple.Item1 == Key.L)
                     BtnLinkIsChecked = false;
 
@@ -1880,8 +1885,9 @@ namespace PDF_Master.ViewModels.Tools
             var tag = "";
             if (key == Key.H || key == Key.U || key == Key.S)
             {
-                var str = PDFViewer.GetSelectedText();
-                if (string.IsNullOrEmpty(str) == false)
+                //判断是否选中文字
+                //var str = PDFViewer.GetSelectedText();
+                //if (string.IsNullOrEmpty(str) == false)
                 {
                     if (key == Key.H)
                         tag = "HighLight";
@@ -1890,10 +1896,10 @@ namespace PDF_Master.ViewModels.Tools
                     else if (key == Key.S)
                         tag = "Strikeout";
                 }
-                else
-                {
-                    return null;
-                }
+                //else
+                //{
+                //    return null;
+                //}
             }
             else
             {
@@ -1904,7 +1910,7 @@ namespace PDF_Master.ViewModels.Tools
                 else if (AnnotToolDir[Key.N])
                     tag = "StickyNote";
                 else if (AnnotToolDir[Key.R])
-                    tag = "Rect";
+                    tag = "RectKey";
                 else if (AnnotToolDir[Key.O])
                     tag = "Circle";
                 else if (AnnotToolDir[Key.A])

+ 5 - 2
PDF Office/ViewModels/ViewContentViewModel.cs

@@ -2793,11 +2793,14 @@ namespace PDF_Master.ViewModels
             //弹窗需要放到最后(确保在各字段赋值语句的后面),弹窗显示会触发控件的Loaded事件,会导致后续段没有赋值,而加载等事件继续往后跑了
             //例如这里的问题  会因为显示注册弹窗,导致其他模块没有接受到正常的PDFviewer对象
             App.mainWindowViewModel.OphVis = Visibility.Collapsed;
-            if (App.IsShowRegist && App.IsLogin == true)
+            if (Settings.Default.IsNewInViewContent == true && App.IsLogin == false)
             {
                 App.mainWindowViewModel.OpenRegister();
-                App.IsShowRegist = false;
+
+                Settings.Default.IsNewInViewContent = false;
+                Settings.Default.Save();
             }
+
         }
 
         public bool IsNavigationTarget(NavigationContext navigationContext)

+ 62 - 56
PDF Office/Views/BOTA/AnnotationContent.xaml.cs

@@ -1,4 +1,6 @@
-using ComPDFKitViewer.AnnotEvent;
+using ComPDFKit.PDFAnnotation;
+using ComPDFKit.PDFPage;
+using ComPDFKitViewer.AnnotEvent;
 using PDF_Master.DataConvert;
 using PDF_Master.EventAggregators;
 using PDF_Master.Helper;
@@ -13,6 +15,7 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
+using System.Windows.Annotations;
 using System.Windows.Controls;
 using System.Windows.Controls.Primitives;
 using System.Windows.Data;
@@ -23,6 +26,7 @@ using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Navigation;
 using System.Windows.Shapes;
+using static Dropbox.Api.TeamLog.PaperDownloadFormat;
 using static System.Windows.Forms.VisualStyles.VisualStyleElement.StartPanel;
 using ListBox = System.Windows.Controls.ListBox;
 using MenuItem = System.Windows.Controls.MenuItem;
@@ -313,8 +317,8 @@ namespace PDF_Master.Views.BOTA
             {
                 viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute(AnnotationList.SelectedItem);
             }
-        }
-
+        }
+
         private void AnnotationList_SelectionChanged(object sender, SelectionChangedEventArgs e)
         {
             var a = AnnotationList.SelectedItems.Count;
@@ -328,68 +332,70 @@ namespace PDF_Master.Views.BOTA
                 viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute((sender as ListBox).SelectedItems[0]);
             }
             else if (a1 > 1)
-            {
+            {
                 #region 阅读视图 多选
-
-                Dictionary<int, List<int>> selectedItemDics = new Dictionary<int, List<int>>();
+
+                Dictionary<int, List<int>> selectedItemDics = new Dictionary<int, List<int>>();
                 List<AnnotationHandlerEventArgs> eventArgs = new List<AnnotationHandlerEventArgs>();
-                List<int> ints = new List<int>();
                 foreach (var item in (sender as ListBox).SelectedItems)
                 {
                     if (item is AnnotationHandlerEventArgs annotation)
                     {
-                        if (!selectedItemDics.ContainsKey(annotation.PageIndex))
-                        {
-                            ints.Clear();
-                            ints.Add(annotation.AnnotIndex);
-                            selectedItemDics.Add(annotation.PageIndex, ints);
-                        }
-                        else
-                        {
-                            ints.Add(annotation.AnnotIndex);
-                            selectedItemDics[annotation.PageIndex] = ints;
-                        }
+                        if (eventArgs.Contains(annotation) == false)
+                        {
+                            eventArgs.Add(annotation);
+                        }
                     }
-                }
-
+                }
+                var result = eventArgs.GroupBy(d => d.PageIndex);
+                foreach (var item in result)
+                {
+                    if (selectedItemDics.ContainsKey(item.Key) == false)
+                    {
+                        var ai = item.Select(w => w.AnnotIndex).ToList();
+                        selectedItemDics.Add(item.Key, ai);
+                    }
+                }
+                
+
                 #endregion 阅读视图 多选
-
-                viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute(selectedItemDics);
-            }
-        }
-
-        private void AnnotationList_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
-        {
-            if (AnnotationList.SelectedItems == null)
-            {
-                return;
-            }
-            if (e.Key == Key.Escape)
-            {
-                AnnotationList.SelectedItems.Clear();
-            }
-        }
-
-        private void Grid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
-        {
-            var pos = e.GetPosition(this);
-            var result = VisualTreeHelper.HitTest(this, pos);
-            if (result != null)
-            {
-                //点击按钮和listboxitem时 不清空多选 其余区域取消多选
-                var item = CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
-                if (item != null)
-                {
-                    return;
-                }
-                var btn = CommonHelper.FindVisualParent<System.Windows.Controls.Button>(result.VisualHit);
-                if (btn != null)
-                {
-                    return;
+
+                viewModel.ListBoxItemPreviewMouseLeftButtonDown.Execute(selectedItemDics);
+            }
+        }
+
+        private void AnnotationList_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
+        {
+            if (AnnotationList.SelectedItems == null)
+            {
+                return;
+            }
+            if (e.Key == Key.Escape)
+            {
+                AnnotationList.SelectedItems.Clear();
+            }
+        }
+
+        private void Grid_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+        {
+            var pos = e.GetPosition(this);
+            var result = VisualTreeHelper.HitTest(this, pos);
+            if (result != null)
+            {
+                //点击按钮和listboxitem时 不清空多选 其余区域取消多选
+                var item = CommonHelper.FindVisualParent<ListBoxItem>(result.VisualHit);
+                if (item != null)
+                {
+                    return;
                 }
-            }
+                var btn = CommonHelper.FindVisualParent<System.Windows.Controls.Button>(result.VisualHit);
+                if (btn != null)
+                {
+                    return;
+                }
+            }
         }
-
+
         private void ListBox_MouseDown(object sender, MouseButtonEventArgs e)
         {
             AnnotationList.SelectedIndex = -1;
@@ -410,5 +416,5 @@ namespace PDF_Master.Views.BOTA
                 }
             }
         }
-    }
+    }
 }

+ 1 - 2
PDF Office/Views/Dialog/ServiceDialog/UserDialog.xaml

@@ -70,8 +70,7 @@
                         VerticalAlignment="Center"
                         HorizontalAlignment="Center"
                         FontFamily="SF Pro Text"
-                        FontSize="40"
-                              
+                        FontSize="28"                             
                         FontWeight="SemiBold"
                         Foreground="White"
                       Text="{Binding Useremailchar,Mode=TwoWay}" />

+ 9 - 2
PDF Office/Views/FillAndSign/FillAndSignContent.xaml.cs

@@ -1,4 +1,6 @@
-using ComPDFKitViewer.PdfViewer;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Master.ViewModels;
 using PDF_Master.ViewModels.Dialog.ConverterDialogs;
 using PDF_Master.ViewModels.FillAndSign;
 using System;
@@ -35,10 +37,15 @@ namespace PDF_Master.Views.FillAndSign
             if (a.IsChecked == true)
             {
                 a.IsChecked = false;
-                ((FillAndSignContentViewModel)this.DataContext).PDFViewer.SetMouseMode(MouseModes.PanTool);
+                //((FillAndSignContentViewModel)this.DataContext).PDFViewer.DisableClearSelectAnnot(false);
+                //((FillAndSignContentViewModel)this.DataContext).PDFViewer.ClearSelectAnnots();
+                ((FillAndSignContentViewModel)this.DataContext).ExitAnnotationTool();
+                //((FillAndSignContentViewModel)this.DataContext).PDFViewer.SetMouseMode(MouseModes.PanTool);
+
                 e.Handled = true;
             }
             else { a.IsChecked = true; }
         }
+        
     }
 }

+ 1 - 3
PDF Office/Views/FillAndSign/PropertyPanel/ShapFillProperty.xaml

@@ -75,9 +75,7 @@
                     <RowDefinition />
                 </Grid.RowDefinitions>
                 <TextBlock Text="Color" VerticalAlignment="Center" Margin="0,0,0,12"/>
-                <CompositeControl:SlidContent x:Name="layerThick"  HorizontalAlignment="Right" 
-                                              
-                                              >
+                <CompositeControl:SlidContent x:Name="layerThick"  HorizontalAlignment="Right" InitValue="{Binding FillOpacity, Mode=OneWay}">
                     <i:Interaction.Triggers>
                         <i:EventTrigger EventName="SelectedValueChanged">
                             <i:InvokeCommandAction Command="{Binding SelectedOpacityValueCommand}" CommandParameter="{Binding ElementName=layerThick,Path=Value}"/>

+ 1 - 1
PDF Office/Views/MainWindow.xaml

@@ -360,7 +360,7 @@
                             HorizontalAlignment="Center"
                             VerticalAlignment="Center"
                             FontFamily="SF Pro Text"
-                            FontSize="20"
+                            FontSize="14"
                             FontWeight="SemiBold"
                             Foreground="White"
                             Text="{Binding Useremailchar}" />

+ 1 - 1
PDF Office/Views/PropertyPanel/AnnotPanel/SignatureAnnotProperty.xaml

@@ -10,7 +10,7 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     d:DataContext="{d:DesignInstance Type=annotpanel:SignatureAnnotPropertyViewModel}"
     Background="{StaticResource color.sys.layout.mg}"
-    KeyDown="UserControl_KeyDown"
+    
     Loaded="UserControl_Loaded"
     mc:Ignorable="d">
     <UserControl.Resources>

+ 9 - 0
PDF Office/Views/PropertyPanel/AnnotPanel/SignatureAnnotProperty.xaml.cs

@@ -1,4 +1,5 @@
 using PDF_Master.CustomControl;
+using PDF_Master.Helper;
 using PDF_Master.Model.AnnotPanel;
 using PDF_Master.ViewModels.PropertyPanel.AnnotPanel;
 using System;
@@ -26,6 +27,14 @@ namespace PDF_Master.Views.PropertyPanel.AnnotPanel
         public SignatureAnnotProperty()
         {
             InitializeComponent();
+            KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
+            KeyEventsHelper.KeyDown += ShortCut_KeyDown;
+        }
+
+        private void ShortCut_KeyDown(object sender, KeyEventArgs e)
+        {
+            (DataContext as SignatureAnnotPropertyViewModel).Close();
+            e.Handled = true;
         }
 
         private void ListBoxItem_PreviewMouseDown(object sender, MouseButtonEventArgs e)

+ 76 - 81
PDF Office/Views/PropertyPanel/AnnotPanel/StampAnnotProperty.xaml

@@ -14,7 +14,7 @@
     Width="260"
     d:DataContext="{d:DesignInstance Type=annotpanel:StampAnnotPropertyViewModel}"
     Background="{StaticResource color.sys.layout.mg}"
-    KeyDown="UserControl_KeyDown"
+
     Loaded="UserControl_Loaded"
     mc:Ignorable="d">
     <UserControl.Resources>
@@ -173,65 +173,65 @@
                         FontSize="12"
                         IsSelected="True">
                 <Grid>
-                    <ListBox  ItemsSource="{Binding StandardStampList}" SelectionMode="Single"  Height="auto" VerticalAlignment="Top"  BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
+                    <ListBox  ItemsSource="{Binding StandardStampList}" SelectionMode="Single"  Height="auto" VerticalAlignment="Top"  BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                         <ListBox.ItemTemplate>
-                            <DataTemplate >
-                                <Grid >
+                            <DataTemplate>
+                                <Grid>
                                     <Grid.ContextMenu>
                                         <ContextMenu>
                                             <MenuItem Header="导出图章">
-                                                <MenuItem x:Name="SavePNG" Header="PNG" Tag="PNG" Click="Save_Click"/>
-                                                <MenuItem x:Name="SavePDF" Header="PDF" Tag="PDF" Click="Save_Click"/>
+                                                <MenuItem x:Name="SavePNG" Header="PNG" Tag="PNG" Click="Save_Click" />
+                                                <MenuItem x:Name="SavePDF" Header="PDF" Tag="PDF" Click="Save_Click" />
                                             </MenuItem>
                                         </ContextMenu>
                                     </Grid.ContextMenu>
-                                    <Image Source="{Binding SourcePath}" Stretch="Uniform" Height="40"/>
+                                    <Image Source="{Binding SourcePath}" Stretch="Uniform" Height="40" />
                                 </Grid>
                             </DataTemplate>
                         </ListBox.ItemTemplate>
                         <ListBox.ItemContainerStyle>
                             <Style TargetType="ListBoxItem">
-                                <Setter Property="Height" Value="65"/>
-                                <Setter Property="Padding" Value="8"/>
-                                <Setter Property="HorizontalContentAlignment" Value="Center"/>
+                                <Setter Property="Height" Value="65" />
+                                <Setter Property="Padding" Value="8" />
+                                <Setter Property="HorizontalContentAlignment" Value="Center" />
                                 <Setter Property="Template">
                                     <Setter.Value>
                                         <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                             <Border x:Name="Bd" CornerRadius="8" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
-                                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                             </Border>
                                             <ControlTemplate.Triggers>
                                                 <MultiTrigger>
                                                     <MultiTrigger.Conditions>
-                                                        <Condition Property="IsMouseOver" Value="True"/>
+                                                        <Condition Property="IsMouseOver" Value="True" />
                                                     </MultiTrigger.Conditions>
-                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
-                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}" />
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}" />
                                                 </MultiTrigger>
                                                 <MultiTrigger>
                                                     <MultiTrigger.Conditions>
-                                                        <Condition Property="Selector.IsSelectionActive" Value="False"/>
-                                                        <Condition Property="IsSelected" Value="True"/>
+                                                        <Condition Property="Selector.IsSelectionActive" Value="False" />
+                                                        <Condition Property="IsSelected" Value="True" />
                                                     </MultiTrigger.Conditions>
-                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}"/>
-                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}"/>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}" />
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}" />
                                                 </MultiTrigger>
                                                 <MultiTrigger>
                                                     <MultiTrigger.Conditions>
-                                                        <Condition Property="Selector.IsSelectionActive" Value="True"/>
-                                                        <Condition Property="IsSelected" Value="True"/>
+                                                        <Condition Property="Selector.IsSelectionActive" Value="True" />
+                                                        <Condition Property="IsSelected" Value="True" />
                                                     </MultiTrigger.Conditions>
-                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}"/>
-                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}"/>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}" />
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}" />
                                                 </MultiTrigger>
                                                 <Trigger Property="IsEnabled" Value="False">
-                                                    <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
+                                                    <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                                                 </Trigger>
                                             </ControlTemplate.Triggers>
                                         </ControlTemplate>
                                     </Setter.Value>
                                 </Setter>
-                                <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown"/>
+                                <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown" />
                             </Style>
                         </ListBox.ItemContainerStyle>
                     </ListBox>
@@ -241,59 +241,58 @@
                         Header="Dynamic"
                         FontFamily="Segoe UI" Foreground="#FF666666"
                         HorizontalContentAlignment="Center"
-                        FontSize="12"
-                        >
-                <ListBox Tag="Dynamic" DataContext="{Binding}"  ItemsSource="{Binding DynamicStampList}" Loaded="DydamicListBox_Loaded" SelectionMode="Single" Height="auto" VerticalAlignment="Top"  BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" >
+                        FontSize="12">
+                <ListBox Tag="Dynamic" DataContext="{Binding}"  ItemsSource="{Binding DynamicStampList}" Loaded="DydamicListBox_Loaded" SelectionMode="Single" Height="auto" VerticalAlignment="Top"  BorderThickness="0" ScrollViewer.HorizontalScrollBarVisibility="Disabled">
                     <ListBox.ItemTemplate>
-                        <DataTemplate >
+                        <DataTemplate>
                             <Grid>
-                                <Image Source="{Binding ImageSource}" Stretch="Uniform" Height="48"/>
+                                <Image Source="{Binding ImageSource}" Stretch="Uniform" Height="48" />
                             </Grid>
                         </DataTemplate>
                     </ListBox.ItemTemplate>
                     <ListBox.ItemContainerStyle>
                         <Style TargetType="ListBoxItem">
-                            <Setter Property="Height" Value="65"/>
-                            <Setter Property="Padding" Value="8"/>
-                            <Setter Property="HorizontalContentAlignment" Value="Center"/>
+                            <Setter Property="Height" Value="65" />
+                            <Setter Property="Padding" Value="8" />
+                            <Setter Property="HorizontalContentAlignment" Value="Center" />
                             <Setter Property="Template">
                                 <Setter.Value>
                                     <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                         <Border x:Name="Bd" CornerRadius="8" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
-                                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                                            <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                         </Border>
                                         <ControlTemplate.Triggers>
                                             <MultiTrigger>
                                                 <MultiTrigger.Conditions>
-                                                    <Condition Property="IsMouseOver" Value="True"/>
+                                                    <Condition Property="IsMouseOver" Value="True" />
                                                 </MultiTrigger.Conditions>
-                                                <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
-                                                <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
+                                                <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}" />
+                                                <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}" />
                                             </MultiTrigger>
                                             <MultiTrigger>
                                                 <MultiTrigger.Conditions>
-                                                    <Condition Property="Selector.IsSelectionActive" Value="False"/>
-                                                    <Condition Property="IsSelected" Value="True"/>
+                                                    <Condition Property="Selector.IsSelectionActive" Value="False" />
+                                                    <Condition Property="IsSelected" Value="True" />
                                                 </MultiTrigger.Conditions>
-                                                <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}"/>
-                                                <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}"/>
+                                                <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}" />
+                                                <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}" />
                                             </MultiTrigger>
                                             <MultiTrigger>
                                                 <MultiTrigger.Conditions>
-                                                    <Condition Property="Selector.IsSelectionActive" Value="True"/>
-                                                    <Condition Property="IsSelected" Value="True"/>
+                                                    <Condition Property="Selector.IsSelectionActive" Value="True" />
+                                                    <Condition Property="IsSelected" Value="True" />
                                                 </MultiTrigger.Conditions>
-                                                <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}"/>
-                                                <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}"/>
+                                                <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}" />
+                                                <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}" />
                                             </MultiTrigger>
                                             <Trigger Property="IsEnabled" Value="False">
-                                                <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
+                                                <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                                             </Trigger>
                                         </ControlTemplate.Triggers>
                                     </ControlTemplate>
                                 </Setter.Value>
                             </Setter>
-                            <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown"/>
+                            <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown" />
                         </Style>
                     </ListBox.ItemContainerStyle>
                 </ListBox>
@@ -302,17 +301,15 @@
                         Header="Custom"
                         FontFamily="Segoe UI" Foreground="#FF666666"
                         FontSize="12"
-                        HorizontalContentAlignment="Center"
-                        >
+                        HorizontalContentAlignment="Center">
                 <Grid>
                     <StackPanel VerticalAlignment="Center" x:Name="NoStampStackPanel" Visibility="{Binding CustomStampList.Count, Converter={StaticResource ListCountToVisible}}">
                         <Image Source="pack://application:,,,/PDF Master;component/Resources/PropertyPanel/nostamp.png" />
-                        <TextBlock Text="No custom stamp created" FontSize="14" FontFamily="Segoe UI" Height="22" HorizontalAlignment="Center"/>
+                        <TextBlock Text="No custom stamp created" FontSize="14" FontFamily="Segoe UI" Height="22" HorizontalAlignment="Center" />
                         <TextBlock Width="168" FontSize="12" FontFamily="Segoe UI" TextWrapping="Wrap" Foreground="#94989C" HorizontalAlignment="Center">
-                         <Run Text="Click the"  />
-                         <Run Text="Add button" FontWeight="Bold"/>
+                         <Run Text="Click the" />
+                         <Run Text="Add button" FontWeight="Bold" />
                          <Run Text="in the upper right corner to create a new stamp." />
-
                         </TextBlock>
                     </StackPanel>
                     <ListBox Name="CusListbox" Margin="0 0 0 56"  Visibility="{Binding ElementName=NoStampStackPanel,Path=Visibility,Converter={StaticResource UnVisivleConvert}}"
@@ -321,25 +318,24 @@
                              BorderThickness="0"
                              ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                              ItemsSource="{Binding CustomStampList}"
-                             SelectedIndex="{Binding CusListboxIndex,Mode=TwoWay}"
-                             >
+                             SelectedIndex="{Binding CusListboxIndex,Mode=TwoWay}">
                         <ListBox.ItemTemplate>
-                            <HierarchicalDataTemplate  DataType="{x:Type model:Stamp}" >
+                            <HierarchicalDataTemplate  DataType="{x:Type model:Stamp}">
                                 <Grid>
                                     <Grid.ContextMenu>
                                         <ContextMenu>
-                                            <MenuItem x:Name="Delete" Header="删除图章" Click="Delete_Click"/>
-                                            <MenuItem x:Name="DeleteAll" Header="删除全部图章" Click="DeleteAll_Click"/>
+                                            <MenuItem x:Name="Delete" Header="删除图章" Click="Delete_Click" />
+                                            <MenuItem x:Name="DeleteAll" Header="删除全部图章" Click="DeleteAll_Click" />
                                             <MenuItem Header="导出图章">
-                                                <MenuItem x:Name="SavePNG" Header="PNG" Tag="PNG" Click="Save_Click"/>
-                                                <MenuItem x:Name="SavePDF" Header="PDF" Tag="PDF" Click="Save_Click"/>
+                                                <MenuItem x:Name="SavePNG" Header="PNG" Tag="PNG" Click="Save_Click" />
+                                                <MenuItem x:Name="SavePDF" Header="PDF" Tag="PDF" Click="Save_Click" />
                                             </MenuItem>
-                                            <MenuItem Header="编辑文字图章" Click="Editor_Click" Visibility="Collapsed"/>
+                                            <MenuItem Header="编辑文字图章" Click="Editor_Click" Visibility="Collapsed" />
                                         </ContextMenu>
                                     </Grid.ContextMenu>
                                     <StackPanel Orientation="Horizontal">
-                                        <Image Source="{Binding SourcePath}"/>
-                                        <Button HorizontalAlignment="Right" VerticalAlignment="Top" x:Name="DeleteIcon" Width="20" Height="20" Click="Delete_Click" Visibility="Hidden"/>
+                                        <Image Source="{Binding SourcePath}" />
+                                        <Button HorizontalAlignment="Right" VerticalAlignment="Top" x:Name="DeleteIcon" Width="20" Height="20" Click="Delete_Click" Visibility="Hidden" />
                                     </StackPanel>
                                 </Grid>
                                 <HierarchicalDataTemplate.Triggers>
@@ -348,52 +344,51 @@
                                     </Trigger>
                                 </HierarchicalDataTemplate.Triggers>
                             </HierarchicalDataTemplate>
-
                         </ListBox.ItemTemplate>
 
                         <ListBox.ItemContainerStyle>
                             <Style TargetType="ListBoxItem">
-                                <Setter Property="Height" Value="65"/>
-                                <Setter Property="Padding" Value="8"/>
+                                <Setter Property="Height" Value="65" />
+                                <Setter Property="Padding" Value="8" />
                                 <Setter Property="Template">
                                     <Setter.Value>
                                         <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                             <Border x:Name="Bd" CornerRadius="8" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
-                                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
+                                                <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                                             </Border>
                                             <ControlTemplate.Triggers>
                                                 <MultiTrigger>
                                                     <MultiTrigger.Conditions>
-                                                        <Condition Property="IsMouseOver" Value="True"/>
+                                                        <Condition Property="IsMouseOver" Value="True" />
                                                     </MultiTrigger.Conditions>
-                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
-                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}"/>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}" />
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.hov.bg}" />
                                                 </MultiTrigger>
                                                 <MultiTrigger>
                                                     <MultiTrigger.Conditions>
-                                                        <Condition Property="Selector.IsSelectionActive" Value="False"/>
-                                                        <Condition Property="IsSelected" Value="True"/>
+                                                        <Condition Property="Selector.IsSelectionActive" Value="False" />
+                                                        <Condition Property="IsSelected" Value="True" />
                                                     </MultiTrigger.Conditions>
-                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}"/>
-                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}"/>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Background}" />
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource Item.SelectedInactive.Border}" />
                                                 </MultiTrigger>
                                                 <MultiTrigger>
                                                     <MultiTrigger.Conditions>
-                                                        <Condition Property="Selector.IsSelectionActive" Value="True"/>
-                                                        <Condition Property="IsSelected" Value="True"/>
+                                                        <Condition Property="Selector.IsSelectionActive" Value="True" />
+                                                        <Condition Property="IsSelected" Value="True" />
                                                     </MultiTrigger.Conditions>
-                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}"/>
-                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}"/>
+                                                    <Setter Property="Background" TargetName="Bd" Value="{StaticResource color.item-state.sel.bg.lv3}" />
+                                                    <Setter Property="BorderBrush" TargetName="Bd" Value="{StaticResource color.item-state.sel.border.lv3}" />
                                                 </MultiTrigger>
                                                 <Trigger Property="IsEnabled" Value="False">
-                                                    <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
+                                                    <Setter Property="TextElement.Foreground" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
                                                 </Trigger>
                                             </ControlTemplate.Triggers>
                                         </ControlTemplate>
                                     </Setter.Value>
                                 </Setter>
-                                <Setter Property="HorizontalContentAlignment" Value="Center"/>
-                                <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown"/>
+                                <Setter Property="HorizontalContentAlignment" Value="Center" />
+                                <EventSetter Event="PreviewMouseLeftButtonDown" Handler="ListBoxItem_PreviewMouseLeftButtonDown" />
                             </Style>
                         </ListBox.ItemContainerStyle>
                     </ListBox>
@@ -401,4 +396,4 @@
             </TabItem>
         </TabControl>-->
     </Grid>
-</UserControl>
+</UserControl>

+ 10 - 2
PDF Office/Views/PropertyPanel/AnnotPanel/StampAnnotProperty.xaml.cs

@@ -27,6 +27,14 @@ namespace PDF_Master.Views.PropertyPanel.AnnotPanel
         public StampAnnotProperty()
         {
             InitializeComponent();
+            KeyEventsHelper.KeyDown -= ShortCut_KeyDown;
+            KeyEventsHelper.KeyDown += ShortCut_KeyDown;
+        }
+
+        private void ShortCut_KeyDown(object sender, KeyEventArgs e)
+        {
+            (DataContext as StampAnnotPropertyViewModel).Close();
+            e.Handled = true;
         }
 
         private void ListBoxItem_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
@@ -34,7 +42,7 @@ namespace PDF_Master.Views.PropertyPanel.AnnotPanel
             ListBox listBox = CommonHelper.FindVisualParent<ListBox>(sender as ListBoxItem);
             if (listBox != null)
             {
-                if (listBox.Tag!=null&&listBox.Tag.ToString() == "Dynamic")
+                if (listBox.Tag != null && listBox.Tag.ToString() == "Dynamic")
                 {
                     (DataContext as StampAnnotPropertyViewModel).SetDynamicStamp((sender as ListBoxItem).DataContext as Stamp);
                     return;
@@ -95,7 +103,7 @@ namespace PDF_Master.Views.PropertyPanel.AnnotPanel
 
         private void UserControl_Loaded(object sender, RoutedEventArgs e)
         {
-            AnnoteTypeTitle.Text= App.MainPageLoader.GetString("Stamp_Title");
+            AnnoteTypeTitle.Text = App.MainPageLoader.GetString("Stamp_Title");
         }
     }
 }