123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123 |
- using ComPDFKitViewer.AnnotEvent;
- 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.Data;
- using System.Windows.Media;
- namespace PDF_Office.DataConvert
- {
- public class PropertyPanelVisible : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if(value is string)
- {
- var panelType = (string)value;
- if(parameter.ToString() == panelType)
- switch(panelType)
- {
- case "HighLight":
- return Visibility.Visible;
- default:
- break;
- }
- }
- return Visibility.Collapsed;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class CheckToVisibleMutiConvert : IMultiValueConverter
- {
- public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
- {
- for (int i = 0; i < values.Length; i++)
- {
- if ((bool)values[i] == true)
- return Visibility.Collapsed;
- }
- return Visibility.Visible;
- }
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class ColorToBrushConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is Color)
- {
- return new SolidColorBrush((Color)value);
- }
- return Brushes.Transparent;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- public class AnnotArgsTypeConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value is AnnotArgsType)
- {
- if (parameter is string)
- {
- var args = (AnnotArgsType)value;
- if ((string)parameter == "AnnotHighlight" && args == AnnotArgsType.AnnotHighlight)
- {
- return Visibility.Visible;
- }
- if ((string)parameter == "AnnotUnderline" && args == AnnotArgsType.AnnotUnderline)
- {
- return Visibility.Visible;
- }
- if ((string)parameter == "AnnotSquiggly" && args == AnnotArgsType.AnnotSquiggly)
- {
- return Visibility.Visible;
- }
- if ((string)parameter == "AnnotStrikeout" && args == AnnotArgsType.AnnotStrikeout)
- {
- return Visibility.Visible;
- }
- if ((string)parameter == "AnnotSticky" && args == AnnotArgsType.AnnotSticky)
- {
- return Visibility.Visible;
- }
- }
- }
- return Visibility.Collapsed;
- }
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
- }
|