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