123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639 |
- using ComPDFKit.Import;
- using ComPDFKit.PDFAnnotation;
- using ComPDFKit.PDFDocument;
- using ComPDFKit.PDFPage;
- using ComPDFKitViewer;
- using ComPDFKitViewer.AnnotEvent;
- using ComPDFKitViewer.PdfViewer;
- using PDF_Master.Helper;
- using PDF_Master.Model.BOTA;
- using PDF_Master.ViewModels.BOTA;
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Forms;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using static Dropbox.Api.Files.SearchMatchTypeV2;
- namespace PDF_Master.Views.BOTA
- {
- /// <summary>
- /// AnnotationListItem.xaml 的交互逻辑
- /// </summary>
- public partial class AnnotationListItem : System.Windows.Controls.UserControl
- {
- //private Brush strikeoutColor = new SolidColorBrush(Color.FromRgb(0xFF, 0xBB, 0x00));
- public AnnotationListItem()
- {
- InitializeComponent();
- }
- private void GridIco_Loaded(object sender, RoutedEventArgs e)
- {
- if (e.Source is Grid grid)
- {
- if (grid.DataContext == null)
- {
- //var data= this.DataContext as AnnotationHandlerEventArgs;
- }
- if (grid.DataContext is AnnotationHandlerEventArgs args)
- {
- //var args = grid.DataContext as AnnotationHandlerEventArgs;
- AnnotHandlerEventArgs data = args.AnnotHandlerEventArgs;
- if (data == null)
- {
- return;
- }
- TxbMarkupContent.Text = data.MarkupContent;
- TxbContent.Text = data.Content;
- switch (data.EventType)
- {
- case AnnotArgsType.AnnotFreeText:
- if (data is FreeTextAnnotArgs freeTextAnnotArgs)
- {
- BtnAnnotFreeText.Visibility = Visibility.Visible;
- //TxbContent.Foreground = new SolidColorBrush(freeTextAnnotArgs.FontColor);
- }
- //BOTA - 注释,MVP不处理高亮 / 下划线 / 删除线的样式,只显示文字
- //文本注释、便签、链接、表格不支持添加附注
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbMarkupContent.Text = "";
- break;
- case AnnotArgsType.AnnotHighlight:
- if (data is TextHighlightAnnotArgs textHighlightAnnotArgs)
- {
- BtnHighlight.Visibility = Visibility.Visible;
- PathHighlight.Background = new SolidColorBrush(textHighlightAnnotArgs.Color);
- //PathHighlight.Opacity = textHighlightAnnotArgs.Transparency;
- //BOTA - 注释,MVP不处理高亮 / 下划线 / 删除线的样式,只显示文字
- //文本注释、便签、链接、表格不支持添加附注
- //高亮、下划线、删除线,不是文本注释
- TxbContent.Text = Regex.Replace(data.MarkupContent, "[\r\n]", " ");
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- }
- break;
- case AnnotArgsType.AnnotFreehand:
- if (data is FreehandAnnotArgs freehandAnnotArgs)
- {
- BtnFreeHand.Visibility = Visibility.Visible;
- PathFreehand.Fill = new SolidColorBrush(freehandAnnotArgs.InkColor);
- ImageContext.Visibility = Visibility.Visible;
- TxbContent.Visibility = Visibility.Collapsed;
- SetImageContext(args, freehandAnnotArgs);
- //var encoder = new PngBitmapEncoder();
- //encoder.Frames.Add(BitmapFrame.Create((BitmapSource)ImageContext.Source));
- //FileStream file = new FileStream(String.Format($@"C:\Users\oyxh\Desktop\images\PDFText\{data.AnnotIndex}.png"), FileMode.Create);
- //encoder.Save(file);
- //file.Close();
- }
- if (string.IsNullOrEmpty(data.Content) == false)
- {
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- }
- break;
- case AnnotArgsType.AnnotSquiggly://波浪线
- if (data is TextSquigglyAnnotArgs textSquigglyAnnotArgs)
- {
- AnnotSquiggly.Visibility = Visibility.Visible;
- AnnotSquigglycolor.Stroke = new SolidColorBrush(textSquigglyAnnotArgs.Color);
- }
- #region TO DO
- //TextDecoration mySquiggly = new TextDecoration();
- //Pen myPen = new Pen();
- //myPen.Brush = new SolidColorBrush((data as TextSquigglyAnnotArgs).Color);
- //myPen.Brush.Opacity = 0.8;
- //myPen.Thickness = 2;
- //myPen.DashStyle = DashStyles.Dash;
- //mySquiggly.Pen = myPen;
- //mySquiggly.PenThicknessUnit = TextDecorationUnit.FontRecommended;
- //TextDecorationCollection myCollection = new TextDecorationCollection();
- //myCollection.Add(mySquiggly);
- //TxbContext.TextDecorations = myCollection;
- #endregion TO DO
- break;
- case AnnotArgsType.AnnotStamp:
- BtnAnnotStamp.Visibility = Visibility.Visible;
- if (string.IsNullOrEmpty(data.Content) == false)
- {
- TxbContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbContent.Text = "";
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- }
- break;
- case AnnotArgsType.AnnotStrikeout://删除线
- if (data is TextStrikeoutAnnotArgs textStrikeoutAnnotArgs)
- {
- BtnAnnotStrikeout.Visibility = Visibility.Visible;
- PathStrikeoutyColor.Fill = new SolidColorBrush(textStrikeoutAnnotArgs.Color);
- //BOTA - 注释,MVP不处理高亮 / 下划线 / 删除线的样式,只显示文字
- //文本注释、便签、链接、表格不支持添加附注
- //高亮、下划线、删除线,不是文本注释
- TxbContent.Text = Regex.Replace(data.MarkupContent, "[\r\n]", " ");
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- }
- #region to do
- //TextDecoration myStrikeout = new TextDecoration();
- //Pen myPen2 = new Pen();
- //myPen2.Brush = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
- //myPen2.Brush.Opacity = 0.8;
- //myPen2.Thickness = 2;
- //myStrikeout.Pen = myPen2;
- //myStrikeout.PenOffset = -4;
- //myStrikeout.PenThicknessUnit = TextDecorationUnit.FontRecommended;
- //TextDecorationCollection myCollection2 = new TextDecorationCollection();
- //myCollection2.Add(myStrikeout);
- ////因为波浪线无法实现 暂时只显示文字 不显示下划线,删除线等
- //TxbMarkupContent.TextDecorations = myCollection2;
- #endregion to do
- break;
- case AnnotArgsType.AnnotSticky://便签
- if (data is StickyAnnotArgs stickyAnnotArgs)
- {
- BtnAnnotSticky.Visibility = Visibility;
- PathSticky.Fill = new SolidColorBrush(stickyAnnotArgs.Color);
- }
- //BOTA - 注释,MVP不处理高亮 / 下划线 / 删除线的样式,只显示文字
- //文本注释、便签、链接、表格不支持添加附注
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbMarkupContent.Text = "";
- break;
- case AnnotArgsType.AnnotUnderline:
- if (data is TextUnderlineAnnotArgs textUnderlineAnnotArgs)
- {
- BtnUnderLine.Visibility = Visibility.Visible;
- RectangleUnderline.Fill = new SolidColorBrush(textUnderlineAnnotArgs.Color);
- }
- //BOTA - 注释,MVP不处理高亮 / 下划线 / 删除线的样式,只显示文字
- //文本注释、便签、链接、表格不支持添加附注
- //高亮、下划线、删除线,不是文本注释
- TxbContent.Text = Regex.Replace(data.MarkupContent, "[\r\n]", " ");
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- //TxbMarkupContent.Text = "";
- #region TO DO
- //TextDecoration myUnderline = new TextDecoration();
- //Pen myPen1 = new Pen();
- //myPen1.Brush = new SolidColorBrush((data as TextUnderlineAnnotArgs).Color);
- //myPen1.Brush.Opacity = 0.8;
- //myPen1.Thickness = 2;
- //myUnderline.Pen = myPen1;
- //myUnderline.PenThicknessUnit = TextDecorationUnit.FontRecommended;
- //TextDecorationCollection myCollection1 = new TextDecorationCollection();
- //myCollection1.Add(myUnderline);
- //TxbMarkupContent.TextDecorations = myCollection1;
- #endregion TO DO
- break;
- case AnnotArgsType.AnnotLine:
- if (data is LineAnnotArgs lineAnnotArgs)
- {
- if (lineAnnotArgs.HeadLineType >= (C_LINE_TYPE)1 || lineAnnotArgs.TailLineType >= (C_LINE_TYPE)1)
- {
- BtnSharpArrow.Visibility = Visibility.Visible;
- PathArrow.Fill = new SolidColorBrush(lineAnnotArgs.LineColor);
- }
- else
- {
- PathSharpLine.Fill = new SolidColorBrush(lineAnnotArgs.LineColor);
- BtnSharpLine.Visibility = Visibility.Visible;
- }
- ///对于形状注释等只有Note 的处理
- if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
- {
- TxbContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbContent.Text = "";
- }
- if (string.IsNullOrEmpty(data.Content) == false)
- {
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- }
- }
- break;
- case AnnotArgsType.AnnotSquare:
- if (data is SquareAnnotArgs squareAnnotArgs)
- {
- BtnAnnotSquare.Visibility = Visibility.Visible;
- RectAnnotSquare.Stroke = new SolidColorBrush(squareAnnotArgs.LineColor);
- RectAnnotSquare.Fill = new SolidColorBrush(squareAnnotArgs.BgColor);
- ///对于形状注释等只有Note 的处理
- if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
- {
- TxbContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbContent.Text = "";
- }
- }
- if (string.IsNullOrEmpty(data.Content) == false)
- {
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- }
- break;
- case AnnotArgsType.AnnotCircle:
- if (data is CircleAnnotArgs circleAnnotArgs)
- {
- BtnAnnotCircle.Visibility = Visibility.Visible;
- EllipseCircle.Stroke = new SolidColorBrush(circleAnnotArgs.LineColor);
- EllipseCircle.Fill = new SolidColorBrush(circleAnnotArgs.BgColor);
- ///对于形状注释等只有Note 的处理
- if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
- {
- TxbContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbContent.Text = "";
- }
- }
- if (string.IsNullOrEmpty(data.Content) == false)
- {
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- }
- break;
- case AnnotArgsType.AnnotLink:
- BtnAnnotLink.Visibility = Visibility.Visible;
- if (data is LinkAnnotArgs linkAnnotArgs)
- {
- if (string.IsNullOrEmpty(linkAnnotArgs.Content))
- {
- if (linkAnnotArgs.DestIndex != -1)
- {
- TxbContent.Text = string.Format($"To Page {linkAnnotArgs.DestIndex + 1}");
- }
- else
- {
- TxbContent.Text = string.Format($"{linkAnnotArgs.URI}");
- }
- }
- }
- break;
- default:
- break;
- }
- }
- }
- }
- private void SetImageContext(AnnotationHandlerEventArgs args, FreehandAnnotArgs freehandAnnotArgs)
- {
- if (args == null && freehandAnnotArgs == null)
- {
- return;
- }
- if (args.WriteableBitmap == null)
- {
- return;
- }
- double width = args.WriteableBitmap.Width;
- double height = args.WriteableBitmap.Height;
- CPDFDocument doc = args.Document;
- if (doc != null)
- {
- CPDFPage docPage = doc.PageAtIndex(args.PageIndex, false);
- if (docPage != null)
- {
- double maxWidth = docPage.PageSize.Width;
- double maxHeight = docPage.PageSize.Height;
- ImageContext.MaxHeight = maxHeight;
- if (width > 168)
- {
- ImageContext.Stretch = Stretch.Uniform;
- }
- else
- {
- if (height >= maxHeight / 2)
- {
- //ImageContext.MaxHeight = 900;
- ImageContext.Stretch = Stretch.None;
- }
- if (height < maxHeight / 2)
- {
- if (height <= 20)
- {
- ImageContext.MinHeight = height;
- ImageContext.Height = 30;
- }
- ImageContext.Stretch = Stretch.None;
- }
- //else
- //{
- // ImageContext.Stretch = Stretch.Uniform;
- //}
- }
- }
- }
- }
- private void GridIco_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
- {
- if (e.NewValue is AnnotationHandlerEventArgs args)
- {
- //var args = grid.DataContext as AnnotationHandlerEventArgs;
- AnnotHandlerEventArgs data = args.AnnotHandlerEventArgs;
- if (data == null)
- {
- return;
- }
- TxbMarkupContent.Text = data.MarkupContent;
- TxbContent.Text = data.Content;
- switch (data.EventType)
- {
- case AnnotArgsType.AnnotFreeText:
- if (data is FreeTextAnnotArgs freeTextAnnotArgs)
- {
- BtnAnnotFreeText.Visibility = Visibility.Visible;
- //TxbContent.Foreground = new SolidColorBrush(freeTextAnnotArgs.FontColor);
- }
- //文本注释、便签、链接、表格不支持添加附注
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbMarkupContent.Text = "";
- break;
- case AnnotArgsType.AnnotHighlight:
- if (data is TextHighlightAnnotArgs textHighlightAnnotArgs)
- {
- BtnHighlight.Visibility = Visibility.Visible;
- PathHighlight.Background = new SolidColorBrush(textHighlightAnnotArgs.Color);
- //PathHighlight.Opacity = textHighlightAnnotArgs.Transparency;
- //文本注释、便签、链接、表格不支持添加附注
- //高亮、下划线、删除线,不是文本注释
- TxbContent.Text = Regex.Replace(data.MarkupContent, "[\r\n]", " ");
- TxbMarkupContent.Text = data.Content;
- }
- break;
- case AnnotArgsType.AnnotFreehand:
- if (data is FreehandAnnotArgs freehandAnnotArgs)
- {
- BtnFreeHand.Visibility = Visibility.Visible;
- PathFreehand.Fill = new SolidColorBrush(freehandAnnotArgs.InkColor);
- ImageContext.Visibility = Visibility.Visible;
- TxbContent.Visibility = Visibility.Collapsed;
- SetImageContext(args, freehandAnnotArgs);
- //var encoder = new PngBitmapEncoder();
- //encoder.Frames.Add(BitmapFrame.Create((BitmapSource)ImageContext.Source));
- //FileStream file = new FileStream(String.Format($@"C:\Users\oyxh\Desktop\images\PDFText\{data.AnnotIndex}.png"), FileMode.Create);
- //encoder.Save(file);
- //file.Close();
- }
- if (string.IsNullOrEmpty(data.Content) == false)
- {
- TxbMarkupContent.Text = data.Content;
- }
- break;
- case AnnotArgsType.AnnotSquiggly://波浪线
- if (data is TextSquigglyAnnotArgs textSquigglyAnnotArgs)
- {
- AnnotSquiggly.Visibility = Visibility.Visible;
- AnnotSquigglycolor.Stroke = new SolidColorBrush(textSquigglyAnnotArgs.Color);
- }
- #region TO DO
- //TextDecoration mySquiggly = new TextDecoration();
- //Pen myPen = new Pen();
- //myPen.Brush = new SolidColorBrush((data as TextSquigglyAnnotArgs).Color);
- //myPen.Brush.Opacity = 0.8;
- //myPen.Thickness = 2;
- //myPen.DashStyle = DashStyles.Dash;
- //mySquiggly.Pen = myPen;
- //mySquiggly.PenThicknessUnit = TextDecorationUnit.FontRecommended;
- //TextDecorationCollection myCollection = new TextDecorationCollection();
- //myCollection.Add(mySquiggly);
- //TxbContext.TextDecorations = myCollection;
- #endregion TO DO
- break;
- case AnnotArgsType.AnnotStamp:
- BtnAnnotStamp.Visibility = Visibility.Visible;
- if (string.IsNullOrEmpty(data.Content) == false)
- {
- TxbContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbContent.Text = "";
- TxbMarkupContent.Text = data.Content;
- }
- break;
- case AnnotArgsType.AnnotStrikeout://删除线
- if (data is TextStrikeoutAnnotArgs textStrikeoutAnnotArgs)
- {
- BtnAnnotStrikeout.Visibility = Visibility.Visible;
- PathStrikeoutyColor.Fill = new SolidColorBrush(textStrikeoutAnnotArgs.Color);
- //文本注释、便签、链接、表格不支持添加附注
- //高亮、下划线、删除线,不是文本注释
- TxbContent.Text = Regex.Replace(data.MarkupContent, "[\r\n]", " ");
- TxbMarkupContent.Text = data.Content;
- }
- #region to do
- //TextDecoration myStrikeout = new TextDecoration();
- //Pen myPen2 = new Pen();
- //myPen2.Brush = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
- //myPen2.Brush.Opacity = 0.8;
- //myPen2.Thickness = 2;
- //myStrikeout.Pen = myPen2;
- //myStrikeout.PenOffset = -4;
- //myStrikeout.PenThicknessUnit = TextDecorationUnit.FontRecommended;
- //TextDecorationCollection myCollection2 = new TextDecorationCollection();
- //myCollection2.Add(myStrikeout);
- ////因为波浪线无法实现 暂时只显示文字 不显示下划线,删除线等
- //TxbMarkupContent.TextDecorations = myCollection2;
- #endregion to do
- break;
- case AnnotArgsType.AnnotSticky://便签
- if (data is StickyAnnotArgs stickyAnnotArgs)
- {
- BtnAnnotSticky.Visibility = Visibility;
- PathSticky.Fill = new SolidColorBrush(stickyAnnotArgs.Color);
- }
- //BOTA - 注释,MVP不处理高亮 / 下划线 / 删除线的样式,只显示文字
- //文本注释、便签、链接、表格不支持添加附注
- TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbMarkupContent.Text = "";
- break;
- case AnnotArgsType.AnnotUnderline:
- if (data is TextUnderlineAnnotArgs textUnderlineAnnotArgs)
- {
- BtnUnderLine.Visibility = Visibility.Visible;
- RectangleUnderline.Fill = new SolidColorBrush(textUnderlineAnnotArgs.Color);
- }
- //文本注释、便签、链接、表格不支持添加附注
- //高亮、下划线、删除线,不是文本注释
- TxbContent.Text = Regex.Replace(data.MarkupContent, "[\r\n]", " ");
- TxbMarkupContent.Text = data.Content;
- //TxbMarkupContent.Text = "";
- #region TO DO
- //TextDecoration myUnderline = new TextDecoration();
- //Pen myPen1 = new Pen();
- //myPen1.Brush = new SolidColorBrush((data as TextUnderlineAnnotArgs).Color);
- //myPen1.Brush.Opacity = 0.8;
- //myPen1.Thickness = 2;
- //myUnderline.Pen = myPen1;
- //myUnderline.PenThicknessUnit = TextDecorationUnit.FontRecommended;
- //TextDecorationCollection myCollection1 = new TextDecorationCollection();
- //myCollection1.Add(myUnderline);
- //TxbMarkupContent.TextDecorations = myCollection1;
- #endregion TO DO
- break;
- case AnnotArgsType.AnnotLine:
- if (data is LineAnnotArgs lineAnnotArgs)
- {
- if (lineAnnotArgs.HeadLineType >= (C_LINE_TYPE)1 || lineAnnotArgs.TailLineType >= (C_LINE_TYPE)1)
- {
- BtnSharpArrow.Visibility = Visibility.Visible;
- PathArrow.Fill = new SolidColorBrush(lineAnnotArgs.LineColor);
- }
- else
- {
- PathSharpLine.Fill = new SolidColorBrush(lineAnnotArgs.LineColor);
- BtnSharpLine.Visibility = Visibility.Visible;
- }
- ///对于形状注释等只有Note 的处理
- if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
- {
- TxbContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbContent.Text = "";
- }
- if (string.IsNullOrEmpty(data.Content) == false)
- {
- TxbMarkupContent.Text = data.Content;
- }
- }
- break;
- case AnnotArgsType.AnnotSquare:
- if (data is SquareAnnotArgs squareAnnotArgs)
- {
- BtnAnnotSquare.Visibility = Visibility.Visible;
- RectAnnotSquare.Stroke = new SolidColorBrush(squareAnnotArgs.LineColor);
- RectAnnotSquare.Fill = new SolidColorBrush(squareAnnotArgs.BgColor);
- ///对于形状注释等只有Note 的处理
- if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
- {
- TxbContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbContent.Text = "";
- }
- }
- if (string.IsNullOrEmpty(data.Content) == false)
- {
- TxbMarkupContent.Text = data.Content;
- }
- break;
- case AnnotArgsType.AnnotCircle:
- if (data is CircleAnnotArgs circleAnnotArgs)
- {
- BtnAnnotCircle.Visibility = Visibility.Visible;
- EllipseCircle.Stroke = new SolidColorBrush(circleAnnotArgs.LineColor);
- EllipseCircle.Fill = new SolidColorBrush(circleAnnotArgs.BgColor);
- ///对于形状注释等只有Note 的处理
- if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
- {
- TxbContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
- TxbContent.Text = "";
- }
- }
- if (string.IsNullOrEmpty(data.Content) == false)
- {
- TxbMarkupContent.Text = data.Content;
- }
- break;
- case AnnotArgsType.AnnotLink:
- BtnAnnotLink.Visibility = Visibility.Visible;
- if (data is LinkAnnotArgs linkAnnotArgs)
- {
- if (string.IsNullOrEmpty(linkAnnotArgs.Content))
- {
- if (linkAnnotArgs.DestIndex != -1)
- {
- TxbContent.Text = string.Format($"To Page {linkAnnotArgs.DestIndex + 1}");
- }
- else
- {
- TxbContent.Text = string.Format($"{linkAnnotArgs.URI}");
- }
- }
- }
- break;
- default:
- break;
- }
- }
- }
- }
- }
|