12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160 |
- using ComPDFKit.PDFDocument;
- using ComPDFKitViewer;
- using ComPDFKitViewer.AnnotEvent;
- using ComPDFKitViewer.PdfViewer;
- using PDF_Master.CustomControl;
- using PDF_Master.CustomControl.CompositeControl;
- using PDF_Master.Helper;
- using PDF_Master.Model;
- using PDF_Master.Model.PropertyPanel.AnnotPanel;
- using PDF_Master.ViewModels.Dialog.ChatGPTAIDialogs;
- using PDF_Master.Views.Dialog.ChatGPTAIDialogs;
- using Prism.Commands;
- using Prism.Mvvm;
- using Prism.Regions;
- using Prism.Services.Dialogs;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Input;
- using System.Windows.Markup;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Shapes;
- using WIA;
- using static Dropbox.Api.TeamLog.AdminAlertSeverityEnum;
- using MenuItem = System.Windows.Controls.MenuItem;
- namespace PDF_Master.ViewModels.Tools
- {
- //文件说明:与布局相关的代码逻辑:菜单、属性面板
- public sealed partial class AnnotToolContentViewModel : BindableBase, INavigationAware
- {
- #region 属性面板
- /// <summary>
- /// 导航到同一个注释xaml时,需要区分某个注释;比如高亮、删除线、下划线
- /// </summary>
- /// <param name="viewContent">对应的注释面板</param>
- /// <param name="toolTag">导航到同一个注释xaml时,需要区分某个注释;比如高亮、删除线、下划线</param>
- /// <param name="annot">注释</param>
- /// <param name="annotAttribsList">更改注释属性的键值对,更改值后会自动记录undoRedo容器里</param>
- private void AddToPropertyPanel(string viewContent, string toolTag = null, List<AnnotHandlerEventArgs> annots = null, AnnotAttribEvent annotAttribEvent = null)
- {
- if (annots != null)
- {
- PropertyPanel.annotlists = annots;
- PropertyPanel.annot = annots[0];
- }
- else
- {
- PropertyPanel.annotlists = null;
- PropertyPanel.annot = null;
- }
- PropertyPanel.AnnotEvents = null;
- PropertyPanel.AnnotEvent = null;
- if (annots != null)
- {
- if (annots.Count > 1)
- {
- if (PropertyPanel.AnnotEvents == null)
- {
- PropertyPanel.AnnotEvents = new List<AnnotAttribEvent>();
- }
- PropertyPanel.AnnotEvents.Clear();
- foreach (var itemAnnot in annots)
- {
- var eventitem = AnnotAttribEvent.GetAnnotAttribEvent(itemAnnot, itemAnnot.GetAnnotAttrib(), PDFViewer);
- //eventitem.ClearChangeAttribute();
- PropertyPanel.AnnotEvents.Add(eventitem);
- }
- }
- PropertyPanel.AnnotEvent = AnnotAttribEvent.GetAnnotAttribEvent(annots[0], annots[0].GetAnnotAttrib(), PDFViewer);
- //propertyPanel.AnnotEvent.ClearChangeAttribute();
- if (annots[0] is LinkAnnotArgs && annotAttribEvent != null)
- {
- PropertyPanel.AnnotEvent = annotAttribEvent;
- }
- }
- PropertyPanel.SetIsTextFill(false);
- if (string.IsNullOrEmpty(viewContent) == false)
- {
- ViewContentViewModel.SelectedPrpoertyPanel(viewContent, PropertyPanel);
- }
- }
- /// <summary>
- /// 展开显示属性面板
- /// </summary>
- private void ShowPropertyPanel(bool show = true)
- {
- ViewContentViewModel.IsPropertyOpen = show;
- }
- #endregion 属性面板
- #region 阅读页 - 右键菜单
- #region 右击菜单文案
- /// <summary>
- /// 右键菜单文案
- /// </summary>
- ///
- public string T_RightMenuSelectionCopy = App.MainPageLoader.GetString("ViewRightMenuSelection_Copy");
- public string T_RightMenuSelectionPaste = App.MainPageLoader.GetString("ViewRightMenuSelection_Paste");
- public string T_RightMenuSelectionHighlight = App.MainPageLoader.GetString("ViewRightMenuSelection_Highlight");
- public string T_RightMenuSelectionUnderline = App.MainPageLoader.GetString("ViewRightMenuSelection_Underline");
- public string T_RightMenuSelectionStrikethrough = App.MainPageLoader.GetString("ViewRightMenuSelection_Strikethrough");
- public string T_RightMenuSelectionText = App.MainPageLoader.GetString("ViewRightMenuSelection_Text");
- public string T_RightMenuSelectionNote = App.MainPageLoader.GetString("ViewRightMenuSelection_Note");
- public string T_RightMenuSelectionRectangle = App.MainPageLoader.GetString("ViewRightMenuSelection_Rectangle");
- public string T_RightMenuSelectionOval = App.MainPageLoader.GetString("ViewRightMenuSelection_Oval");
- public string T_RightMenuSelectionStraightLine = App.MainPageLoader.GetString("ViewRightMenuSelection_StraightLine");
- public string T_RightMenuSelectionAddLink = App.MainPageLoader.GetString("ViewRightMenuSelection_AddLink");
- public string T_RightMenuSelectionAddOutline = App.MainPageLoader.GetString("ViewRightMenuSelection_AddOutline");
- public string T_RightMenuSelectionExtractImage = App.MainPageLoader.GetString("ViewRightMenuSelection_ExtractImage");
- #endregion 右击菜单文案
- private ContextMenu ViewerContextMenu(object sender)
- {
- //ContextMenu contextMenu = CommonHelper.DeepClone(App.Current.FindResource("ViewerContextMenu") as ContextMenu);
- string xaml = XamlWriter.Save(App.Current.FindResource("ViewerContextMenu") as ContextMenu);
- ContextMenu contextMenu = XamlReader.Parse(xaml) as ContextMenu;
- //contextMenu.Loaded += ContextMenu_Loaded;
- ViewerContextMenu_Loaded(contextMenu, sender);
- return contextMenu;
- }
- private void ViewerContextMenu_Loaded(object sender, object e)
- {
- ContextMenu contextMenu = sender as ContextMenu;
- contextMenu.DataContext = ViewContentViewModel;
- if (contextMenu.Items.Count > 0)
- {
- int index = PDFViewer.CurrentIndex;
- //检测是否已存在相同数据
- CPDFBookmark list = PDFViewer.Document.GetBookmarkList().FirstOrDefault(q => q.PageIndex == index);
- if (list != null)
- {
- isAddBookMark = false;
- }
- else
- {
- isAddBookMark = true;
- }
- var separator = contextMenu.Items[contextMenu.Items.Count - 3];
- InBookModeSetIsHidden(separator);
- foreach (var item in contextMenu.Items)
- {
- if (item is MenuItem menuItem1)
- {
- switch (menuItem1.Tag.ToString())
- {
- case "Paste":
- Separator separator1 = (Separator)contextMenu.Items[1];
- //粘贴
- if (!ApplicationCommands.Paste.CanExecute(null, (UIElement)e))
- {
- //menuItem1.IsEnabled = false;
- //menuItem1.Opacity = 0.5;
- menuItem1.Visibility = Visibility.Collapsed;
- separator1.Visibility = Visibility.Collapsed;
- }
- else
- {
- //menuItem1.IsEnabled = true;
- //menuItem1.Opacity = 1;
- menuItem1.Visibility = Visibility.Visible;
- separator1.Visibility = Visibility.Visible;
- }
- menuItem1.CommandTarget = (UIElement)e;
- menuItem1.Command = ApplicationCommands.Paste;
- break;
- case "AddAnnotation":
- if (menuItem1.Items.Count > 0)
- {
- SetAddAnnotation(menuItem1.Items);
- }
- break;
- case "HiddenAnnot":
- menuItem1.Click -= HiddenAnnot_Click;
- menuItem1.Click += HiddenAnnot_Click;
- SetMenuItemVisibility(menuItem1, "DisplayAnnot", "HiddenAnnot", BtnShowAnnotIsChecked);
- break;
- case "DisplayAnnot":
- menuItem1.Click -= DisplayAnnot_Click;
- menuItem1.Click += DisplayAnnot_Click;
- SetMenuItemVisibility(menuItem1, "DisplayAnnot", "HiddenAnnot", BtnShowAnnotIsChecked);
- break;
- case "AddBookMark":
- menuItem1.Command = AddBookMarkCommand;
- SetMenuItemVisibility(menuItem1, "DelBookMark", "AddBookMark", isAddBookMark);
- break;
- case "DelBookMark":
- menuItem1.Click -= DelBookMark_Click;
- menuItem1.Click += DelBookMark_Click;
- SetMenuItemVisibility(menuItem1, "DelBookMark", "AddBookMark", isAddBookMark);
- break;
- case "ToolMode":
- if (menuItem1.Items.Count > 0)
- {
- SetToolMode(menuItem1.Items);
- }
- break;
- case "ReadModel":
- SetMenuItemVisibility(menuItem1, "ReadModel", "UnReadModel", ViewContentViewModel.mainViewModel.IsBookMode);
- menuItem1.Click -= ReadModel_Click;
- menuItem1.Click += ReadModel_Click;
- break;
- case "UnReadModel":
- SetMenuItemVisibility(menuItem1, "ReadModel", "UnReadModel", ViewContentViewModel.mainViewModel.IsBookMode);
- menuItem1.Click -= UnReadModel_Click;
- menuItem1.Click += UnReadModel_Click;
- break;
- case "ViewZoom":
- InBookModeSetIsHidden(menuItem1);
- if (menuItem1.Items.Count > 0)
- {
- ViewZoom(menuItem1.Items);
- }
- break;
- case "PageDisplay":
- if (menuItem1.Items.Count > 0)
- {
- PageDisplay(menuItem1.Items);
- }
- break;
- case "Select":
- InBookModeSetIsHidden(menuItem1);
- menuItem1.Click -= Select_Click;
- menuItem1.Click += Select_Click;
- break;
- case "Print":
- InBookModeSetIsHidden(menuItem1);
- menuItem1.Command = ViewContentViewModel.PrintCommand;
- break;
- case "HighlightLinks":
- InBookModeSetIsHidden(menuItem1);
- if (OpenFileInfo != null)
- {
- menuItem1.IsChecked = OpenFileInfo.ShowHighLightLink;
- }
- menuItem1.Click -= HighlightLinks_Click;
- menuItem1.Click += HighlightLinks_Click;
- break;
- }
- }
- }
- }
- }
- private void HighlightLinks_Click(object sender, RoutedEventArgs e)
- {
- if (sender is MenuItem menuItem)
- {
- //if (OpenFileInfo != null)
- //{
- // menuItem.IsChecked = OpenFileInfo.ShowHighLightLink;
- //}
- if (menuItem.IsChecked)
- {
- PDFViewer.SetShowLink(true);
- }
- else
- {
- PDFViewer.SetShowLink(false);
- }
- if (OpenFileInfo != null)
- {
- OpenFileInfo.ShowHighLightLink = menuItem.IsChecked;
- }
- //if (menuItem.IsChecked == true)
- //{
- // menuItem.IsChecked = false;
- //}
- }
- }
- private void SetMenuItemVisibility(MenuItem menuItem1, string right, string deny, bool flag)
- {
- if (menuItem1.Tag.ToString() == right && flag)
- {
- menuItem1.Visibility = Visibility.Collapsed;
- }
- if (menuItem1.Tag.ToString() == right && flag == false)
- {
- menuItem1.Visibility = Visibility.Visible;
- }
- if (menuItem1.Tag.ToString() == deny && flag == false)
- {
- menuItem1.Visibility = Visibility.Collapsed;
- }
- if (menuItem1.Tag.ToString() == deny && flag)
- {
- menuItem1.Visibility = Visibility.Visible;
- }
- }
- private void CopyMenu_Click(object sender, RoutedEventArgs e)
- {
- //限制权限密码文档的图片复制
- if (!ViewContentViewModel.CheckPermissionBeforeOption())
- {
- return;
- }
- try
- {
- Clipboard.Clear();
- Dictionary<int, List<System.Drawing.Bitmap>> imageDict = PDFViewer?.GetSelectedImages();
- if (imageDict != null && imageDict.Count > 0)
- {
- foreach (int pageIndex in imageDict.Keys)
- {
- List<System.Drawing.Bitmap> imageList = imageDict[pageIndex];
- foreach (System.Drawing.Bitmap image in imageList)
- {
- MemoryStream ms = new MemoryStream();
- image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
- BitmapImage imageData = new BitmapImage();
- imageData.BeginInit();
- imageData.StreamSource = ms;
- imageData.CacheOption = BitmapCacheOption.OnLoad;
- imageData.EndInit();
- imageData.Freeze();
- Clipboard.SetImage(imageData);
- break;
- }
- }
- }
- }
- catch
- {
- }
- }
- /// <summary>
- /// 选择文本或者图像的右键菜单
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="annotCommand"></param>
- /// <returns></returns>
- private ContextMenu SelectedTextOrImageContextMenu(object sender, AnnotCommandArgs annotCommand)
- {
- StrAnnotToolChecked = "";
- ContextMenu popMenu = new ContextMenu();
- popMenu.FontSize = 14;
- MenuItem menuItem = new MenuItem();
- menuItem = new MenuItem();
- menuItem.CommandTarget = (UIElement)sender;
- menuItem.Header = T_RightMenuSelectionCopy;
- menuItem.InputGestureText = "Ctrl+C";
- if (annotCommand.CommandTarget == TargetType.ImageSelection && PDFViewer.GetSelectImageCount() > 0)
- {
- menuItem.IsEnabled = true;
- PDFViewer.ClearCopyData();
- menuItem.Click -= CopyMenu_Click;
- menuItem.Click += CopyMenu_Click;
- }
- else
- {
- menuItem.Command = ApplicationCommands.Copy;
- }
- popMenu.Items.Add(menuItem);
- menuItem = new MenuItem();
- menuItem.Header = T_RightMenuSelectionPaste;
- if (!ApplicationCommands.Paste.CanExecute(null, (UIElement)sender))
- {
- //menuItem1.IsEnabled = false;
- //menuItem1.Opacity = 0.5;
- menuItem.Visibility = Visibility.Collapsed;
- }
- else
- {
- //menuItem1.IsEnabled = true;
- //menuItem1.Opacity = 1;
- menuItem.Visibility = Visibility.Visible;
- }
- menuItem.CommandTarget = (UIElement)sender;
- menuItem.Command = ApplicationCommands.Paste;
- popMenu.Items.Add(menuItem);
- Separator separator = null;
- if (annotCommand.CommandTarget == TargetType.ImageSelection)
- {
- separator = SetSeparator();
- popMenu.Items.Add(separator);
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionExtractImage, "ExportPicture", annotCommand, out menuItem);
- if (PDFViewer.GetSelectImageCount() > 0)
- {
- menuItem.IsEnabled = true;
- }
- popMenu.Items.Add(menuItem);
- }
- else if (annotCommand.CommandTarget == TargetType.Annot)
- {
- separator = SetSeparator();
- popMenu.Items.Add(separator);
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionHighlight, "HighLight", annotCommand, out menuItem);
- popMenu.Items.Add(menuItem);
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionUnderline, "UnderLine", annotCommand, out menuItem);
- popMenu.Items.Add(menuItem);
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionStrikethrough, "Strikeout", annotCommand, out menuItem);
- popMenu.Items.Add(menuItem);
- separator = SetSeparator();
- //popMenu.Items.Add(separator);
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionText, "Freetext", annotCommand, out menuItem);
- //popMenu.Items.Add(menuItem);
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionNote, "StickyNote", annotCommand, out menuItem);
- //popMenu.Items.Add(menuItem);
- separator = SetSeparator();
- popMenu.Items.Add(separator);
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionRectangle, "Rect", annotCommand, out menuItem);
- popMenu.Items.Add(menuItem);
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionOval, "Circle", annotCommand, out menuItem);
- popMenu.Items.Add(menuItem);
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionStraightLine, "Line", annotCommand, out menuItem);
- //popMenu.Items.Add(menuItem);
- }
- separator = SetSeparator();
- popMenu.Items.Add(separator);
- InBookModeSetIsHidden(separator);
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionAddLink, "Link", annotCommand, out menuItem);
- popMenu.Items.Add(menuItem);
- if (annotCommand.CommandTarget == TargetType.Annot)
- {
- SetSelectTextOrImageMenuItem(T_RightMenuSelectionAddOutline, "OutLine", annotCommand, out menuItem);
- popMenu.Items.Add(menuItem);
- SetSelectTextOrImageMenuItem("AI Translation", "Translation", annotCommand, out menuItem);
- popMenu.Items.Add(menuItem);
- }
- return popMenu;
- }
- private void MenuTranslate_Click(object sender, RoutedEventArgs eventArgs)
- {
- DialogParameters printValue = new DialogParameters();
- printValue.Add(ParameterNames.PDFViewer, PDFViewer);
- dialogs.ShowDialog(DialogNames.SelectedTranslation, printValue, e => { });
- }
- private void SetSelectTextOrImageMenuItem(string header, string tag, AnnotCommandArgs annotCommand, out MenuItem menuItem)
- {
- menuItem = new MenuItem();
- menuItem.Header = header;
- menuItem.Tag = tag;
- if (tag == "Translation") {
- menuItem.Click -= MenuTranslate_Click;
- menuItem.Click += MenuTranslate_Click;
- return;
- }
- if (tag == "OutLine" || tag == "Link")
- {
- InBookModeSetIsHidden(menuItem);
- }
- menuItem.Click -= AnnotToolMenu_Click;
- menuItem.Click += AnnotToolMenu_Click;
- menuItem.CommandParameter = annotCommand;
- }
- private Separator SetSeparator()
- {
- Separator separator = new Separator
- {
- Height = 1,
- BorderBrush = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#33000000")),
- BorderThickness = new Thickness(1),
- Style = (Style)App.Current.FindResource(System.Windows.Controls.ToolBar.SeparatorStyleKey)
- };
- return separator;
- }
- #endregion 阅读页 - 右键菜单
- #region 注释-右键菜单
- #region 注释-右键菜单文案
- //public string T_RightMenuAnnotCopy = App.MainPageLoader.GetString("ViewRightMenuSelection_Copy");
- //public string T_RightMenuAnnotPaste = App.MainPageLoader.GetString("ViewRightMenuSelection_Paste");
- //public string T_RightMenuAnnotHighlight = App.MainPageLoader.GetString("ViewRightMenuSelection_Highlight");
- //public string T_RightMenuAnnotUnderline = App.MainPageLoader.GetString("ViewRightMenuSelection_Underline");
- //public string T_RightMenuAnnotStrikethrough = App.MainPageLoader.GetString("ViewRightMenuSelection_Strikethrough");
- //public string T_RightMenuAnnotText = App.MainPageLoader.GetString("ViewRightMenuSelection_Text");
- //public string T_RightMenuAnnotNote = App.MainPageLoader.GetString("ViewRightMenuSelection_Note");
- public string T_RightMenuAnnotCopy = App.MainPageLoader.GetString("ViewRightMenuAnnot_Copy");
- public string T_RightMenuAnnotCut = App.MainPageLoader.GetString("ViewRightMenuAnnot_Cut");
- public string T_RightMenuAnnotPaste = App.MainPageLoader.GetString("ViewRightMenuAnnot_Paste");
- public string T_RightMenuAnnotDelete = App.MainPageLoader.GetString("ViewRightMenuAnnot_Delete");
- public string T_RightMenuAnnotAddNote = App.MainPageLoader.GetString("ViewRightMenuAnnot_AddNote");
- public string T_RightMenuAnnotDefault = App.MainPageLoader.GetString("ViewRightMenuAnnot_Default");
- public string T_RightMenuFreehandAnnotColor = App.MainPageLoader.GetString("ViewRightMenuFreehandAnnot_Color");
- public string T_RightMenuFreehandAnnotLineStyle = App.MainPageLoader.GetString("ViewRightMenuFreehandAnnot_LineStyle");
- public string T_RightMenuFreehandAnnotLineStyleSolid = App.MainPageLoader.GetString("ViewRightMenuFreehandAnnotLineStyle_SolidLine");
- public string T_RightMenuFreehandAnnotLineStyleDotted = App.MainPageLoader.GetString("ViewRightMenuFreehandAnnotLineStyle_DottedLine");
- public string T_RightMenuFreetextAnnotFontColor = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnot_FontColor");
- public string T_RightMenuFreetextAnnotFillColor = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnot_FillColor");
- public string T_RightMenuFreetextAnnotFont = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnot_Font");
- public string T_RightMenuFreetextAnnotFontCourierNew = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnotFont_CourierNew");
- public string T_RightMenuFreetextAnnotFontHelvetica = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnotFont_Helvetica");
- public string T_RightMenuFreetextAnnotFontTimesNewRoman = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnotFont_TimesNewRoman");
- public string T_RightMenuFreetextAnnotTextAlignment = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnot_TextAlignment");
- public string T_RightMenuFreetextAnnotTextAlignmentAlignLeft = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnotTextAlignment_AlignLeft");
- public string T_RightMenuFreetextAnnotTextAlignmentAlignCenter = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnotTextAlignment_AlignCenter");
- public string T_RightMenuFreetextAnnotTextAlignmentAlignRight = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnotTextAlignment_AlignRight");
- public string T_RightMenuFreetextAnnotTextAlignmentFullyJustified = App.MainPageLoader.GetString("ViewRightMenuFreetextAnnotTextAlignment_FullyJustified");
- public string T_RightMenuStickyNoteAnnotColor = App.MainPageLoader.GetString("ViewRightMenuStickyNoteAnnot_Color");
- public string T_RightMenuStickyNoteAnnotEdit = App.MainPageLoader.GetString("ViewRightMenuStickyNoteAnnot_Edit");
- public string T_RightMenuSharpsNoteAnnotColor = App.MainPageLoader.GetString("ViewRightMenuSharpsAnnot_Color");
- public string T_RightMenuSharpsNoteAnnotLineStyleSolidline = App.MainPageLoader.GetString("ViewRightMenuSharpsAnnotLineStyle_SolidLine");
- public string T_RightMenuSharpsNoteAnnotLineStyleDottedLine = App.MainPageLoader.GetString("ViewRightMenuSharpsAnnotLineStyle_DottedLine");
- public string T_RightMenuSharpsNoteAnnotLineStyle = App.MainPageLoader.GetString("ViewRightMenuSharpsAnnot_LineStyle");
- public string T_RightMenuSharpsNoteAnnotDirection = App.MainPageLoader.GetString("ViewRightMenuSharpsAnnot_Direction");
- public string T_RightMenuSharpsNoteAnnotDirectionVertical = App.MainPageLoader.GetString("ViewRightMenuSharpsAnnotDirection_Vertical");
- public string T_RightMenuSharpsNoteAnnotDirectionHorizontal = App.MainPageLoader.GetString("ViewRightMenuSharpsAnnotDirection_Horizontal");
- public string T_RightMenuSharpsNoteAnnotBorderColor = App.MainPageLoader.GetString("ViewRightMenuSharpsAnnot_BorderColor");
- public string T_RightMenuSharpsNoteAnnotFillColor = App.MainPageLoader.GetString("ViewRightMenuSharpsAnnot_FillColor");
- public string T_RightMenuStampNoteAnnotExport = App.MainPageLoader.GetString("ViewRightMenuStampAnnot_Export");
- public string T_RightMenuStampNoteAnnotExportPNG = App.MainPageLoader.GetString("ViewRightMenuStampAnnotExport_PNG");
- public string T_RightMenuStampNoteAnnotExportPDF = App.MainPageLoader.GetString("ViewRightMenuStampAnnotExport_PDF");
- public string T_RightMenuTextNoteAnnotCopyText = App.MainPageLoader.GetString("ViewRightMenuTextAnnot_CopyText");
- public string T_RightMenuTextNoteAnnotDelete = App.MainPageLoader.GetString("ViewRightMenuTextAnnot_Delete");
- #endregion 注释-右键菜单文案
- private ColorMenuItem colorContent;
- /// <summary>
- /// 高亮注释,右键菜单
- /// </summary>
- ///
- private void InitSelectHightAnnotMenu()
- {
- var popMenu = new ContextMenu();
- PopMenu pop = new PopMenu(popMenu);
- colorContent = new ColorMenuItem();
- colorContent.Name = "hightcolor";
- colorContent.ColorChanged -= colorContent_SelectedColorHandler;
- colorContent.ColorChanged += colorContent_SelectedColorHandler;
- colorContent.VerticalAlignment = VerticalAlignment.Top;
- colorContent.Margin = new Thickness(0, 0, 0, -15);
- var menuItem = new MenuItem();
- menuItem.Name = "hightColor";
- menuItem.Height = 20 + 15;
- menuItem.Header = colorContent;
- var hightColorStyle = App.Current.FindResource("UIElementMenuItem") as Style;
- if (hightColorStyle != null)
- menuItem.Style = hightColorStyle;
- colorContent.DataContext = pop.AddItem(menuItem);
- pop.AddItem(GetSeparator());
- menuItem = new MenuItem();
- menuItem.Name = "hightCopyText";
- menuItem.Header = T_RightMenuTextNoteAnnotCopyText;
- pop.BindingEvent(pop.AddItem(menuItem), HightAnnotCopyText_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "hightdelete";
- menuItem.Header = T_RightMenuTextNoteAnnotDelete;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
- pop.AddItem(GetSeparator());
- menuItem = new MenuItem();
- menuItem.Name = "hightAddNote";
- menuItem.Header = T_RightMenuAnnotAddNote;
- pop.BindingEvent(pop.AddItem(menuItem), AnnotAddNoteText_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "hightdefault";
- menuItem.Header = T_RightMenuAnnotDefault;
- pop.BindingEvent(pop.AddItem(menuItem), AnnotDefaultValue_MenuCommand);
- HightAnnotPopMenu = pop;
- }
- private Separator GetSeparator()
- {
- Separator separator = new Separator();
- separator.Height = 1;
- separator.BorderBrush = new SolidColorBrush(Color.FromArgb(0x33, 0x00, 0x00, 0x00));
- separator.BorderThickness = new Thickness(1);
- separator.Margin = new Thickness(-30, 0, 0, 0);
- return separator;
- }
- private async void colorContent_SelectedColorHandler(object sender, Color e)
- {
- if (e == null) return;
- if (sender is Ellipse)
- {
- var item = new ColorDropBoxPop();
- item.DataContext = (sender as Ellipse).DataContext;
- item.ColorSelected -= AnnotMenu_ColorSelected;
- item.ColorSelected += AnnotMenu_ColorSelected;
- if (popup == null)
- popup = new System.Windows.Controls.Primitives.Popup();
- ContentControl window = null;
- if (PDFViewer.Parent as ContentControl != null)
- window = PDFViewer.Parent as ContentControl;
- else
- window = App.Current.MainWindow;
- popup.Child = item;
- popup.PlacementRectangle = new Rect(Mouse.GetPosition(window), new Size(item.Width, item.Height));
- popup.Placement = System.Windows.Controls.Primitives.PlacementMode.MousePoint;
- popup.PlacementTarget = window;
- popup.IsOpen = true;
- Window parentWnd = Window.GetWindow(App.Current.MainWindow);
- if (parentWnd != null)
- {
- parentWnd.MouseDown -= parentWnd_MouseDown;
- parentWnd.MouseDown += parentWnd_MouseDown;
- }
- while (popup.IsOpen)
- await Task.Delay(20);
- parentWnd.MouseDown -= parentWnd_MouseDown;
- popup = null;
- }
- else
- {
- var cusMenuItem = (sender as FrameworkElement).DataContext as CusMenuItem;
- if (cusMenuItem != null && cusMenuItem.Parameter != null)
- {
- if (cusMenuItem.Parameter is TextHighlightAnnotArgs textHighlightAnnotArgs)
- {
- var anvent = AnnotAttribEvent.GetAnnotAttribEvent(textHighlightAnnotArgs, textHighlightAnnotArgs.GetAnnotAttrib(), PDFViewer);
- anvent.UpdateAttrib(AnnotAttrib.Color, e);
- anvent.UpdateAnnot();
- }
- if (cusMenuItem.Parameter is TextUnderlineAnnotArgs textUnderlineAnnotArgs)
- {
- var anvent = AnnotAttribEvent.GetAnnotAttribEvent(textUnderlineAnnotArgs, textUnderlineAnnotArgs.GetAnnotAttrib(), PDFViewer);
- anvent.UpdateAttrib(AnnotAttrib.Color, e);
- anvent.UpdateAnnot();
- }
- if (cusMenuItem.Parameter is TextStrikeoutAnnotArgs textStrikeoutAnnotArgs)
- {
- var anvent = AnnotAttribEvent.GetAnnotAttribEvent(textStrikeoutAnnotArgs, textStrikeoutAnnotArgs.GetAnnotAttrib());
- anvent.UpdateAttrib(AnnotAttrib.Color, e);
- anvent.UpdateAnnot();
- }
- //var test = cusMenuItem.Parameter as TextHighlightAnnotArgs;
- //if (test != null)
- //{
- // var anvent = AnnotAttribEvent.GetAnnotAttribEvent(test, test.GetAnnotAttrib());
- // anvent.UpdateAttrib(AnnotAttrib.Color, e);
- // anvent.UpdateAnnot();
- //}
- }
- }
- }
- /// <summary>
- /// 手绘
- /// </summary>
- private void InitSelectFreeHandAnnotMenu()
- {
- var popMenu = new ContextMenu();
- PopMenu pop = new PopMenu(popMenu);
- var menuItem = new MenuItem();
- menuItem.Name = "FreeHandCopy";
- menuItem.Header = T_RightMenuAnnotCopy;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
- menuItem = new MenuItem();
- menuItem.Name = "FreeHandCut";
- menuItem.Header = T_RightMenuAnnotCut;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
- menuItem = new MenuItem();
- menuItem.Name = "FreeHandPaste";
- menuItem.Header = T_RightMenuAnnotPaste;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
- menuItem = new MenuItem();
- menuItem.Name = "FreeHandDelete";
- menuItem.Header = T_RightMenuAnnotDelete;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
- pop.AddItem(GetSeparator());
- menuItem = new MenuItem();
- menuItem.Name = "FreeHandColor";
- menuItem.Header = T_RightMenuFreehandAnnotColor;
- menuItem.Tag = "Color";
- pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "FreeHandLineStyle";
- menuItem.Header = T_RightMenuFreehandAnnotLineStyle;
- pop.AddItem(menuItem);
- RadioButton radioButton = new RadioButton();
- radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
- radioButton.Background = new SolidColorBrush(Colors.Transparent);
- radioButton.Name = "FreeHandSolid";
- radioButton.Content = T_RightMenuFreehandAnnotLineStyleSolid;
- radioButton.GroupName = "LineStyle";
- radioButton.Tag = "Solid";
- pop.BindingEvent(pop.AddChild("FreeHandLineStyle", radioButton), FreeHandLineStyle_MenuCommand);
- radioButton = new RadioButton();
- radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
- radioButton.Background = new SolidColorBrush(Colors.Transparent);
- radioButton.Name = "FreeHandDash";
- radioButton.Content = T_RightMenuFreehandAnnotLineStyleDotted;
- radioButton.GroupName = "LineStyle";
- radioButton.Tag = "Dash";
- pop.BindingEvent(pop.AddChild("FreeHandLineStyle", radioButton), FreeHandLineStyle_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "FreeHandAddNote";
- menuItem.Header = T_RightMenuAnnotAddNote;
- pop.BindingEvent(pop.AddItem(menuItem), AnnotAddNoteText_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "FreeHandDefault";
- menuItem.Header = T_RightMenuAnnotDefault;
- pop.BindingEvent(pop.AddItem(menuItem), AnnotDefaultValue_MenuCommand);
- FreeHandAnnotPopMenu = pop;
- }
- /// <summary>
- /// 文本
- /// </summary>
- private void InitSelectFreeTextAnnotMenu()
- {
- var popMenu = new ContextMenu();
- PopMenu pop = new PopMenu(popMenu);
- var menuItem = new MenuItem();
- menuItem.Name = "FreeTextCopy";
- menuItem.Header = T_RightMenuAnnotCopy;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
- menuItem = new MenuItem();
- menuItem.Name = "FreeTextCut";
- menuItem.Header = T_RightMenuAnnotCut;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
- menuItem = new MenuItem();
- menuItem.Name = "FreeTextPaste";
- menuItem.Header = T_RightMenuAnnotPaste;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
- menuItem = new MenuItem();
- menuItem.Name = "FreeTextDelete";
- menuItem.Header = T_RightMenuAnnotDelete;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
- pop.AddItem(GetSeparator());
- menuItem = new MenuItem();
- menuItem.Name = "FreeTextColor";
- menuItem.Header = T_RightMenuFreetextAnnotFontColor;
- menuItem.Tag = "FontColor";
- pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "FreeTextFillColor";
- menuItem.Header = T_RightMenuFreetextAnnotFillColor;
- menuItem.Tag = "FillColor";
- pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "FreeTextFontFamily";
- menuItem.Header = T_RightMenuFreetextAnnotFont;
- pop.AddItem(menuItem);
- var family = TextFont.GetFamily();
- foreach (var item in family)
- {
- RadioButton familyRdioBtn = new RadioButton();
- familyRdioBtn.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
- familyRdioBtn.Background = new SolidColorBrush(Colors.Transparent);
- familyRdioBtn.Name = item.ValueStr;
- familyRdioBtn.Tag = item.ValueStr;
- familyRdioBtn.GroupName = "FontFamily";
- familyRdioBtn.Content = item.Content;
- pop.BindingEvent(pop.AddChild("FreeTextFontFamily", familyRdioBtn), FreeTextFontFamily_MenuCommand);
- }
- menuItem = new MenuItem();
- menuItem.Name = "FreeTextAglin";
- menuItem.Header = T_RightMenuFreetextAnnotTextAlignment;
- pop.AddItem(menuItem);
- var radioButton = new RadioButton();
- radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
- radioButton.Background = new SolidColorBrush(Colors.Transparent);
- radioButton.Name = "FreeTextAglinLeft";
- radioButton.Tag = "Left";
- radioButton.GroupName = "Aglin";
- radioButton.Content = T_RightMenuFreetextAnnotTextAlignmentAlignLeft;
- pop.BindingEvent(pop.AddChild("FreeTextAglin", radioButton), FreeTextAglin_MenuCommand);
- radioButton = new RadioButton();
- radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
- radioButton.Background = new SolidColorBrush(Colors.Transparent);
- radioButton.Name = "FreeTextAglinCenter";
- radioButton.Tag = "Center";
- radioButton.GroupName = "Aglin";
- radioButton.Content = T_RightMenuFreetextAnnotTextAlignmentAlignCenter;
- pop.BindingEvent(pop.AddChild("FreeTextAglin", radioButton), FreeTextAglin_MenuCommand);
- radioButton = new RadioButton();
- radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
- radioButton.Background = new SolidColorBrush(Colors.Transparent);
- radioButton.Name = "FreeTextAglinRight";
- radioButton.Tag = "Right";
- radioButton.GroupName = "Aglin";
- radioButton.Content = T_RightMenuFreetextAnnotTextAlignmentAlignRight;
- pop.BindingEvent(pop.AddChild("FreeTextAglin", radioButton), FreeTextAglin_MenuCommand);
- radioButton = new RadioButton();
- radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
- radioButton.Background = new SolidColorBrush(Colors.Transparent);
- radioButton.Name = "FreeTextAglinJustify";
- radioButton.Tag = "Justify";
- radioButton.GroupName = "Aglin";
- radioButton.Content = T_RightMenuFreetextAnnotTextAlignmentFullyJustified;
- //pop.BindingEvent(pop.AddChild("FreeTextAglin", radioButton), FreeTextAglin_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "FreeHandDefault";
- menuItem.Header = T_RightMenuAnnotDefault;
- pop.BindingEvent(pop.AddItem(menuItem), AnnotDefaultValue_MenuCommand);
- FreeTextAnnotPopMenu = pop;
- }
- /// <summary>
- /// 便签
- /// </summary>
- private void InitSelectStrickNoteAnnotMenu()
- {
- var popMenu = new ContextMenu();
- PopMenu pop = new PopMenu(popMenu);
- var menuItem = new MenuItem();
- menuItem.Name = "StrickNoteCopy";
- menuItem.Header = T_RightMenuAnnotCopy;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
- menuItem = new MenuItem();
- menuItem.Name = "StrickNoteCut";
- menuItem.Header = T_RightMenuAnnotCut;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
- menuItem = new MenuItem();
- menuItem.Name = "StrickNotePaste";
- menuItem.Header = T_RightMenuAnnotPaste;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
- menuItem = new MenuItem();
- menuItem.Name = "StrickNoteDelete";
- menuItem.Header = T_RightMenuAnnotDelete;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
- pop.AddItem(GetSeparator());
- menuItem = new MenuItem();
- menuItem.Name = "StrickNoteColor";
- menuItem.Header = T_RightMenuStickyNoteAnnotColor;
- pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "StrickNoteEdit";
- menuItem.Header = T_RightMenuStickyNoteAnnotEdit;
- pop.BindingEvent(pop.AddItem(menuItem), StrikeNoteEditStrike_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "StrickNoteDefault";
- menuItem.Header = T_RightMenuAnnotDefault;
- pop.BindingEvent(pop.AddItem(menuItem), AnnotDefaultValue_MenuCommand);
- StrickNoteAnnotPopMenu = pop;
- }
- /// <summary>
- /// 形状
- /// </summary>
- private void InitSelectShapeAnnotMenu()
- {
- var popMenu = new ContextMenu();
- PopMenu pop = new PopMenu(popMenu);
- var menuItem = new MenuItem();
- menuItem.Name = "ShapeCopy";
- menuItem.Header = T_RightMenuAnnotCopy;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
- menuItem = new MenuItem();
- menuItem.Name = "ShapeCut";
- menuItem.Header = T_RightMenuAnnotCut;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
- menuItem = new MenuItem();
- menuItem.Name = "ShapePaste";
- menuItem.Header = T_RightMenuAnnotPaste;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
- menuItem = new MenuItem();
- menuItem.Name = "ShapeDelete";
- menuItem.Header = T_RightMenuAnnotDelete;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
- pop.AddItem(GetSeparator());
- menuItem = new MenuItem();
- menuItem.Name = "ShapeColor";
- menuItem.Header = T_RightMenuSharpsNoteAnnotBorderColor;
- menuItem.Tag = "Color";
- pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "ShapeFillColor";
- menuItem.Header = T_RightMenuSharpsNoteAnnotFillColor;
- menuItem.Tag = "FillColor";
- pop.BindingEvent(pop.AddItem(menuItem), AnnotColorPalette_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "ShapeLineStyle";
- menuItem.Header = T_RightMenuSharpsNoteAnnotLineStyle;
- pop.AddItem(menuItem);
- RadioButton radioButton = new RadioButton();
- radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
- radioButton.Background = new SolidColorBrush(Colors.Transparent);
- radioButton.Name = "ShapeSolid";
- radioButton.Content = T_RightMenuSharpsNoteAnnotLineStyleSolidline;
- radioButton.GroupName = "LineStyle";
- radioButton.Tag = "Solid";
- pop.BindingEvent(pop.AddChild("ShapeLineStyle", radioButton), ShapeLineStyle_MenuCommand);
- radioButton = new RadioButton();
- radioButton.Style = App.Current.Resources["MenuRadioBtnStyle"] as Style;
- radioButton.Background = new SolidColorBrush(Colors.Transparent);
- radioButton.Name = "ShapeDash";
- radioButton.Content = T_RightMenuSharpsNoteAnnotLineStyleDottedLine;
- radioButton.GroupName = "LineStyle";
- radioButton.Tag = "Dash";
- pop.BindingEvent(pop.AddChild("ShapeLineStyle", radioButton), ShapeLineStyle_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "ShapeDirect";
- menuItem.Header = T_RightMenuSharpsNoteAnnotDirection;
- pop.AddItem(menuItem);
- menuItem = new MenuItem();
- menuItem.Name = "ShapeVer";
- menuItem.Header = T_RightMenuSharpsNoteAnnotDirectionVertical;
- menuItem.Tag = "Ver";
- pop.BindingEvent(pop.AddChild("ShapeDirect", menuItem), ShapeLineDirect_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "ShapeHor";
- menuItem.Header = T_RightMenuSharpsNoteAnnotDirectionHorizontal;
- menuItem.Tag = "Hor";
- pop.BindingEvent(pop.AddChild("ShapeDirect", menuItem), ShapeLineDirect_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "ShapeNoteText";
- menuItem.Header = T_RightMenuAnnotAddNote;
- pop.BindingEvent(pop.AddItem(menuItem), AnnotAddNoteText_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "ShapeDefault";
- menuItem.Header = T_RightMenuAnnotDefault;
- pop.BindingEvent(pop.AddItem(menuItem), AnnotDefaultValue_MenuCommand);
- ShapeAnnotPopMenu = pop;
- }
- /// <summary>
- /// 链接
- /// </summary>
- private void InitSelectLinkAnnotMenu()
- {
- var popMenu = new ContextMenu();
- PopMenu pop = new PopMenu(popMenu);
- var menuItem = new MenuItem();
- menuItem.Name = "LinkCopy";
- menuItem.Header = T_RightMenuAnnotCopy;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
- menuItem = new MenuItem();
- menuItem.Name = "LinkCut";
- menuItem.Header = T_RightMenuAnnotCut;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
- menuItem = new MenuItem();
- menuItem.Name = "LinkPaste";
- menuItem.Header = T_RightMenuAnnotPaste;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
- menuItem = new MenuItem();
- menuItem.Name = "LinkDelete";
- menuItem.Header = T_RightMenuAnnotDelete;
- //pop.BindingEvent(pop.AddItem(menuItem), Link_MenuCommand);
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
- LinkAnnotPopMenu = pop;
- }
- /// <summary>
- /// 图章、签名
- /// </summary>
- private void InitSelectStampAnnotMenu()
- {
- var popMenu = new ContextMenu();
- PopMenu pop = new PopMenu(popMenu);
- var menuItem = new MenuItem();
- menuItem.Name = "StampCopy";
- menuItem.Header = T_RightMenuAnnotCopy;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
- menuItem = new MenuItem();
- menuItem.Name = "StampCut";
- menuItem.Header = T_RightMenuAnnotCut;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
- menuItem = new MenuItem();
- menuItem.Name = "StampPaste";
- menuItem.Header = T_RightMenuAnnotPaste;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Paste);
- menuItem = new MenuItem();
- menuItem.Name = "StampDelete";
- menuItem.Header = T_RightMenuAnnotDelete;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
- pop.AddItem(GetSeparator());
- menuItem = new MenuItem();
- menuItem.Name = "StampExportPicture";
- menuItem.Header = T_RightMenuStampNoteAnnotExport;
- pop.AddItem(menuItem);
- menuItem = new MenuItem();
- menuItem.Name = "StampExportPNG";
- menuItem.Header = T_RightMenuStampNoteAnnotExportPNG;
- menuItem.Tag = "PNG";
- pop.BindingEvent(pop.AddChild("StampExportPicture", menuItem), StampExportPicture_MenuCommand);
- //已跟设计确认,暂时不需要JPG格式
- //menuItem = new MenuItem();
- //menuItem.Name = "StampExportPNG";
- //menuItem.Header = "JPG";
- //menuItem.Tag = "JPG";
- //pop.BindingEvent(pop.AddChild("StampExportPicture", menuItem), StampExportPicture_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "StampExportPDF";
- menuItem.Header = T_RightMenuStampNoteAnnotExportPDF;
- menuItem.Tag = "PDF";
- pop.BindingEvent(pop.AddChild("StampExportPicture", menuItem), StampExportPicture_MenuCommand);
- menuItem = new MenuItem();
- menuItem.Name = "StampAddNote";
- menuItem.Header = T_RightMenuAnnotAddNote;
- pop.BindingEvent(pop.AddItem(menuItem), AnnotAddNoteText_MenuCommand);
- StampAnnotPopMenu = pop;
- }
- /// <summary>
- /// 多选注释
- /// </summary>
- private void InitSelectMultiAnnotMenu()
- {
- var popMenu = new ContextMenu();
- PopMenu pop = new PopMenu(popMenu);
- var menuItem = new MenuItem();
- menuItem.Name = "MultiCopy";
- menuItem.Header = T_RightMenuAnnotCopy;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Copy);
- menuItem = new MenuItem();
- menuItem.Name = "MultiCut";
- menuItem.Header = T_RightMenuAnnotCut;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Cut);
- menuItem = new MenuItem();
- menuItem.Name = "MultiDelete";
- menuItem.Header = T_RightMenuAnnotDelete;
- pop.BindingEvent(pop.AddItem(menuItem), ApplicationCommands.Delete);
- MultiAnnotPopMenu = pop;
- }
- #endregion 注释-右键菜单
- }
- }
|