Browse Source

文本注释-预设 保存

OYXH\oyxh 1 year ago
parent
commit
d640a61348
2 changed files with 15 additions and 6 deletions
  1. 4 1
      PDF Office/App.xaml.cs
  2. 11 5
      PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

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

@@ -235,6 +235,9 @@ namespace PDF_Master
 
             if (Settings.Default.QuickPDFToolsList == null)
                 Settings.Default.QuickPDFToolsList = new PDFSettings.QuickPDFToolsList();
+
+            if (Settings.Default.PresetFontList == null)
+                Settings.Default.PresetFontList = new PDFSettings.PresetFontList();
         }
 
         protected override void OnStartup(StartupEventArgs e)
@@ -354,7 +357,7 @@ namespace PDF_Master
                 }
 
                 //如果如果缓存被清空,但是缓存文档还在时,更新变量
-                if(string.IsNullOrEmpty(GuidPDFPath))
+                if (string.IsNullOrEmpty(GuidPDFPath))
                 {
                     GuidPDFPath = Path.Combine(CachePath.GuidPDFPath, "Quick Start Guide.pdf");
                 }

+ 11 - 5
PDF Office/Model/PropertyPanel/AnnotPanel/FontStyleItem.cs

@@ -79,10 +79,16 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
                         )
                     {
                         isCanSave = true;
-                        cacheItem.mFontFamily = new FontFamily(item.mFontFamily.Source);
-                        cacheItem.mFontSize = item.mFontSize;
-                        cacheItem.mFontStyle = item.mFontStyle;
-                        cacheItem.mFontWeight = item.mFontWeight;
+                        var index = Settings.Default.PresetFontList.FindIndex(temp => temp.mTag == cacheItem.mTag);
+                        if (index != -1)
+                        {
+                            Settings.Default.PresetFontList.Remove(cacheItem);
+                            Settings.Default.PresetFontList.Insert(index, item);
+                        }
+                        //cacheItem.mFontFamily = new FontFamily(item.mFontFamily.Source);
+                        //cacheItem.mFontSize = item.mFontSize;
+                        //cacheItem.mFontStyle = item.mFontStyle;
+                        //cacheItem.mFontWeight = item.mFontWeight;
 
                         break;
                     }
@@ -99,7 +105,7 @@ namespace PDF_Master.Model.PropertyPanel.AnnotPanel
             }
 
             if (isCanSave)
-                Settings.Default.Save();
+                Settings.Default.Save();
         }
 
         public static void BackDefaultPresetFontStyle(string tag)