using ComPDFKitViewer;
using ComPDFKitViewer.AnnotEvent;
using PDF_Office.Model;
using PDF_Office.ViewModels.Tools;
using PDFSettings;
using Prism.Commands;
using Prism.Mvvm;
using Prism.Regions;
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.ViewModels.PropertyPanel.AnnotPanel
{
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();
}
}
public class TextAnnotPropertyViewModel:BindableBase, INavigationAware
{
#region 属性
private AnnotArgsType annotType;
public AnnotArgsType AnnotType
{
get { return annotType; }
set
{
SetProperty(ref annotType, value);
SetAnnotType();
}
}
private string annotTypeTitle;
public string AnnotTypeTitle
{
get { return annotTypeTitle; }
set
{
SetProperty(ref annotTypeTitle, value);
}
}
private double annotOpacity;
public double AnnotOpacity
{
get {return annotOpacity;}
set
{
SetProperty(ref annotOpacity, value);
}
}
///
/// 示例背景
///
private Brush sampleTextBg = new SolidColorBrush(Colors.Transparent);
public Brush SampleTextBg
{
get { return sampleTextBg; }
set { SetProperty(ref sampleTextBg, value);
AnnotEvent?.UpdateAttrib(AnnotAttrib.Color, (sampleTextBg as SolidColorBrush).Color);
AnnotEvent?.UpdateAnnot();
}
}
private Brush selectColor = new SolidColorBrush(Colors.Transparent);
public Brush SelectColor
{
get { return selectColor; }
set {
SetProperty(ref selectColor, value);
AnnotEvent?.UpdateAttrib(AnnotAttrib.Color, (selectColor as SolidColorBrush).Color);
AnnotEvent?.UpdateAnnot();
// SetAnnotProperty();
}
}
#endregion
public AnnotAttribEvent AnnotEvent { get; set; }
private AnnotHandlerEventArgs Annot;
private AnnotPropertyPanel PropertyPanel;
public DelegateCommand