|
@@ -13,6 +13,8 @@ using Prism.Regions;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Collections.ObjectModel;
|
|
|
+using System.Diagnostics;
|
|
|
+using System.Diagnostics.Eventing.Reader;
|
|
|
using System.Globalization;
|
|
|
using System.Windows;
|
|
|
using System.Windows.Data;
|
|
@@ -63,10 +65,20 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
throw new NotImplementedException();
|
|
|
}
|
|
|
}
|
|
|
- public class TextAnnotPropertyViewModel:BindableBase, INavigationAware
|
|
|
+ public class TextAnnotPropertyViewModel : BindableBase, INavigationAware
|
|
|
{
|
|
|
|
|
|
#region 属性
|
|
|
+
|
|
|
+ //当前边框颜色
|
|
|
+ private Brush _textDefaultColor;
|
|
|
+
|
|
|
+ public Brush TextDefaultColor
|
|
|
+ {
|
|
|
+ get { return _textDefaultColor; }
|
|
|
+ set => SetProperty(ref _textDefaultColor, value);
|
|
|
+ }
|
|
|
+
|
|
|
private AnnotCommon _basicVm = new AnnotCommon();
|
|
|
public AnnotCommon BasicVm
|
|
|
{
|
|
@@ -83,6 +95,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
public List<ColorItem> HighlightItems { get; set; }
|
|
|
public List<ColorItem> UnderLineItems { get; set; }
|
|
|
+ public List<ColorItem> StrikeoutItems { get; set; }
|
|
|
|
|
|
#endregion 属性
|
|
|
|
|
@@ -91,10 +104,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
private AnnotTransfer PropertyPanel;
|
|
|
public DelegateCommand<object> SelectedColorChangedCommand { get; set; }
|
|
|
public DelegateCommand<object> SelectedOpacityChangedCommand { get; set; }
|
|
|
-
|
|
|
+ public DelegateCommand<object> DefaultColorChangedCommand { get; set; }
|
|
|
public TextAnnotPropertyViewModel()
|
|
|
{
|
|
|
SelectedColorChangedCommand = new DelegateCommand<object>(SelectedColorChanged);
|
|
|
+ DefaultColorChangedCommand = new DelegateCommand<object>(DefaultColorChanged);
|
|
|
SelectedOpacityChangedCommand = new DelegateCommand<object>(SelectedOpacityChanged);
|
|
|
InitHighlightItems();
|
|
|
InitUnderLinetItems();
|
|
@@ -108,7 +122,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
private void InitUnderLinetItems()
|
|
|
{
|
|
|
- UnderLineItems = AnnotColorList.GetColorList(ColorSelectorType.Border);
|
|
|
+ UnderLineItems = AnnotColorList.GetColorList(ColorSelectorType.Border);
|
|
|
+ StrikeoutItems = AnnotColorList.GetColorList(ColorSelectorType.Border);
|
|
|
}
|
|
|
|
|
|
|
|
@@ -146,11 +161,55 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ private Brush HighlightDefaultColor = App.Current.FindResource("color.sys.layout.divider.highlight") as Brush;
|
|
|
+ private Brush UnderlineDefaultColor = App.Current.FindResource("color.sys.layout.divider.strikethough") as Brush;
|
|
|
+ private Brush StrikeoutDefaultColor = App.Current.FindResource("color.sys.layout.divider.underline") as Brush;
|
|
|
+ private AnnotArgsType annotArgsType = AnnotArgsType.AnnotHighlight;
|
|
|
+ public void DefaultColorChanged(object color)
|
|
|
+ {
|
|
|
+ if (color != null)
|
|
|
+ {
|
|
|
+ var colorValue = (Color)color;
|
|
|
+ if (colorValue != null)
|
|
|
+ {
|
|
|
+ TextDefaultColor= new SolidColorBrush(colorValue);
|
|
|
+ switch (annotArgsType)
|
|
|
+ {
|
|
|
+ case AnnotArgsType.AnnotHighlight:
|
|
|
+
|
|
|
+ {
|
|
|
+ HighlightDefaultColor = new SolidColorBrush(colorValue);
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotUnderline:
|
|
|
+ {
|
|
|
+ UnderlineDefaultColor = new SolidColorBrush(colorValue);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotStrikeout:
|
|
|
+ {
|
|
|
+ StrikeoutDefaultColor = new SolidColorBrush(colorValue);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ case AnnotArgsType.AnnotSquiggly:
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
private void SetAnnotType()
|
|
|
{
|
|
|
- if(BasicVm.IsMultiSelected)
|
|
|
+ if (BasicVm.IsMultiSelected)
|
|
|
{
|
|
|
BasicVm.AnnotTypeTitle = "General Properties";
|
|
|
return;
|
|
@@ -187,7 +246,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
|
|
|
navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
|
|
|
- if(PropertyPanel != null)
|
|
|
+ if (PropertyPanel != null)
|
|
|
{
|
|
|
AllVariable();
|
|
|
SetAnnotType();
|
|
@@ -205,8 +264,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
else
|
|
|
{
|
|
|
BasicVm.FontColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -219,15 +278,20 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
private void SelectedColorItems()
|
|
|
{
|
|
|
- if(BasicVm.AnnotType == AnnotArgsType.AnnotHighlight)
|
|
|
+ if (BasicVm.AnnotType == AnnotArgsType.AnnotHighlight)
|
|
|
{
|
|
|
BasicVm.ColorItems = HighlightItems;
|
|
|
ColorType = ColorSelectorType.Highlight;
|
|
|
- }
|
|
|
- else
|
|
|
+ }
|
|
|
+ else if (BasicVm.AnnotType == AnnotArgsType.AnnotUnderline)
|
|
|
{
|
|
|
BasicVm.ColorItems = UnderLineItems;
|
|
|
ColorType = ColorSelectorType.Border;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ BasicVm.ColorItems = StrikeoutItems;
|
|
|
+ ColorType = ColorSelectorType.Border;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -243,12 +307,14 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
private void GetAnnotProperty()
|
|
|
{
|
|
|
if (Annot != null)
|
|
|
- {
|
|
|
+ {
|
|
|
+ annotArgsType = Annot.EventType;
|
|
|
switch (Annot.EventType)
|
|
|
{
|
|
|
- case AnnotArgsType.AnnotHighlight:
|
|
|
- if (Annot is TextHighlightAnnotArgs)
|
|
|
- {
|
|
|
+ case AnnotArgsType.AnnotHighlight:
|
|
|
+ if (Annot is TextHighlightAnnotArgs)
|
|
|
+ {
|
|
|
+ TextDefaultColor = HighlightDefaultColor;
|
|
|
var Hightlight = Annot as TextHighlightAnnotArgs;
|
|
|
BasicVm.FillOpacity = Hightlight.Transparency;
|
|
|
BasicVm.FontColor = new SolidColorBrush(Hightlight.Color);
|
|
@@ -257,6 +323,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
case AnnotArgsType.AnnotUnderline:
|
|
|
{
|
|
|
+ TextDefaultColor = UnderlineDefaultColor;
|
|
|
var Underline = Annot as TextUnderlineAnnotArgs;
|
|
|
BasicVm.FillOpacity = Underline.Transparency;
|
|
|
BasicVm.FontColor = new SolidColorBrush(Underline.Color);
|
|
@@ -265,6 +332,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
case AnnotArgsType.AnnotStrikeout:
|
|
|
{
|
|
|
+ TextDefaultColor = StrikeoutDefaultColor;
|
|
|
var Strikeout = Annot as TextStrikeoutAnnotArgs;
|
|
|
BasicVm.FillOpacity = Strikeout.Transparency;
|
|
|
BasicVm.FontColor = new SolidColorBrush(Strikeout.Color);
|