Procházet zdrojové kódy

Merge branch 'dev' into practice2

OYXH\oyxh před 2 roky
rodič
revize
c863c45656

+ 8 - 8
PDF Office/Helper/SettingHelper.cs

@@ -146,14 +146,14 @@ namespace PDF_Office.Helper
 
         public static DefaultAnnotProperty GetAnnotDefaultProperty(AnnotArgsType annotToolType,string saveKey="")
         {
-            //if (Settings.Default.DefautAnnotProperties != null)
-            //{
-            //    if(saveKey=="")
-            //    {
-            //        return Settings.Default.DefautAnnotProperties.GetAnnotProperty(annotToolType);
-            //    }
-            //    return Settings.Default.DefautAnnotProperties.GetAnnotProperty(annotToolType,saveKey);
-            //}
+            if (Settings.Default.DefautAnnotProperties != null)
+            {
+                if (saveKey == "")
+                {
+                    return Settings.Default.DefautAnnotProperties.GetAnnotProperty(annotToolType);
+                }
+                return Settings.Default.DefautAnnotProperties.GetAnnotProperty(annotToolType, saveKey);
+            }
             return null;
         }
 

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -285,6 +285,7 @@
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageExtractDialogViewModel.cs" />
     <Compile Include="ViewModels\Dialog\HomePageToolsDialogs\HomePageInsertDialogViewModel.cs" />
     <Compile Include="ViewModels\PageEdit\PageEditContentViewModel.cs" />
+    <Compile Include="ViewModels\Tools\AnnotToolContentViewModel.cs" />
     <Compile Include="ViewModels\Tools\ToolsBarContentViewModel.cs" />
     <Compile Include="Views\BOTA\BookmarkContent.xaml.cs">
       <DependentUpon>BookmarkContent.xaml</DependentUpon>

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

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

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

@@ -5,5 +5,8 @@
     <Setting Name="RecentOpenFiles" Type="PDFSettings.Settings.RecentOpenFiles" Scope="User">
       <Value Profile="(Default)" />
     </Setting>
+    <Setting Name="DefautAnnotProperties" Type="PDFSettings.DefaultAnnotProperties" Scope="User">
+      <Value Profile="(Default)" />
+    </Setting>
   </Settings>
 </SettingsFile>

+ 146 - 0
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -0,0 +1,146 @@
+using ComPDFKitViewer;
+using ComPDFKitViewer.AnnotEvent;
+using ComPDFKitViewer.PdfViewer;
+using PDF_Office.CustomControl;
+using PDF_Office.Helper;
+using PDF_Office.Model;
+using PDFSettings;
+using Prism.Commands;
+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;
+using System.Windows.Controls;
+using System.Windows.Media;
+
+namespace PDF_Office.ViewModels.Tools
+{
+    public class AnnotToolContentViewModel : BindableBase, INavigationAware
+    {
+        private CPDFViewer PDFViewer;
+        private ViewContentViewModel viewContentViewModel;
+        public DelegateCommand<CustomIconToggleBtn> MyToolsCommand { get; set; }
+
+        public AnnotToolContentViewModel()
+        {
+
+            MyToolsCommand = new DelegateCommand<CustomIconToggleBtn>(BtnMyTools_Click);
+        }
+
+        private Dictionary<string, bool> ToolExpandDict = new Dictionary<string, bool>();
+        public void BtnMyTools_Click(CustomIconToggleBtn annotBtn)
+        {
+            Dictionary<AnnotAttrib, object> annotAttribsList = new Dictionary<AnnotAttrib, object>();
+            UserControl propertyPanel = null;
+
+            switch (annotBtn.Tag.ToString())
+            {
+                case "SnapshotEdit":
+                    break;
+
+                case "HighLight":
+                    TextHighlightAnnotArgs highlightArgs = new TextHighlightAnnotArgs();
+                    highlightArgs.Color = Color.FromRgb(0xFF, 0xBB, 0x00);
+                    highlightArgs.Transparency = 0.5;
+                    DefaultAnnotProperty annotProperty = SettingHelper.GetAnnotDefaultProperty(AnnotArgsType.AnnotHighlight);
+                    if (annotProperty != null)
+                    {
+                        highlightArgs.Color = annotProperty.ForgoundColor;
+                        highlightArgs.Transparency = annotProperty.Opacity;
+                        highlightArgs.Content = annotProperty.NoteText;
+                    }
+                    annotAttribsList[AnnotAttrib.Color] = highlightArgs.Color;
+                    annotAttribsList[AnnotAttrib.Transparency] = highlightArgs.Transparency;
+                    annotAttribsList[AnnotAttrib.NoteText] = string.Empty;
+                   
+                 /*   TextAnnotProperty textAnnotProperty = new TextAnnotProperty();
+                    textAnnotProperty.DataChanged += AnnotPropertyPanel_DataChanged;
+                    textAnnotProperty.DefaultStored += AnnotProperty_DefaultStored;
+                    textAnnotProperty.SetAnnotType(highlightArgs.EventType);
+                    textAnnotProperty.SetSelectedColor(highlightArgs.Color);
+                    textAnnotProperty.SetSelectOpacity(highlightArgs.Transparency);
+                    textAnnotProperty.SetNoteContent(highlightArgs.Content);
+                    textAnnotProperty.AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(highlightArgs, annotAttribsList);
+                    propertyPanel = textAnnotProperty;
+                    annotArgs = highlightArgs;*/
+
+                    if (!ToolExpandDict.ContainsKey("HighLight"))
+                    {
+                        ToolExpandDict["HighLight"] = true;
+                      //  viewCtrl.PropRow.Width = new GridLength(256 + (int)SystemParameters.ScrollWidth);
+                    }
+
+                    break;
+
+                case "UnderLine":
+                    break;
+
+                case "Squiggly":
+                    break;
+
+                case "Strikeout":
+                    break;
+
+                case "Freehand":
+                    break;
+
+                case "Freetext":
+                    break;
+
+                case "StickyNote":
+                    break;
+
+                case "Rect":
+                    break;
+
+                case "Circle":
+                    break;
+
+                case "Arrow":
+                    break;
+
+                case "Line":
+                    break;
+
+                case "Stamp":
+                    break;
+
+                case "Image":
+                    break;
+
+                case "Signature":
+                    break;
+
+                case "Link":
+                    break;
+
+            }
+
+        }
+
+        public bool IsNavigationTarget(NavigationContext navigationContext)
+        {
+            return true;
+        }
+
+        public void OnNavigatedFrom(NavigationContext navigationContext)
+        {
+        }
+
+        public void OnNavigatedTo(NavigationContext navigationContext)
+        {
+            navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
+            navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
+
+            if (PDFViewer != null)
+            {
+
+            }
+        }
+    }
+   
+}

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 34 - 16
PDF Office/Views/Tools/AnnotToolContent.xaml