123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- using ComPDFKitViewer.PdfViewer;
- using PDF_Office.CustomControl;
- using PDF_Office.ViewModels.Tools;
- using System;
- using System.Collections.Generic;
- using System.Globalization;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- namespace PDF_Office.Views.Tools
- {
- public class AnnotToolIsCheckedConvert : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if(value != null && parameter != null && value is string && parameter is string)
- {
- if((string)value == (string)parameter)
- return true;
- }
- return false;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if(value != null && value is bool)
- {
- if((bool)value)
- {
- return parameter;
- }
- }
- return "";
- }
- }
- /// <summary>
- /// AnnotToolContent.xaml 的交互逻辑
- /// </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)
- {
- }
- private void BtnTool_Click(object sender, RoutedEventArgs e)
- {
- CustomIconToggleBtn keepBtn = sender as CustomIconToggleBtn;
- if (keepBtn != null)
- {
- // ClearSelectedToolPanel(keepBtn);
- }
- }
- private void ClearSelectedToolPanel(CustomIconToggleBtn keepBtn = null)
- {
- foreach (var item in ToolPanel.Children)
- {
- CustomIconToggleBtn checkBtn = item as CustomIconToggleBtn;
- //排除显示注释类型按钮
- if (checkBtn != null && checkBtn != keepBtn&&checkBtn.Name!= "BtnShowAnnot")
- {
- checkBtn.IsChecked = false;
- }
- }
- }
- private void BtnBookMark_Click(object sender, RoutedEventArgs e)
- {
- }
- }
- }
|