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 ""; } } /// /// AnnotToolContent.xaml 的交互逻辑 /// 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) { } } }