소스 검색

注释 - 注释工具悬浮文案

chenrongqian@kdanmobile.com 2 년 전
부모
커밋
6f2be4d86d

+ 27 - 0
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Function.cs

@@ -132,6 +132,33 @@ namespace PDF_Office.ViewModels.Tools
             ToolExpandDict.Add("Link", AnnotArgsType.AnnotLink);
         }
 
+
+        //工具悬浮文案
+        private void InitToolTipDict()
+        {
+            ToolTipDict.Add("Hand", "滚动工具");
+            ToolTipDict.Add("BtnSelecttool", "内容选择工具");
+            ToolTipDict.Add("SnapshotEdit", "内容选择工具");
+            ToolTipDict.Add("HighLight", "高亮" + " | Ctrl+Alt+H");
+            ToolTipDict.Add("UnderLine", "高亮" + " | Ctrl+Alt+U");
+            ToolTipDict.Add("Squiggly", "波浪线" + " | Ctrl+Alt+Q");
+            ToolTipDict.Add("Strikeout", "删除线" + " | Ctrl+Alt+S");
+            ToolTipDict.Add("Freehand", "手绘");
+            ToolTipDict.Add("Freetext", "文字");
+            ToolTipDict.Add("StickyNote", "便签");
+            ToolTipDict.Add("Rect", "矩形");
+            ToolTipDict.Add("Circle", "圆");
+            ToolTipDict.Add("Arrow", "箭头");
+            ToolTipDict.Add("Line", "线条");
+            ToolTipDict.Add("Link", "超链接");
+            ToolTipDict.Add("Stamp", "图章");
+            ToolTipDict.Add("Image", "图片");
+            ToolTipDict.Add("Signature", "签名");
+            ToolTipDict.Add("ShowAnnot", "显示/隐藏注释");
+        }
+
+        public Dictionary<string, string> GetToolTipDict{get{return ToolTipDict;}}
+
         #endregion 初始化数据
 
         #endregion 初始化

+ 2 - 0
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.Properties.cs

@@ -263,6 +263,8 @@ namespace PDF_Office.ViewModels.Tools
         private ViewContentViewModel viewContentViewModel;
         private AnnotPropertyPanel propertyPanel = new AnnotPropertyPanel();
         private Dictionary<string, AnnotArgsType> ToolExpandDict = new Dictionary<string, AnnotArgsType>();
+        private Dictionary<string, string> ToolTipDict = new Dictionary<string, string>();
+
         private bool isHiddenAnnot = true;
         private bool isAddBookMark = true;
         private bool isRightMenuAddAnnot = false;

+ 1 - 0
PDF Office/ViewModels/Tools/AnnotToolContentViewModel.cs

@@ -52,6 +52,7 @@ namespace PDF_Office.ViewModels.Tools
             BindingEvent();
             InitDefaultValue();
             InitToolDict();
+            InitToolTipDict();
             InitPopMenu();
         }
 

+ 5 - 4
PDF Office/Views/Tools/AnnotToolContent.xaml

@@ -13,6 +13,7 @@
     d:DesignHeight="450"
     d:DesignWidth="800"
     prism:ViewModelLocator.AutoWireViewModel="True"
+    Loaded="UserControl_Loaded"
     mc:Ignorable="d">
     <UserControl.Resources>
         <ResourceDictionary>
@@ -48,10 +49,10 @@
                 Name="ToolPanel"
                 Grid.ColumnSpan="2"
                 Height="40"
-                Margin="11,0,11,-1.6"
+                Margin="11,0,11,-1.6" 
                 HorizontalAlignment="Center">
                 <customControl:CustomIconToggleBtn
-                    x:Name="BtnHand"
+                    x:Name="BtnHand" Tag="Hand"
                     Command="{Binding HandCommand}"
                     CommandParameter="{Binding ElementName=ToolPanel}"
                     Foreground="Black"
@@ -61,7 +62,7 @@
                 </customControl:CustomIconToggleBtn>
 
                 <customControl:CustomIconToggleBtn
-                    x:Name="BtnMagnify"
+                    x:Name="BtnMagnify" Tag="Magnify"
                     Click="BtnHand_Click"
                     Foreground="Black"
                     Style="{StaticResource ToggleBtnViewModeStyle}"
@@ -78,7 +79,7 @@
                 </customControl:CustomIconToggleBtn>
 
                 <customControl:CustomIconToggleBtn
-                    x:Name="BtnSelecttool"
+                    x:Name="BtnSelecttool" 
                     Click="BtnTool_Click"
                     Command="{Binding MyToolsCommand}"
                     CommandParameter="{Binding ElementName=BtnSelecttool}"

+ 21 - 0
PDF Office/Views/Tools/AnnotToolContent.xaml.cs

@@ -23,11 +23,31 @@ namespace PDF_Office.Views.Tools
     /// </summary>
     public partial class AnnotToolContent : UserControl
     {
+        AnnotToolContentViewModel ViewModel => DataContext as AnnotToolContentViewModel;
         public AnnotToolContent()
         {
             InitializeComponent();
         }
 
+        private void UserControl_Loaded(object sender, RoutedEventArgs e)
+        {
+            if(ViewModel != null)
+            {
+                foreach(var item in ToolPanel.Children)
+                {
+                    if(item is CustomIconToggleBtn)
+                    {
+                        CustomIconToggleBtn btn = (CustomIconToggleBtn)item;
+                        if(btn.Tag != null)
+                        {
+                            var itemDict = ViewModel.GetToolTipDict.FirstOrDefault(temp => temp.Key == btn.Tag.ToString());
+                            ToolTipService.SetToolTip(btn, itemDict.Value);
+                        }
+                    }
+                }
+            }
+        }
+
         private void BtnHand_Click(object sender, RoutedEventArgs e)
         {
         }
@@ -58,5 +78,6 @@ namespace PDF_Office.Views.Tools
         private void BtnBookMark_Click(object sender, RoutedEventArgs e)
         {
         }
+
     }
 }