|
@@ -17,27 +17,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
public class TextAnnotPropertyViewModel:BindableBase, INavigationAware
|
|
|
{
|
|
|
- // private ComPDFKitViewer.PdfViewer.CPDFViewer PDFViewer;
|
|
|
- private AnnotHandlerEventArgs Annot;
|
|
|
- private AnnotPropertyPanel PropertyPanel;
|
|
|
+
|
|
|
|
|
|
#region 属性
|
|
|
|
|
|
- private double annotOpacity;
|
|
|
- public double AnnotOpacity
|
|
|
- {
|
|
|
- get {return annotOpacity;}
|
|
|
- set
|
|
|
- {
|
|
|
- SetProperty(ref annotOpacity, value);
|
|
|
- SampleTextBg.Opacity = annotOpacity;
|
|
|
- Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
|
|
|
- changeData[AnnotType] = annotOpacity;
|
|
|
- PropertyPanel.DataChangedInvoke(this, changeData);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
private AnnotArgsType annotType;
|
|
|
public AnnotArgsType AnnotType
|
|
|
{
|
|
@@ -49,15 +32,6 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 示例背景
|
|
|
- /// </summary>
|
|
|
- private Brush sampleTextBg = new SolidColorBrush(Colors.Transparent);
|
|
|
- public Brush SampleTextBg
|
|
|
- {
|
|
|
- get { return sampleTextBg; }
|
|
|
- set { SetProperty(ref sampleTextBg, value); SetAnnotProperty(); }
|
|
|
- }
|
|
|
|
|
|
private string annotTypeTitle;
|
|
|
public string AnnotTypeTitle
|
|
@@ -69,8 +43,31 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private Color selectColor;
|
|
|
- public Color SelectColor
|
|
|
+
|
|
|
+ private double annotOpacity;
|
|
|
+ public double AnnotOpacity
|
|
|
+ {
|
|
|
+ get {return annotOpacity;}
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref annotOpacity, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 示例背景
|
|
|
+ /// </summary>
|
|
|
+ private Brush sampleTextBg = new SolidColorBrush(Colors.Transparent);
|
|
|
+ public Brush SampleTextBg
|
|
|
+ {
|
|
|
+ get { return sampleTextBg; }
|
|
|
+ set { SetProperty(ref sampleTextBg, value); SetAnnotProperty(); }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private Brush selectColor = new SolidColorBrush(Colors.Transparent);
|
|
|
+ public Brush SelectColor
|
|
|
{
|
|
|
get { return selectColor; }
|
|
|
set { SetProperty(ref selectColor, value); SetAnnotProperty(); }
|
|
@@ -78,14 +75,17 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
-
|
|
|
+ private AnnotHandlerEventArgs Annot;
|
|
|
+ private AnnotPropertyPanel PropertyPanel;
|
|
|
public DelegateCommand<object> SelectedColorChangedCommand { get; set; }
|
|
|
public DelegateCommand<object> OpacityItemCommand { get; set; }
|
|
|
+ public DelegateCommand<object> OpacityValueChangedCommand { get; set; }
|
|
|
|
|
|
public TextAnnotPropertyViewModel()
|
|
|
{
|
|
|
SelectedColorChangedCommand = new DelegateCommand<object>(SelectedColorChanged_Click);
|
|
|
OpacityItemCommand = new DelegateCommand<object>(OpacityItemCommand_Click);
|
|
|
+ OpacityValueChangedCommand = new DelegateCommand<object>(OpacityValueChanged_Command);
|
|
|
}
|
|
|
|
|
|
private void OpacityItemCommand_Click(object obj)
|
|
@@ -103,6 +103,22 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void OpacityValueChanged_Command(object obj)
|
|
|
+ {
|
|
|
+ if (obj != null)
|
|
|
+ {
|
|
|
+ if (AnnotType == AnnotArgsType.AnnotHighlight)
|
|
|
+ SampleTextBg.Opacity = annotOpacity;
|
|
|
+ else
|
|
|
+ SelectColor.Opacity = annotOpacity;
|
|
|
+
|
|
|
+ SetAnnotProperty();
|
|
|
+ Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
|
|
|
+ changeData[AnnotType] = annotOpacity;
|
|
|
+ PropertyPanel.DataChangedInvoke(this, changeData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
public void SelectedColorChanged_Click(object color)
|
|
|
{
|
|
|
if (color != null)
|
|
@@ -110,30 +126,25 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
var colorValue = (Color)color;
|
|
|
if (colorValue != null)
|
|
|
{
|
|
|
- SampleTextBg = new SolidColorBrush(colorValue);
|
|
|
- switch(AnnotType)
|
|
|
+
|
|
|
+ switch (AnnotType)
|
|
|
{
|
|
|
case AnnotArgsType.AnnotHighlight:
|
|
|
+ SampleTextBg = new SolidColorBrush(colorValue);
|
|
|
SampleTextBg.Opacity = AnnotOpacity;
|
|
|
break;
|
|
|
case AnnotArgsType.AnnotUnderline:
|
|
|
- SampleTextBg.Opacity = AnnotOpacity;
|
|
|
- break;
|
|
|
case AnnotArgsType.AnnotStrikeout:
|
|
|
- SampleTextBg.Opacity = AnnotOpacity;
|
|
|
- break;
|
|
|
case AnnotArgsType.AnnotSquiggly:
|
|
|
- SampleTextBg.Opacity = AnnotOpacity;
|
|
|
- break;
|
|
|
case AnnotArgsType.AnnotSticky:
|
|
|
- SampleTextBg.Opacity = AnnotOpacity;
|
|
|
+ SelectColor = new SolidColorBrush(colorValue);
|
|
|
+ SelectColor.Opacity = AnnotOpacity;
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
|
|
|
changeData[AnnotType] = color;
|
|
|
PropertyPanel.DataChangedInvoke(this, changeData);
|
|
|
- // PropertyPanel.DataChanged?.Invoke(this, changeData);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -179,10 +190,9 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if(PropertyPanel != null)
|
|
|
{
|
|
|
Annot = PropertyPanel.annot;
|
|
|
-
|
|
|
+ AnnotType = Annot.EventType;
|
|
|
GetAnnotProperty();
|
|
|
}
|
|
|
-
|
|
|
|
|
|
}
|
|
|
|
|
@@ -191,16 +201,13 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
if (Annot != null)
|
|
|
{
|
|
|
- SampleTextBg = new SolidColorBrush(Colors.Transparent);
|
|
|
-
|
|
|
switch (Annot.EventType)
|
|
|
{
|
|
|
case AnnotArgsType.AnnotHighlight:
|
|
|
- if (Annot is TextHighlightAnnotArgs)
|
|
|
+ if (Annot is TextHighlightAnnotArgs)
|
|
|
{
|
|
|
var Hightlight = Annot as TextHighlightAnnotArgs;
|
|
|
AnnotOpacity = Hightlight.Transparency;
|
|
|
- AnnotType = Hightlight.EventType;
|
|
|
SampleTextBg = new SolidColorBrush(Hightlight.Color);
|
|
|
|
|
|
}
|
|
@@ -210,8 +217,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
var Underline = Annot as TextUnderlineAnnotArgs;
|
|
|
AnnotOpacity = Underline.Transparency;
|
|
|
- AnnotType = Underline.EventType;
|
|
|
- SampleTextBg = new SolidColorBrush(Underline.Color);
|
|
|
+ SampleTextBg = new SolidColorBrush(Colors.Transparent);
|
|
|
+ SelectColor = new SolidColorBrush(Underline.Color);
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -219,8 +226,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
var Squiggly = Annot as TextSquigglyAnnotArgs;
|
|
|
AnnotOpacity = Squiggly.Transparency;
|
|
|
- AnnotType = Squiggly.EventType;
|
|
|
- SampleTextBg = new SolidColorBrush(Squiggly.Color);
|
|
|
+ SampleTextBg = new SolidColorBrush(Colors.Transparent);
|
|
|
+ SelectColor = new SolidColorBrush(Squiggly.Color);
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -256,6 +263,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
if (Underline.Transparency != AnnotOpacity)
|
|
|
Underline.Transparency = AnnotOpacity;
|
|
|
+
|
|
|
+ var c = (SelectColor as SolidColorBrush).Color;
|
|
|
+ if (Underline.Color.A != c.A || Underline.Color.B != c.B || Underline.Color.G != c.G || Underline.Color.R != c.R)
|
|
|
+ Underline.Color = (SelectColor as SolidColorBrush).Color;
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -264,6 +275,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
var Squiggly = Annot as TextSquigglyAnnotArgs;
|
|
|
if (Squiggly.Transparency != AnnotOpacity)
|
|
|
AnnotOpacity = Squiggly.Transparency;
|
|
|
+
|
|
|
+ var c = (SelectColor as SolidColorBrush).Color;
|
|
|
+ if (Squiggly.Color.A != c.A || Squiggly.Color.B != c.B || Squiggly.Color.G != c.G || Squiggly.Color.R != c.R)
|
|
|
+ Squiggly.Color = (SelectColor as SolidColorBrush).Color;
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -272,6 +287,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
var Strikeout = Annot as TextStrikeoutAnnotArgs;
|
|
|
if (Strikeout.Transparency != AnnotOpacity)
|
|
|
Strikeout.Transparency = AnnotOpacity;
|
|
|
+
|
|
|
+ var c = (SelectColor as SolidColorBrush).Color;
|
|
|
+ if (Strikeout.Color.A != c.A || Strikeout.Color.B != c.B || Strikeout.Color.G != c.G || Strikeout.Color.R != c.R)
|
|
|
+ Strikeout.Color = (SelectColor as SolidColorBrush).Color;
|
|
|
}
|
|
|
break;
|
|
|
|