Browse Source

Merge branch 'dev' of http://git.kdan.cc:8865/Windows/PDFOffice_Windows_exe into dev

ZhouJieSheng 1 year ago
parent
commit
ecc7f9ee3b

+ 25 - 13
PDF Office/Model/Dialog/ToolsDialogs/CompressDialogModel/CompressDialogModel.cs

@@ -16,7 +16,9 @@ namespace PDF_Master.Model.Dialog.ToolsDialogs
     public class CompressDialogModel
     {
         CPDFDocument tempDocument = null;
-        IntPtr compressingIntpr = IntPtr.Zero;
+        private IntPtr compressingIntpr = IntPtr.Zero;
+        //委托函数为全局变量
+        private CPDFDocument.GetPageIndexDelegate indexDelegate = null;
         public enum EnumQualityLevel
         {
             StatusLarge = 100,
@@ -32,15 +34,23 @@ namespace PDF_Master.Model.Dialog.ToolsDialogs
 
         public void CompressClear()
         {
-            tempDocument.CompressFile_Cancel(compressingIntpr);
+            if (!compressingIntpr.Equals(IntPtr.Zero))
+            {
+                tempDocument.CompressFile_Cancel(compressingIntpr);
+            }
+
             App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed;
         }
         private int GetIndex(int pageindex)
         {
-            App.mainWindowViewModel.Value = (pageindex + 1);
+            try
+            {
+                App.mainWindowViewModel.Value = (pageindex + 1);
 
-            if (App.mainWindowViewModel.Value == App.mainWindowViewModel.MaxValue) { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
-            return 0;
+                if (App.mainWindowViewModel.Value == App.mainWindowViewModel.MaxValue) { App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Collapsed; }
+                return 0;
+            }
+            catch { Trace.WriteLine("g了嘛");  return -1; }
         }
 
         public async void OnOpened(Prism.Services.Dialogs.DialogResult e)
@@ -51,8 +61,7 @@ namespace PDF_Master.Model.Dialog.ToolsDialogs
             {
                 if (e.Result == Prism.Services.Dialogs.ButtonResult.Cancel || e.Result == Prism.Services.Dialogs.ButtonResult.None) { return; }
                 CPDFDocument doc = null;
-                CPDFDocument.GetPageIndexDelegate indexDelegate = null;
-                
+                compressingIntpr = IntPtr.Zero;
                 int compressquality = 45;
                 doc = e.Parameters.GetValue<CPDFDocument>(ParameterNames.PDFDocument);
                 filepath = e.Parameters.GetValue<string>(ParameterNames.FilePath);
@@ -67,7 +76,7 @@ namespace PDF_Master.Model.Dialog.ToolsDialogs
                 compressquality = e.Parameters.GetValue<int>("compressDialogModel.CompressQuality");
                 if (doc != null)
                 {
-                    
+
                     App.mainWindowViewModel.Value = 0;
                     App.mainWindowViewModel.ProgressTitle = "Compressing";
                     App.mainWindowViewModel.IsProcessVisible = System.Windows.Visibility.Visible;
@@ -75,19 +84,22 @@ namespace PDF_Master.Model.Dialog.ToolsDialogs
                     CPDFDocument document = CPDFDocument.InitWithFilePath(doc.FilePath);
                     document.UnlockWithPassword(password);
                     indexDelegate += GetIndex;
-                    compressingIntpr = document.CompressFile_Init(compressquality, indexDelegate);
+                    compressingIntpr = document.CompressFile_Init((float)compressquality, indexDelegate);
                     GC.KeepAlive(indexDelegate);//关键  防止委托过早回收
                     tempDocument = document;
                     Trace.WriteLine("compressDialogModel.CompressQuality" + compressquality);
                     App.mainWindowViewModel.ProcessCloseAction = CompressClear;
-                    if (await Task.Run<bool>(() => { return document.CompressFile_Start(compressingIntpr, filepath); })) {
-                        CommonHelper.ShowFileBrowser(filepath); 
+                    Trace.WriteLine("怎么啦");
+                    if (await Task.Run<bool>(() => { return document.CompressFile_Start(compressingIntpr, filepath); }))
+                    {
+                        CommonHelper.ShowFileBrowser(filepath);
                     }
-
+                    Trace.WriteLine("零零零零怎么");
                     document.Release();
                 }
             }
-            catch {
+            catch
+            {
                 AlertsMessage alertsMessage = new AlertsMessage();
                 alertsMessage.ShowDialog("", "Compress file error", App.ServiceLoader.GetString("Text_ok"));
                 tempDocument.CompressFile_Cancel(compressingIntpr);

+ 169 - 55
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -1098,45 +1098,75 @@ namespace PDF_Master.ViewModels.Tools
                 var annot = menu.Parameter as AnnotHandlerEventArgs;
                 if (annot != null)
                 {
-                    if (annot is TextHighlightAnnotArgs)
+                    if (annot is TextHighlightAnnotArgs textHighlight)
                     {
-                        var color = (annot as TextHighlightAnnotArgs).Color;
+                        var color = textHighlight.Color;
                         HighLightColor = new SolidColorBrush(color);
 
                         Settings.Default.AppProperties.Annotate.HighLightColor = color;
 
                         var hightlight = GetAnnotDefault(AnnotArgsType.AnnotHighlight);
                         hightlight.ForgoundColor = color;
-                        hightlight.Opacity = (annot as TextHighlightAnnotArgs).Transparency;
+                        hightlight.Opacity = textHighlight.Transparency;
                         SettingHelper.SetAnnotDefaultProperty(hightlight);
+
+                        if (StrAnnotToolChecked == "HighLight")
+                        {
+                            TextHighlightAnnotArgs annotArgs = new TextHighlightAnnotArgs()
+                            {
+                                Color = textHighlight.Color,
+                                Transparency = textHighlight.Transparency
+                            };
+                            PDFViewer.SetToolParam(annotArgs);
+                        }
                     }
-                    else if (annot is TextUnderlineAnnotArgs)
+                    else if (annot is TextUnderlineAnnotArgs textUnderline)
                     {
-                        var color = (annot as TextUnderlineAnnotArgs).Color;
+                        var color = textUnderline.Color;
                         UnderLineColor = new SolidColorBrush(color);
 
                         Settings.Default.AppProperties.Annotate.UnderLineColor = color;
 
                         var Underline = GetAnnotDefault(AnnotArgsType.AnnotUnderline);
                         Underline.ForgoundColor = color;
-                        Underline.Opacity = (annot as TextUnderlineAnnotArgs).Transparency;
+                        Underline.Opacity = textUnderline.Transparency;
                         SettingHelper.SetAnnotDefaultProperty(Underline);
+
+                        if (StrAnnotToolChecked == "UnderLine")
+                        {
+                            TextUnderlineAnnotArgs annotArgs = new TextUnderlineAnnotArgs()
+                            {
+                                Color = textUnderline.Color,
+                                Transparency = textUnderline.Transparency
+                            };
+                            PDFViewer.SetToolParam(annotArgs);
+                        }
                     }
-                    else if (annot is TextStrikeoutAnnotArgs)
+                    else if (annot is TextStrikeoutAnnotArgs textStrikeout)
                     {
-                        var color = (annot as TextStrikeoutAnnotArgs).Color;
+                        var color = textStrikeout.Color;
                         StrikeoutColor = new SolidColorBrush(color);
 
                         Settings.Default.AppProperties.Annotate.StrikethroughColor = color;
 
                         var Strikeout = GetAnnotDefault(AnnotArgsType.AnnotStrikeout);
                         Strikeout.ForgoundColor = color;
-                        Strikeout.Opacity = (annot as TextStrikeoutAnnotArgs).Transparency;
-                        SettingHelper.SetAnnotDefaultProperty(Strikeout);
+                        Strikeout.Opacity = textStrikeout.Transparency;
+                        SettingHelper.SetAnnotDefaultProperty(Strikeout);
+
+                        if (StrAnnotToolChecked == "Strikeout")
+                        {
+                            TextStrikeoutAnnotArgs annotArgs = new TextStrikeoutAnnotArgs()
+                            {
+                                Color = textStrikeout.Color,
+                                Transparency = textStrikeout.Transparency
+                            };
+                            PDFViewer.SetToolParam(annotArgs);
+                        }
                     }
-                    else if (annot is FreehandAnnotArgs)
+                    else if (annot is FreehandAnnotArgs freeHand)
                     {
-                        var freeHand = annot as FreehandAnnotArgs;
+                        //var freeHand = annot as FreehandAnnotArgs;
                         var color = freeHand.InkColor;
 
                         Settings.Default.AppProperties.Annotate.FreeHandColor = color;
@@ -1162,15 +1192,18 @@ namespace PDF_Master.ViewModels.Tools
 
                         SettingHelper.SetAnnotDefaultProperty(FreehandDefault);
 
-                        FreehandAnnotArgs annotArgs = new FreehandAnnotArgs()
-                        {
-                            InkColor = freeHand.InkColor,
-                            Transparency = freeHand.Transparency,
-                            LineWidth = freeHand.LineWidth,
-                            LineDash = freeHand.LineDash
-                        };
-
-                        PDFViewer.SetToolParam(annotArgs);
+                        if (StrAnnotToolChecked == "Freehand")
+                        {
+                            FreehandAnnotArgs annotArgs = new FreehandAnnotArgs()
+                            {
+                                InkColor = freeHand.InkColor,
+                                Transparency = freeHand.Transparency,
+                                LineWidth = freeHand.LineWidth,
+                                LineDash = freeHand.LineDash
+                            };
+
+                            PDFViewer.SetToolParam(annotArgs);
+                        }
                     }
                     else if (annot is FreeTextAnnotArgs freeText)
                     {
@@ -1189,44 +1222,58 @@ namespace PDF_Master.ViewModels.Tools
                         FreeTextDefalut.BackgroundColor = freeText.BgColor;
                         FreeTextDefalut.Opacity = (annot as FreeTextAnnotArgs).Transparency;
                         SettingHelper.SetAnnotDefaultProperty(FreeTextDefalut);
-                        //FreeTextAnnotArgs freeTextAnnotArgs = new FreeTextAnnotArgs()
-                        //{
-                        //    FontColor = freeText.FontColor,
-                        //    FontFamily = freeText.FontFamily,
-                        //    Align = freeText.Align,
-                        //    FontSize = freeText.FontSize,
-                        //    FontWeight = freeText.FontWeight,
-                        //    FontStyle = freeText.FontStyle,
-                        //    BgColor = freeText.BgColor,
-                        //    Transparency = (annot as FreeTextAnnotArgs).Transparency
-                        //};
-
-                        //PDFViewer.SetToolParam(freeTextAnnotArgs);
+
+                        if (StrAnnotToolChecked == "Freetext")
+                        {
+                            FreeTextAnnotArgs freeTextAnnotArgs = new FreeTextAnnotArgs()
+                            {
+                                FontColor = freeText.FontColor,
+                                FontFamily = freeText.FontFamily,
+                                Align = freeText.Align,
+                                FontSize = freeText.FontSize,
+                                FontWeight = freeText.FontWeight,
+                                FontStyle = freeText.FontStyle,
+                                BgColor = freeText.BgColor,
+                                Transparency = (annot as FreeTextAnnotArgs).Transparency
+                            };
+
+                            PDFViewer.SetToolParam(freeTextAnnotArgs);
+                        }
                     }
-                    else if (annot is StickyAnnotArgs)
+                    else if (annot is StickyAnnotArgs stickyAnnotArgs)
                     {
-                        var color = (annot as StickyAnnotArgs).Color;
+                        var color = stickyAnnotArgs.Color;
                         Settings.Default.AppProperties.Annotate.NoteAnnoteColor = color;
                         var StickyDefalut = GetAnnotDefault(AnnotArgsType.AnnotSticky);
                         StickyDefalut.ForgoundColor = color;
 
                         SettingHelper.SetAnnotDefaultProperty(StickyDefalut);
+
+                        if (StrAnnotToolChecked == "StickyNote")
+                        {
+                            StickyAnnotArgs annotArgs = new StickyAnnotArgs()
+                            {
+                                Color = stickyAnnotArgs.Color
+                            };
+
+                            PDFViewer.SetToolParam(annotArgs);
+                        }
                     }
-                    else if (annot is SquareAnnotArgs)
+                    else if (annot is SquareAnnotArgs squareAnnot)
                     {
-                        var square = annot as SquareAnnotArgs;
-                        var bgColor = square.BgColor;
+                        //var square = annot as SquareAnnotArgs;
+                        var bgColor = squareAnnot.BgColor;
                         Settings.Default.AppProperties.Annotate.RectangleFillColor = bgColor;
-                        var borderColor = square.LineColor;
+                        var borderColor = squareAnnot.LineColor;
                         Settings.Default.AppProperties.Annotate.RectangleBorderColor = borderColor;
 
                         var SquareDefalut = GetAnnotDefault(AnnotArgsType.AnnotSquare);
                         SquareDefalut.BorderColor = borderColor;
                         SquareDefalut.BackgroundColor = bgColor;
-                        SquareDefalut.Opacity = square.Transparency;
-                        SquareDefalut.Thickness = square.LineWidth;
+                        SquareDefalut.Opacity = squareAnnot.Transparency;
+                        SquareDefalut.Thickness = squareAnnot.LineWidth;
 
-                        var isSolid = AnnotTransfer.IsSolidStyle(square.LineDash);
+                        var isSolid = AnnotTransfer.IsSolidStyle(squareAnnot.LineDash);
                         if (isSolid)
                         {
                             SquareDefalut.DashArray = null;
@@ -1234,29 +1281,42 @@ namespace PDF_Master.ViewModels.Tools
                         else
                         {
                             SquareDefalut.DashArray = new List<double>();
-                            foreach (var item in square.LineDash.Dashes)
+                            foreach (var item in squareAnnot.LineDash.Dashes)
                             {
                                 SquareDefalut.DashArray.Add(item);
                             }
                         }
 
                         SettingHelper.SetAnnotDefaultProperty(SquareDefalut);
+
+                        if (PropertyPanel.SharpsAnnot == "Rect" && StrAnnotToolChecked == "Rect")
+                        {
+                            SquareAnnotArgs annotArgs = new SquareAnnotArgs()
+                            {
+                                BgColor = squareAnnot.BgColor,
+                                LineColor = squareAnnot.LineColor,
+                                Transparency = squareAnnot.Transparency,
+                                LineWidth = squareAnnot.LineWidth,
+                                LineDash = squareAnnot.LineDash
+                            };
+                            PDFViewer.SetToolParam(annotArgs);
+                        }
                     }
-                    else if (annot is CircleAnnotArgs)
+                    else if (annot is CircleAnnotArgs circleAnnot)
                     {
-                        var circle = annot as CircleAnnotArgs;
-                        var bgColor = circle.BgColor;
+                        //var circle = annot as CircleAnnotArgs;
+                        var bgColor = circleAnnot.BgColor;
                         Settings.Default.AppProperties.Annotate.CircleFillColor = bgColor;
-                        var borderColor = circle.LineColor;
+                        var borderColor = circleAnnot.LineColor;
                         Settings.Default.AppProperties.Annotate.CircleBorderColor = borderColor;
 
                         var CircleDefalut = GetAnnotDefault(AnnotArgsType.AnnotCircle);
                         CircleDefalut.BorderColor = borderColor;
                         CircleDefalut.BackgroundColor = bgColor;
-                        CircleDefalut.Opacity = circle.Transparency;
-                        CircleDefalut.Thickness = circle.LineWidth;
+                        CircleDefalut.Opacity = circleAnnot.Transparency;
+                        CircleDefalut.Thickness = circleAnnot.LineWidth;
 
-                        var isSolid = AnnotTransfer.IsSolidStyle(circle.LineDash);
+                        var isSolid = AnnotTransfer.IsSolidStyle(circleAnnot.LineDash);
                         if (isSolid)
                         {
                             CircleDefalut.DashArray = null;
@@ -1264,13 +1324,26 @@ namespace PDF_Master.ViewModels.Tools
                         else
                         {
                             CircleDefalut.DashArray = new List<double>();
-                            foreach (var item in circle.LineDash.Dashes)
+                            foreach (var item in circleAnnot.LineDash.Dashes)
                             {
                                 CircleDefalut.DashArray.Add(item);
                             }
                         }
 
-                        SettingHelper.SetAnnotDefaultProperty(CircleDefalut);
+                        SettingHelper.SetAnnotDefaultProperty(CircleDefalut);
+
+                        if (PropertyPanel.SharpsAnnot == "Circle" && StrAnnotToolChecked == "Rect")
+                        {
+                            CircleAnnotArgs annotArgs = new CircleAnnotArgs()
+                            {
+                                BgColor = circleAnnot.BgColor,
+                                LineColor = circleAnnot.LineColor,
+                                Transparency = circleAnnot.Transparency,
+                                LineWidth = circleAnnot.LineWidth,
+                                LineDash = circleAnnot.LineDash
+                            };
+                            PDFViewer.SetToolParam(annotArgs);
+                        }
                     }
                     else if (annot is LineAnnotArgs lineAnnotArgs)
                     {
@@ -1281,11 +1354,38 @@ namespace PDF_Master.ViewModels.Tools
                         {
                             Settings.Default.AppProperties.Annotate.ArrowColor = color;
                             lineDefalut.HeadLineType = lineAnnotArgs.HeadLineType;
-                            lineDefalut.TailLineType = lineAnnotArgs.TailLineType;
+                            lineDefalut.TailLineType = lineAnnotArgs.TailLineType;
+
+                            if (PropertyPanel.SharpsAnnot == "Arrow" && StrAnnotToolChecked == "Rect")
+                            {
+                                LineAnnotArgs annotArgs = new LineAnnotArgs()
+                                {
+                                    LineColor = lineAnnotArgs.LineColor,
+                                    Transparency = lineAnnotArgs.Transparency,
+                                    LineWidth = lineAnnotArgs.LineWidth,
+                                    LineDash = lineAnnotArgs.LineDash,
+                                    HeadLineType = lineAnnotArgs.HeadLineType,
+                                    TailLineType = lineAnnotArgs.TailLineType
+                                };
+                                PDFViewer.SetToolParam(annotArgs);
+                            }
                         }
                         else
                         {
-                            Settings.Default.AppProperties.Annotate.LineColor = color;
+                            Settings.Default.AppProperties.Annotate.LineColor = color;
+                            if (PropertyPanel.SharpsAnnot == "Line" && StrAnnotToolChecked == "Rect")
+                            {
+                                LineAnnotArgs annotArgs = new LineAnnotArgs()
+                                {
+                                    LineColor = lineAnnotArgs.LineColor,
+                                    Transparency = lineAnnotArgs.Transparency,
+                                    LineWidth = lineAnnotArgs.LineWidth,
+                                    LineDash = lineAnnotArgs.LineDash,
+                                    HeadLineType = lineAnnotArgs.HeadLineType,
+                                    TailLineType = lineAnnotArgs.TailLineType
+                                };
+                                PDFViewer.SetToolParam(annotArgs);
+                            }
                         }
 
                         lineDefalut.BorderColor = color;
@@ -1307,6 +1407,20 @@ namespace PDF_Master.ViewModels.Tools
                         }
 
                         SettingHelper.SetAnnotDefaultProperty(lineDefalut);
+
+                        //if ((PropertyPanel.SharpsAnnot == "Arrow" || PropertyPanel.SharpsAnnot == "Line") && StrAnnotToolChecked == "Rect")
+                        //{
+                        //    LineAnnotArgs annotArgs = new LineAnnotArgs()
+                        //    {
+                        //        LineColor = lineAnnotArgs.LineColor,
+                        //        Transparency = lineAnnotArgs.Transparency,
+                        //        LineWidth = lineAnnotArgs.LineWidth,
+                        //        LineDash = lineAnnotArgs.LineDash,
+                        //        HeadLineType = lineAnnotArgs.HeadLineType,
+                        //        TailLineType = lineAnnotArgs.TailLineType
+                        //    };
+                        //    PDFViewer.SetToolParam(annotArgs);
+                        //}
                     }
 
                     Settings.Default.Save();

+ 8 - 12
PDF Office/Views/BOTA/AnnotationListItem.xaml.cs

@@ -391,7 +391,6 @@ namespace PDF_Master.Views.BOTA
                             BtnAnnotFreeText.Visibility = Visibility.Visible;
                             //TxbContent.Foreground = new SolidColorBrush(freeTextAnnotArgs.FontColor);
                         }
-                        //BOTA - 注释,MVP不处理高亮 / 下划线 / 删除线的样式,只显示文字
                         //文本注释、便签、链接、表格不支持添加附注
                         TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
                         TxbMarkupContent.Text = "";
@@ -403,11 +402,10 @@ namespace PDF_Master.Views.BOTA
                             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]", " ");
+                            TxbMarkupContent.Text = data.Content;
                         }
 
                         break;
@@ -431,7 +429,7 @@ namespace PDF_Master.Views.BOTA
                         }
                         if (string.IsNullOrEmpty(data.Content) == false)
                         {
-                            TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
+                            TxbMarkupContent.Text = data.Content;
                         }
 
                         break;
@@ -468,7 +466,7 @@ namespace PDF_Master.Views.BOTA
                         {
                             TxbContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
                             TxbContent.Text = "";
-                            TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
+                            TxbMarkupContent.Text = data.Content;
                         }
                         break;
 
@@ -478,12 +476,11 @@ namespace PDF_Master.Views.BOTA
                             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]", " ");
+                            TxbMarkupContent.Text = data.Content;
                         }
 
                         #region to do
@@ -525,12 +522,11 @@ namespace PDF_Master.Views.BOTA
                             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 = data.Content;
                         //TxbMarkupContent.Text = "";
 
                         #region TO DO
@@ -571,7 +567,7 @@ namespace PDF_Master.Views.BOTA
                             }
                             if (string.IsNullOrEmpty(data.Content) == false)
                             {
-                                TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
+                                TxbMarkupContent.Text = data.Content;
                             }
                         }
 
@@ -592,7 +588,7 @@ namespace PDF_Master.Views.BOTA
                         }
                         if (string.IsNullOrEmpty(data.Content) == false)
                         {
-                            TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
+                            TxbMarkupContent.Text = data.Content;
                         }
                         break;
 
@@ -611,7 +607,7 @@ namespace PDF_Master.Views.BOTA
                         }
                         if (string.IsNullOrEmpty(data.Content) == false)
                         {
-                            TxbMarkupContent.Text = Regex.Replace(data.Content, "[\r\n]", " ");
+                            TxbMarkupContent.Text = data.Content;
                         }
                         break;