Browse Source

BOTA-注释列表UI优化

OYXH\oyxh 2 years ago
parent
commit
c81e336baf

+ 15 - 15
PDF Office/DataConvert/StringToDateConvert.cs

@@ -27,24 +27,24 @@ namespace PDF_Office.DataConvert
 
                 #region to do
 
-                //if (string.Equals(dateStr.Substring(4, 4), DateTime.Now.ToString("MMdd")))
-                //{//同天
-                //    date = dateStr.Substring(8, 2) + ":" + dateStr.Substring(10, 2);
-                //}
-                //else if (string.Equals(dateStr.Substring(0, 4), DateTime.Now.ToString("yyyy")))
-                //{//同年
-                //    date = dateStr.Substring(4, 2) + "/" + dateStr.Substring(6, 2) + " " + dateStr.Substring(8, 2) + ":" +
-                //   dateStr.Substring(10, 2);
-                //}
-                //else
-                //{
-                //    date = dateStr.Substring(0, 4) + "/" + dateStr.Substring(4, 2) + "/" + dateStr.Substring(6, 2) + " " + dateStr.Substring(8, 2) + ":" +
-                //    dateStr.Substring(10, 2);
-                //}
+                if (string.Equals(dateStr.Substring(4, 4), DateTime.Now.ToString("MMdd")))
+                {//同天
+                    date = dateStr.Substring(8, 2) + ":" + dateStr.Substring(10, 2);
+                }
+                else if (string.Equals(dateStr.Substring(0, 4), DateTime.Now.ToString("yyyy")))
+                {//同年
+                    date = dateStr.Substring(4, 2) + "/" + dateStr.Substring(6, 2) + " " + dateStr.Substring(8, 2) + ":" +
+                   dateStr.Substring(10, 2);
+                }
+                else
+                {
+                    date = dateStr.Substring(0, 4) + "/" + dateStr.Substring(4, 2) + "/" + dateStr.Substring(6, 2) + " " + dateStr.Substring(8, 2) + ":" +
+                    dateStr.Substring(10, 2);
+                }
 
                 #endregion to do
 
-                date = dateStr.Substring(4, 2) + "-" + dateStr.Substring(6, 2) + "   " + dateStr.Substring(8, 2) + ":" + dateStr.Substring(10, 2);
+                //date = dateStr.Substring(4, 2) + "-" + dateStr.Substring(6, 2) + "   " + dateStr.Substring(8, 2) + ":" + dateStr.Substring(10, 2);
             }
             return date;
         }

+ 29 - 0
PDF Office/Model/BOTA/AnnotationHandlerEventArgs.cs

@@ -0,0 +1,29 @@
+using ComPDFKit.PDFDocument;
+using ComPDFKitViewer.AnnotEvent;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Media.Imaging;
+
+namespace PDF_Office.Model.BOTA
+{
+    public class AnnotationHandlerEventArgs : EventArgs
+    {
+        public string Content { get; set; }
+        public string MarkupContent { get; set; }
+        public string Author { get; set; }
+        public string CreateTime { get; set; }
+        public string UpdateTime { get; set; }
+        public AnnotArgsType EventType { get; set; }
+        public bool Locked { get; set; }
+        public bool ReadOnly { get; set; }
+        public ComPDFKitViewer.FormField FormField { get; set; }
+        public int PageIndex { get; set; }
+        public int AnnotIndex { get; set; }
+        public AnnotHandlerEventArgs AnnotHandlerEventArgs { get; set; }
+        public WriteableBitmap WriteableBitmap { get; set; }
+        public CPDFDocument Document { get; set; }
+    }
+}

+ 1 - 0
PDF Office/PDF Office.csproj

@@ -243,6 +243,7 @@
     <Compile Include="Helper\SetterAction.cs" />
     <Compile Include="Helper\SettingHelper.cs" />
     <Compile Include="Helper\ToolMethod.cs" />
+    <Compile Include="Model\BOTA\AnnotationHandlerEventArgs.cs" />
     <Compile Include="Model\CloudDrive\CloudDriveItem.cs" />
     <Compile Include="Model\CloudDrive\CloudFiles.cs" />
     <Compile Include="Model\DialogNames.cs" />

+ 3 - 3
PDF Office/Styles/CustomBtnStyle.xaml

@@ -99,7 +99,7 @@
         <Setter Property="BorderThickness" Value="0" />
         <Setter Property="HorizontalContentAlignment" Value="Left" />
         <Setter Property="VerticalContentAlignment" Value="Top" />
-        <Setter Property="Height" Value="40" />
+        <Setter Property="Height" Value="25" />
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="customControl:CustomIconToggleBtn">
@@ -111,8 +111,8 @@
                         SnapsToDevicePixels="true">
                         <Grid>
                             <Grid
-                                Width="40"
-                                Height="40"
+                                Width="20"
+                                Height="20"
                                 HorizontalAlignment="Left"
                                 VerticalAlignment="Top">
                                 <Image

+ 1 - 18
PDF Office/ViewModels/BOTA/AnnotationContentViewModel.cs

@@ -9,6 +9,7 @@ using Microsoft.Office.Interop.Word;
 using PDF_Office.DataConvert;
 using PDF_Office.Helper;
 using PDF_Office.Model;
+using PDF_Office.Model.BOTA;
 using Prism.Commands;
 using Prism.Mvvm;
 using Prism.Regions;
@@ -35,24 +36,6 @@ using Task = System.Threading.Tasks.Task;
 
 namespace PDF_Office.ViewModels.BOTA
 {
-    public class AnnotationHandlerEventArgs : EventArgs
-    {
-        public string Content { get; set; }
-        public string MarkupContent { get; set; }
-        public string Author { get; set; }
-        public string CreateTime { get; set; }
-        public string UpdateTime { get; set; }
-        public AnnotArgsType EventType { get; set; }
-        public bool Locked { get; set; }
-        public bool ReadOnly { get; set; }
-        public ComPDFKitViewer.FormField FormField { get; set; }
-        public int PageIndex { get; set; }
-        public int AnnotIndex { get; set; }
-        public AnnotHandlerEventArgs AnnotHandlerEventArgs { get; set; }
-        public WriteableBitmap WriteableBitmap { get; set; }
-        public CPDFDocument Document { get; set; }
-    }
-
     public class AnnotationContentViewModel : BindableBase, INavigationAware
     {
         private Visibility isEmptyPanelVisibility = Visibility.Visible;

File diff suppressed because it is too large
+ 33 - 13
PDF Office/Views/BOTA/AnnotationListItem.xaml


+ 19 - 16
PDF Office/Views/BOTA/AnnotationListItem.xaml.cs

@@ -5,6 +5,7 @@ using ComPDFKit.PDFPage;
 using ComPDFKitViewer.AnnotEvent;
 using ComPDFKitViewer.PdfViewer;
 using PDF_Office.Helper;
+using PDF_Office.Model.BOTA;
 using PDF_Office.ViewModels.BOTA;
 using System;
 using System.Collections.Generic;
@@ -50,21 +51,23 @@ namespace PDF_Office.Views.BOTA
             {
                 case AnnotArgsType.AnnotFreeText:
                     AnnotFreeText.Visibility = Visibility.Visible;
-                    TxbContext.Text = data.Content;
                     TxbMarkUpContent.Foreground = new SolidColorBrush((data as FreeTextAnnotArgs).FontColor);
-
                     break;
 
                 case AnnotArgsType.AnnotHighlight:
                     BtnHighlight.Visibility = Visibility.Visible;
-                    HighlightPath.Fill = new SolidColorBrush((data as TextHighlightAnnotArgs).Color);
+                    PathHighlight.Fill = new SolidColorBrush((data as TextHighlightAnnotArgs).Color);
                     //TxbContext.Text = data.Content;
-                    TxbContext.Background = new SolidColorBrush((data as TextHighlightAnnotArgs).Color);
+                    if (!string.IsNullOrEmpty(TxbContext.Text))
+                    {
+                        TxbContext.Background = new SolidColorBrush((data as TextHighlightAnnotArgs).Color);
+                    }
+                   
                     break;
 
                 case AnnotArgsType.AnnotFreehand:
                     BtnFreeHand.Visibility = Visibility.Visible;
-                    FreehandPath.Fill = new SolidColorBrush((data as FreehandAnnotArgs).InkColor);
+                    PathFreehand.Fill = new SolidColorBrush((data as FreehandAnnotArgs).InkColor);
                     ImageContext.Visibility = Visibility.Visible;
 
                     TxbContext.Visibility = Visibility.Collapsed;
@@ -105,9 +108,9 @@ namespace PDF_Office.Views.BOTA
                     break;
 
                 case AnnotArgsType.AnnotStrikeout://删除线
-                    AnnotStrikeout.Visibility = Visibility.Visible;
+                    BtnAnnotStrikeout.Visibility = Visibility.Visible;
 
-                    AnnotStrikeoutycolor.Fill = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
+                    PathStrikeoutyColor.Fill = new SolidColorBrush((data as TextStrikeoutAnnotArgs).Color);
 
                     #region to do
 
@@ -130,7 +133,7 @@ namespace PDF_Office.Views.BOTA
 
                 case AnnotArgsType.AnnotSticky://便签
                     BtnAnnotSticky.Visibility = Visibility;
-                    Pathsticky.Fill = new SolidColorBrush((data as StickyAnnotArgs).Color);
+                    PathSticky.Fill = new SolidColorBrush((data as StickyAnnotArgs).Color);
                     break;
 
                 case AnnotArgsType.AnnotUnderline:
@@ -157,13 +160,13 @@ namespace PDF_Office.Views.BOTA
                 case AnnotArgsType.AnnotLine:
                     if ((data as LineAnnotArgs).HeadLineType >= (C_LINE_TYPE)1 || (data as LineAnnotArgs).TailLineType >= (C_LINE_TYPE)1)
                     {
-                        SharpArrowBtn.Visibility = Visibility.Visible;
-                        arrow.Fill = new SolidColorBrush((data as LineAnnotArgs).LineColor);
+                        BtnSharpArrow.Visibility = Visibility.Visible;
+                        PathArrow.Fill = new SolidColorBrush((data as LineAnnotArgs).LineColor);
                     }
                     else
                     {
-                        line.Fill = new SolidColorBrush((data as LineAnnotArgs).LineColor);
-                        SharpLineBtn.Visibility = Visibility.Visible;
+                        PathSharpLine.Fill = new SolidColorBrush((data as LineAnnotArgs).LineColor);
+                        BtnSharpLine.Visibility = Visibility.Visible;
                     }
                     ///对于形状注释等只有Note 的处理
                     if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
@@ -174,7 +177,7 @@ namespace PDF_Office.Views.BOTA
                     break;
 
                 case AnnotArgsType.AnnotSquare:
-                    AnnotSquare.Visibility = Visibility.Visible;
+                    BtnAnnotSquare.Visibility = Visibility.Visible;
                     RectAnnotSquare.Stroke = new SolidColorBrush((data as SquareAnnotArgs).LineColor);
                     RectAnnotSquare.Fill = new SolidColorBrush((data as SquareAnnotArgs).BgColor);
                     ///对于形状注释等只有Note 的处理
@@ -186,9 +189,9 @@ namespace PDF_Office.Views.BOTA
                     break;
 
                 case AnnotArgsType.AnnotCircle:
-                    AnnotCircle.Visibility = Visibility.Visible;
-                    circle.Stroke = new SolidColorBrush((data as CircleAnnotArgs).LineColor);
-                    circle.Fill = new SolidColorBrush((data as CircleAnnotArgs).BgColor);
+                    BtnAnnotCircle.Visibility = Visibility.Visible;
+                    EllipseCircle.Stroke = new SolidColorBrush((data as CircleAnnotArgs).LineColor);
+                    EllipseCircle.Fill = new SolidColorBrush((data as CircleAnnotArgs).BgColor);
                     ///对于形状注释等只有Note 的处理
                     if (!string.IsNullOrEmpty(data.Content) && string.IsNullOrEmpty(data.MarkupContent))
                     {