Przeglądaj źródła

【注释】文本注释,更改预设字体后,点击其他文本注释,右侧预设选项未刷新

OYXH\oyxh 1 rok temu
rodzic
commit
79aaf441bd

+ 71 - 33
PDF Office/Model/AnnotPanel/FontBoard.cs

@@ -1,4 +1,5 @@
 using ComPDFKit.PDFAnnotation;
+using ComPDFKitViewer.AnnotEvent;
 using PDF_Master.CustomControl.CompositeControl;
 using PDF_Master.Model.PropertyPanel.AnnotPanel;
 using PDFSettings;
@@ -22,14 +23,15 @@ namespace PDF_Master.Model.AnnotPanel
         FontWeight_Style,
         FontColor,
         TextAlignment
-
     }
 
     //设置字体大小、字体内容排版、字体颜色、字体样式、字重
     public class FontBoard : BindableBase
     {
         #region 变量
+
         protected event EventHandler<FontSetModeType> ChangedValue;
+
         protected bool IsCanSave = false;
         public List<ComboDataItem> FontFamilyItems { get; protected set; }
         public List<ComboDataItem> FontStyleItems { get; protected set; }
@@ -37,9 +39,10 @@ namespace PDF_Master.Model.AnnotPanel
 
         public List<PresetFontItem> PresetFontList = new List<PresetFontItem>();
 
-        #endregion
+        #endregion 变量
 
         #region 初始化下拉框或列表默认的数据
+
         protected void InitBaseVariable()
         {
             InitBase_PresetFontStyles();
@@ -58,24 +61,26 @@ namespace PDF_Master.Model.AnnotPanel
                 ComboDataItem itemData = new ComboDataItem(item.mTag, item.mTagContent);
                 PresetFontItems.Add(itemData);
             }
-
         }
+
         //字体
         private void InitBase_FontFamilys()
         {
             FontFamilyItems = TextFont.GetFamily();
         }
+
         //字重
         private void InitBase_FontStyles()
         {
             FontStyleItems = TextFont.GetFontStyle();
         }
 
-        #endregion
+        #endregion 初始化下拉框或列表默认的数据
 
         #region 属性
 
         private ComboDataItem _currentPresetFont;
+
         public ComboDataItem CurrentPresetFont
         {
             get { return _currentPresetFont; }
@@ -94,6 +99,7 @@ namespace PDF_Master.Model.AnnotPanel
 
         //下拉框列表
         private ComboDataItem _currentFontFamily;
+
         public ComboDataItem CurrentFontFamily
         {
             get { return _currentFontFamily; }
@@ -103,16 +109,18 @@ namespace PDF_Master.Model.AnnotPanel
                 SetProperty(ref _currentFontFamily, value);
                 if (isChange)
                 {
-
                     ChangedValue?.Invoke(_currentFontFamily.ValueStr, FontSetModeType.FontFamilys);
                 }
             }
         }
-        #endregion
+
+        #endregion 字体样式
 
         #region 字体大小
+
         //下拉框列表:字体大小
         private ComboDataItem _currentFontSize = new ComboDataItem(6);
+
         public ComboDataItem CurrentFontSize
         {
             get { return _currentFontSize; }
@@ -130,12 +138,12 @@ namespace PDF_Master.Model.AnnotPanel
             }
         }
 
-        #endregion
-
+        #endregion 字体大小
 
         //FontStyle & FontWeight
 
         private FontStyle _fontStyle;
+
         public FontStyle FontStyleItem
         {
             get { return _fontStyle; }
@@ -143,6 +151,7 @@ namespace PDF_Master.Model.AnnotPanel
         }
 
         private FontWeight _fontWeight;
+
         public FontWeight FontWeightItem
         {
             get { return _fontWeight; }
@@ -150,6 +159,7 @@ namespace PDF_Master.Model.AnnotPanel
         }
 
         private ComboDataItem _currrentFontWeightStyle;
+
         public ComboDataItem CurrrentFontWeightStyle
         {
             get { return _currrentFontWeightStyle; }
@@ -191,6 +201,7 @@ namespace PDF_Master.Model.AnnotPanel
         }
 
         private C_TEXT_ALIGNMENT _textAlignment;
+
         public C_TEXT_ALIGNMENT TextAlignmentItem
         {
             get { return _textAlignment; }
@@ -199,6 +210,7 @@ namespace PDF_Master.Model.AnnotPanel
 
         //颜色
         private Brush selectColor = new SolidColorBrush(Colors.Black);
+
         public Brush SelectColor
         {
             get { return selectColor; }
@@ -213,11 +225,11 @@ namespace PDF_Master.Model.AnnotPanel
                 {
                     CurrentFontColor = selectColor;
                 }
-
             }
         }
 
         private Brush _currentFontColor = new SolidColorBrush(Colors.Transparent);
+
         public Brush CurrentFontColor
         {
             get { return _currentFontColor; }
@@ -239,6 +251,7 @@ namespace PDF_Master.Model.AnnotPanel
             }
             return false;
         }
+
         private bool IsEqualStrComboData(ComboDataItem oldValue, ComboDataItem newValue)
         {
             if (newValue == null || string.IsNullOrEmpty(newValue.ValueStr) == true || IsCanSave == false)
@@ -251,8 +264,8 @@ namespace PDF_Master.Model.AnnotPanel
             }
             return false;
         }
-        #endregion
 
+        #endregion 属性
 
         #region 列表选中赋值
 
@@ -267,13 +280,11 @@ namespace PDF_Master.Model.AnnotPanel
                     strValue = "Regular";
                     strContent = "常规";
                 }
-
                 else
                 {
                     strValue = "Bold";
                     strContent = "粗体";
                 }
-
             }
             else
             {
@@ -287,13 +298,11 @@ namespace PDF_Master.Model.AnnotPanel
                     strValue = "Bold Italic";
                     strContent = "粗斜体";
                 }
-
             }
 
             CurrrentFontWeightStyle = new ComboDataItem(strValue, strContent);
         }
 
-
         protected void GetCurrentFontSize(int size)
         {
             CurrentFontSize = new ComboDataItem(size);
@@ -304,15 +313,14 @@ namespace PDF_Master.Model.AnnotPanel
             CurrentFontFamily = new ComboDataItem(fontFamily, uiStr);
         }
 
-        #endregion
+        #endregion 列表选中赋值
     }
 
-
-
     //设置字体大小、字体内容排版、字体颜色、字体样式、字重
     public class FontBoardVm : BindableBase
     {
         #region 变量
+
         public List<ComboDataItem> FontFamilyItems { get; protected set; }
         public List<ComboDataItem> FontStyleItems { get; protected set; }
         public List<ComboDataItem> PresetFontItems { get; protected set; }
@@ -324,9 +332,11 @@ namespace PDF_Master.Model.AnnotPanel
             if (isInitdata)
                 InitBaseVariable();
         }
-        #endregion
+
+        #endregion 变量
 
         #region 初始化下拉框或列表默认的数据
+
         protected void InitBaseVariable()
         {
             InitBase_PresetFontStyles();
@@ -345,24 +355,26 @@ namespace PDF_Master.Model.AnnotPanel
                 ComboDataItem itemData = new ComboDataItem(item.mTag, item.mTagContent);
                 PresetFontItems.Add(itemData);
             }
-
         }
+
         //字体
         private void InitBase_FontFamilys()
         {
             FontFamilyItems = TextFont.GetFamily();
         }
+
         //字重
         private void InitBase_FontStyles()
         {
             FontStyleItems = TextFont.GetFontStyle();
         }
 
-        #endregion
+        #endregion 初始化下拉框或列表默认的数据
 
         #region 属性
 
-        private ComboDataItem _currentPresetFont = new ComboDataItem("custom", "Custom");
+        private ComboDataItem _currentPresetFont = new ComboDataItem("Custom", "Custom");
+
         public ComboDataItem CurrentPresetFont
         {
             get { return _currentPresetFont; }
@@ -372,29 +384,33 @@ namespace PDF_Master.Model.AnnotPanel
         #region 字体样式
 
         //下拉框列表
-        private ComboDataItem _currentFontFamily = new ComboDataItem("Arial", "Helvetica");
+        private ComboDataItem _currentFontFamily = new ComboDataItem("Helvatica", "Helvetica");
+
         public ComboDataItem CurrentFontFamily
         {
             get { return _currentFontFamily; }
             set => SetProperty(ref _currentFontFamily, value);
         }
-        #endregion
+
+        #endregion 字体样式
 
         #region 字体大小
+
         //下拉框列表:字体大小
         private ComboDataItem _currentFontSize = new ComboDataItem(6);
+
         public ComboDataItem CurrentFontSize
         {
             get { return _currentFontSize; }
             set => SetProperty(ref _currentFontSize, value);
         }
 
-        #endregion
-
+        #endregion 字体大小
 
         //FontStyle & FontWeight
 
         private FontStyle _fontStyleItem;
+
         public FontStyle FontStyleItem
         {
             get { return _fontStyleItem; }
@@ -402,6 +418,7 @@ namespace PDF_Master.Model.AnnotPanel
         }
 
         private FontWeight _fontWeight;
+
         public FontWeight FontWeightItem
         {
             get { return _fontWeight; }
@@ -409,6 +426,7 @@ namespace PDF_Master.Model.AnnotPanel
         }
 
         private ComboDataItem _currrentFontWeightStyle = new ComboDataItem("Regular", "Regular");
+
         public ComboDataItem CurrrentFontWeightStyle
         {
             get { return _currrentFontWeightStyle; }
@@ -443,14 +461,16 @@ namespace PDF_Master.Model.AnnotPanel
 
         //文字内容对齐
         private string _strtextAlign;
+
         public string StrTextAlign
         {
             get { return _strtextAlign; }
             set { SetProperty(ref _strtextAlign, value); }
         }
-        
+
         //颜色
         private Brush _fontColor = new SolidColorBrush(Colors.Black);
+
         public Brush FontColor
         {
             get { return _fontColor; }
@@ -458,6 +478,7 @@ namespace PDF_Master.Model.AnnotPanel
         }
 
         private Brush _currentFontColor = new SolidColorBrush(Colors.Transparent);
+
         public Brush CurrentFontColor
         {
             get { return _currentFontColor; }
@@ -466,13 +487,14 @@ namespace PDF_Master.Model.AnnotPanel
 
         //外部UI引用,判断是否选中左对齐、居中对齐、右对齐,或都不选中
         public string strAglinState { get; private set; }
+
         //VM赋值
         public void SetStrAglinState(string str)
         {
             strAglinState = str;
         }
-        #endregion
 
+        #endregion 属性
 
         #region 列表选中赋值
 
@@ -487,13 +509,11 @@ namespace PDF_Master.Model.AnnotPanel
                     strValue = "Regular";
                     strContent = "常规";
                 }
-
                 else
                 {
                     strValue = "Bold";
                     strContent = "粗体";
                 }
-
             }
             else
             {
@@ -507,13 +527,11 @@ namespace PDF_Master.Model.AnnotPanel
                     strValue = "Bold Italic";
                     strContent = "粗斜体";
                 }
-
             }
 
             CurrrentFontWeightStyle = new ComboDataItem(strValue, strContent);
         }
 
-
         public void GetCurrentFontSize(int size)
         {
             CurrentFontSize = new ComboDataItem(size);
@@ -524,6 +542,26 @@ namespace PDF_Master.Model.AnnotPanel
             CurrentFontFamily = new ComboDataItem(fontFamily, uiStr);
         }
 
-        #endregion
+        public void GetCurrentPresetFont(string presetFont, string uiStr)
+        {
+            CurrentPresetFont = new ComboDataItem(presetFont, uiStr);
+        }
+
+        internal void GetCurrentPresetFont(FreeTextAnnotArgs annot)
+        {
+            //List<PresetFontItem> presetFontItems = TextFont.GetCachePresetFontList();
+            foreach (var item in PresetFontList)
+            {
+                if (annot.FontSize == item.mFontSize && annot.FontWeight == item.mFontWeight
+                    && (annot.FontFamily.Source == item.mFontFamily.Source || annot.FontFamily.Source == "Arial" && item.mFontFamily.Source == "Helvatica")
+                    )
+                {
+                    CurrentPresetFont = new ComboDataItem(item.mTag, item.mTagContent);
+                }
+            }
+           
+        }
+
+        #endregion 列表选中赋值
     }
-}
+}

+ 15 - 28
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -11,7 +11,6 @@ using System.Windows.Media;
 
 namespace PDF_Master.Model.PropertyPanel.AnnotPanel
 {
-
     public class TextFont
     {
         //获取本地缓存数据
@@ -25,7 +24,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             if (Settings.Default.PresetFontList.Count == 0)
             {
                 cacheTempList = GetPresetFontStyle();
-                foreach(var cacheItem in cacheTempList)
+                foreach (var cacheItem in cacheTempList)
                 {
                     var newItem = new PresetFontItem();
                     newItem.mTag = cacheItem.mTag;
@@ -62,25 +61,24 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
         {
             if (list == null) return;
 
-           if(Settings.Default.PresetFontList == null)
+            if (Settings.Default.PresetFontList == null)
                 Settings.Default.PresetFontList = new PresetFontList();
 
             bool isCanSave = false;
             List<PresetFontItem> TempLists = new List<PresetFontItem>();
 
-           foreach (var item in list)
+            foreach (var item in list)
             {
                 var cacheItem = Settings.Default.PresetFontList.FirstOrDefault(temp => temp.mTag == item.mTag);
                 if (cacheItem != null)
                 {
-                    if(cacheItem.mFontFamily != item.mFontFamily ||
+                    if (cacheItem.mFontFamily != item.mFontFamily ||
                        cacheItem.mFontSize != item.mFontSize ||
                        cacheItem.mFontStyle != item.mFontStyle ||
                        cacheItem.mFontWeight != item.mFontWeight
                         )
                     {
                         isCanSave = true;
-                        
                     }
                     break;
                 }
@@ -90,7 +88,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
                 }
             }
 
-            foreach(var itemTemp in TempLists)
+            foreach (var itemTemp in TempLists)
             {
                 Settings.Default.PresetFontList.Add(itemTemp);
             }
@@ -102,11 +100,11 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
         public static void BackDefaultPresetFontStyle(string tag)
         {
             bool isCanSave = false;
-           var list = GetPresetFontStyle();
+            var list = GetPresetFontStyle();
             var itemDefault = list.FirstOrDefault(temp => temp.mTag == tag);
             if (Settings.Default.PresetFontList == null)
                 Settings.Default.PresetFontList = new PresetFontList();
-            if(Settings.Default.PresetFontList.Count == 0)
+            if (Settings.Default.PresetFontList.Count == 0)
             {
                 Settings.Default.PresetFontList.Add(itemDefault);
                 isCanSave = true;
@@ -130,7 +128,6 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
 
             if (isCanSave == true)
                 Settings.Default.Save();
-
         }
 
         //获取拟定的预设样式
@@ -153,18 +150,17 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             h1.mFontSize = 36;
             h1.mFontFamily = new FontFamily("Helvatica");
             h1.mFontStyle = FontStyles.Normal;
-            h1.mFontWeight = FontWeights.Normal;
+            h1.mFontWeight = FontWeights.Bold;
 
             PresetFontItem h2 = new PresetFontItem();
             h2.mTag = "H2";
-            h2.mTagContent = "h2(标准)";
+            h2.mTagContent = "H2(标准)";
 
             h2.mFontSize = 24;
             h2.mFontFamily = new FontFamily("Helvatica");
             h2.mFontStyle = FontStyles.Normal;
             h2.mFontWeight = FontWeights.Bold;
 
-
             PresetFontItem h3 = new PresetFontItem();
             h3.mTag = "H3";
             h3.mTagContent = "H3小标题";
@@ -181,8 +177,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             b1.mFontSize = 14;
             b1.mFontFamily = new FontFamily("Helvatica");
             b1.mFontStyle = FontStyles.Normal;
-            b1.mFontWeight = FontWeights.Normal;
-
+            b1.mFontWeight = FontWeights.Regular;
 
             PresetFontItem b2 = new PresetFontItem();
             b2.mTag = "B2";
@@ -191,7 +186,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             b2.mFontSize = 12;
             b2.mFontFamily = new FontFamily("Helvatica");
             b2.mFontStyle = FontStyles.Normal;
-            b2.mFontWeight = FontWeights.Normal;
+            b2.mFontWeight = FontWeights.Regular;
 
             PresetFontItem b3 = new PresetFontItem();
             b3.mTag = "B3";
@@ -200,7 +195,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             b3.mFontSize = 11;
             b3.mFontFamily = new FontFamily("Helvatica");
             b3.mFontStyle = FontStyles.Normal;
-            b3.mFontWeight = FontWeights.Normal;
+            b3.mFontWeight = FontWeights.Regular;
 
             fontStyleList.Add(custom);
             fontStyleList.Add(h1);
@@ -233,7 +228,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             var FontFamilyItems = new List<ComboDataItem>();
             ComboDataItem item = new ComboDataItem("Courier", "Courier New");
             FontFamilyItems.Add(item);
-            item = new ComboDataItem("Arial", "Helvetica");
+            item = new ComboDataItem("Helvetica", "Helvetica");
             FontFamilyItems.Add(item);
             item = new ComboDataItem(/*"Times-Roman"*/"Times", "Times New Roman");
             FontFamilyItems.Add(item);
@@ -244,7 +239,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
         public static List<ComboDataItem> GetDateFormats()
         {
             var dateFormatItems = new List<ComboDataItem>();
-            foreach(var itemFormat in GetTimesFormats())
+            foreach (var itemFormat in GetTimesFormats())
             {
                 ComboDataItem item = new ComboDataItem(itemFormat, "format");
                 dateFormatItems.Add(item);
@@ -284,14 +279,6 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             TimesItems.Add("yy-MM-dd");
             TimesItems.Add("yyyy-MM-dd");
             return TimesItems;
-
-
-
-
-
-
-
         }
     }
-   
-}
+}

+ 30 - 43
PDF Office/ViewModels/PropertyPanel/AnnotPanel/FreetextAnnotPropertyViewModel.cs

@@ -46,7 +46,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 SetProperty(ref T_font, value);
             }
         }
-        
+
         private string T_fill;
 
         public string T_Fill
@@ -58,7 +58,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
-
         private void InitString()
         {
             T_Title = App.MainPageLoader.GetString("FreeText_Title");
@@ -66,9 +65,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             T_Fill = App.MainPageLoader.GetString("FreeText_Fill");
         }
 
-        #endregion
+        #endregion 文案
 
         private FontBoardVm _fontVm = new FontBoardVm(true);
+
         public FontBoardVm FontVm
         {
             get { return _fontVm; }
@@ -76,6 +76,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         }
 
         private AnnotCommon _basicVm = new AnnotCommon();
+
         public AnnotCommon BasicVm
         {
             get { return _basicVm; }
@@ -83,6 +84,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         }
 
         private bool _isFillFreeText = false;
+
         public bool IsFillFreeTextAnnot
         {
             get { return _isFillFreeText; }
@@ -90,6 +92,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         }
 
         private bool _isCheckedTime = false;
+
         public bool IsCheckedTime
         {
             get { return _isCheckedTime; }
@@ -97,13 +100,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         }
 
         private ComboDataItem _currrentDateFormat = new ComboDataItem("M/d", "format");
+
         public ComboDataItem CurrrentDateFormat
         {
             get { return _currrentDateFormat; }
             set => SetProperty(ref _currrentDateFormat, value);
         }
 
-
         public List<ComboDataItem> DateFormatItems { get; private set; }
 
         public AnnotAttribEvent AnnotEvent { get; set; }
@@ -115,10 +118,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         public DelegateCommand FontStyleWeightChangedCommand { get; set; }
 
         public DelegateCommand<object> SelectedFillOpacityCommand { get; set; }
-        
+
         public DelegateCommand<object> SelectedColorCommand { get; set; }
         public DelegateCommand<object> SelectedFillColorCommand { get; set; }
-        
 
         public DelegateCommand FontSizeChangedCommand { get; set; }
         public DelegateCommand<object> TextAlignCheckedCommand { get; set; }
@@ -171,14 +173,12 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             InitVariable();
         }
 
-      
         private void InitVariable()
         {
             DateFormatItems = new List<ComboDataItem>();
             DateFormatItems = TextFont.GetDateFormats();
             UpdateDateFormatLists();
             InitFillColorItems();
-
         }
 
         private void InitFillColorItems()
@@ -206,8 +206,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             CurrrentDateFormat = new ComboDataItem(CurrrentDateFormat.ValueStr, CurrrentDateFormat.Content);
         }
 
-     
-
         private void TextAlignChecked(object obj)
         {
             if ((string)obj != null)
@@ -234,13 +232,12 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                         PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.TextAlign, TextAlignment.Justify);
                         break;
                 }
-                
             }
         }
 
         private void LineMode_Checked(object obj)
         {
-            if(obj != null)
+            if (obj != null)
             {
                 var tag = ((string)obj);
                 switch (tag)
@@ -252,12 +249,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     case "Solid":
                         AnnotEvent?.UpdateAttrib(AnnotAttrib.LineStyle, DashStyles.Solid);
                         break;
-
                 }
                 AnnotEvent?.UpdateAnnot();
             }
         }
-        
+
         //从预设样式设置文本
         private void SelectedPresetFont()
         {
@@ -271,7 +267,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     FontVm.GetCurrentFontSize(item.mFontSize);
 
                     if (item.mFontFamily != null)
+                    {
                         FontVm.GetCurrentFontFamily(item.mFontFamily.ToString(), item.mFontFamily.ToString());
+                    }
 
                     FontVm.GetFontWeights_Style(item.mFontStyle, item.mFontWeight);
 
@@ -288,7 +286,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         //设置文本字重、样式
         private void FontStyleWeightChanged()
         {
-            if(FontVm.CurrrentFontWeightStyle != null)
+            if (FontVm.CurrrentFontWeightStyle != null)
             {
                 FontVm.UpdateFontWeight_Style();
 
@@ -298,7 +296,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 PropertyPanel.UpdateAnnotAllAttribs(AnnotAttribDir);
             }
         }
-        
 
         private void SelectedFillOpacity(object obj)
         {
@@ -319,7 +316,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
             }
         }
-        
+
         //设置字体大小
         private void FontSizeChanged()
         {
@@ -386,7 +383,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     menu.IsOpen = true;
                 }
             }
-
         }
 
         private ContextMenu SelectAnnotContextMenu(bool isEnable)
@@ -407,9 +403,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         }
 
         public List<PresetFontItem> FontStyleList = new List<PresetFontItem>();
+
         private void ReDefineFontStyle()
         {
-            
             var item = FontVm.PresetFontList.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
             if (item == null) return;
 
@@ -437,7 +433,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         private void RestoreDefaultStyle()
         {
             var defaultlists = TextFont.GetPresetFontStyle();
-            if(FontVm.CurrentPresetFont.ValueStr != "custom")
+            if (FontVm.CurrentPresetFont.ValueStr != "custom")
             {
                 var defaulItem = defaultlists.FirstOrDefault(temp => temp.mTag == FontVm.CurrentPresetFont.ValueStr);
                 if (defaulItem != null)
@@ -456,19 +452,17 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     }
                 }
             }
-           
         }
 
         private void DateFormatChanged()
         {
-            if(CurrrentDateFormat != null)
+            if (CurrrentDateFormat != null)
             {
                 if (IsCheckedTime)
                     UpdateDateFormatLists();
 
                 PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.NoteText, CurrrentDateFormat.Content);
             }
-
         }
 
         private void ShowTimeCheckedChnaged()
@@ -480,7 +474,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
-
         public bool IsNavigationTarget(NavigationContext navigationContext)
         {
             return true;
@@ -489,7 +482,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
         public void OnNavigatedFrom(NavigationContext navigationContext)
         {
             BasicVm.IsMultiSelected = false;
-          //  IsCheckedTime = false;
+            //  IsCheckedTime = false;
         }
 
         public void OnNavigatedTo(NavigationContext navigationContext)
@@ -497,7 +490,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
             if (PropertyPanel != null)
             {
-               
                 AnnotEvent = PropertyPanel.AnnotEvent;
                 Annot = PropertyPanel.annot as FreeTextAnnotArgs;
                 LoadPropertyHandler?.Invoke(this, Annot);
@@ -518,9 +510,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             }
         }
 
-       /// <summary>
-       /// 多选的注释
-       /// </summary>
+        /// <summary>
+        /// 多选的注释
+        /// </summary>
         private List<FreeTextAnnotArgs> ConvertLists()
         {
             List<FreeTextAnnotArgs> FreeTextLists = new List<FreeTextAnnotArgs>();
@@ -538,6 +530,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             else
                 return FreeTextLists;
         }
+
         private void IsAttributeEquals()
         {
             var list = ConvertLists();
@@ -563,7 +556,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                         FontVm.StrTextAlign = "None";
                     }
 
-
                     if (temp.FontFamily != item.FontFamily)
                     {
                         isNoEqualsDir["FontFamily"] = true;
@@ -604,8 +596,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                             isNoEqualsDir["FillColor"] = true;
                         }
                     }
-
-
                 }
 
                 ////以下是多选注释的属性相等时
@@ -617,7 +607,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 if (isNoEqualsDir["FontFamily"] == false)
                 {
                     FontVm.GetCurrentFontFamily(temp.FontFamily.ToString(), temp.FontFamily.ToString());
-
                 }
 
                 if (isNoEqualsDir["FontSize"] == false)
@@ -629,19 +618,16 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 {
                     FontVm.GetFontWeights_Style(temp.FontStyle, temp.FontWeight);
                 }
-               
+
                 if (isNoEqualsDir["FontColor"] == false)
                 {
                     FontVm.FontColor = new SolidColorBrush(temp.FontColor);
-
                 }
 
                 if (isNoEqualsDir["FillColor"] == false)
                 {
                     FontVm.FontColor = new SolidColorBrush(temp.BgColor);
-
                 }
-
             }
         }
 
@@ -652,6 +638,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
 
             FontVm.FontColor = new SolidColorBrush(Annot.FontColor);
             FontVm.GetCurrentFontSize((int)Annot.FontSize);
+            FontVm.GetCurrentPresetFont(Annot);
             FontVm.GetCurrentFontFamily(Annot.FontFamily.ToString(), Annot.FontFamily.ToString());
             FontVm.GetFontWeights_Style(Annot.FontStyle, Annot.FontWeight);
 
@@ -665,7 +652,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
             if (IsFillFreeTextAnnot == false)
                 return;
 
-            if(string.IsNullOrEmpty(Annot.TextContent))
+            if (string.IsNullOrEmpty(Annot.TextContent))
             {
                 if (CurrrentDateFormat != null)
                 {
@@ -675,7 +662,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.NoteText, CurrrentDateFormat.Content);
                 }
                 return;
-
             }
             DateTime dtDate;
             bool isTime = false;
@@ -703,17 +689,14 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                     {
                         string stadate = System.DateTime.Now.ToString(strFormat);
                         item.SetContent(stadate);
-
                     }
 
                     CurrrentDateFormat = new ComboDataItem(item.ValueStr, item.Content);
 
                     break;
-
                 }
             }
 
-
             IsCheckedTime = isTime;
         }
 
@@ -725,19 +708,23 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
                 case TextAlignment.Left:
                     FontVm.StrTextAlign = "Left";
                     break;
+
                 case TextAlignment.Center:
                     FontVm.StrTextAlign = "Center";
                     break;
+
                 case TextAlignment.Right:
                     FontVm.StrTextAlign = "Right";
                     break;
+
                 case TextAlignment.Justify:
                     FontVm.StrTextAlign = "Justify";
                     break;
+
                 default:
                     FontVm.StrTextAlign = "None";
                     break;
             }
         }
     }
-}
+}

+ 1 - 1
PDF Office/ViewModels/Tools/AnnotManager/AnnotTransfer.cs

@@ -214,7 +214,7 @@ namespace PDF_Master.ViewModels.Tools.AnnotManager
                 }
 
                 AnnotEvent?.UpdateAnnot();
-                this.annot = AnnotEvent.AnnotItemsList[0];
+                //this.annot = AnnotEvent.AnnotItemsList[0];
             }
         }