Browse Source

工具栏 - 注释工具栏ViewModel

chenrongqian 2 years ago
parent
commit
93d43f3bf7

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -284,6 +284,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\BOTAContent.xaml.cs">
       <DependentUpon>BOTAContent.xaml</DependentUpon>

+ 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)
+            {
+
+            }
+        }
+    }
+   
+}