|
@@ -50,87 +50,11 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
public class SharpsAnnotPropertyViewModel : BindableBase, INavigationAware
|
|
|
{
|
|
|
#region 属性
|
|
|
-
|
|
|
- private AnnotArgsType annotType;
|
|
|
- public AnnotArgsType AnnotType
|
|
|
- {
|
|
|
- get { return annotType; }
|
|
|
- set
|
|
|
- {
|
|
|
- SetProperty(ref annotType, value);
|
|
|
- SetAnnotType();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private string annotTypeTitle;
|
|
|
- public string AnnotTypeTitle
|
|
|
+ private AnnotBasePropertyVM _basicVm = new AnnotBasePropertyVM();
|
|
|
+ public AnnotBasePropertyVM BasicVm
|
|
|
{
|
|
|
- get { return annotTypeTitle; }
|
|
|
- set
|
|
|
- {
|
|
|
- SetProperty(ref annotTypeTitle, value);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- 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();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private Brush fillColor = new SolidColorBrush(Colors.Transparent);
|
|
|
- public Brush FillColor
|
|
|
- {
|
|
|
- get { return fillColor; }
|
|
|
- set
|
|
|
- {
|
|
|
- SetProperty(ref fillColor, value);
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.FillColor, (fillColor as SolidColorBrush).Color);
|
|
|
- AnnotEvent?.UpdateAnnot();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private double borderOpacity = 1;
|
|
|
- public double BorderOpacity
|
|
|
- {
|
|
|
- get { return borderOpacity; }
|
|
|
- set
|
|
|
- {
|
|
|
- SetProperty(ref borderOpacity, value);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private double fillOpacity = 1;
|
|
|
- public double FillOpacity
|
|
|
- {
|
|
|
- get { return fillOpacity; }
|
|
|
- set
|
|
|
- {
|
|
|
- SetProperty(ref fillOpacity, value);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private double lineWidth = 1;
|
|
|
- public double LineWidth
|
|
|
- {
|
|
|
- get { return lineWidth; }
|
|
|
- set
|
|
|
- {
|
|
|
- SetProperty(ref lineWidth, value);
|
|
|
-
|
|
|
- if (annotType == AnnotArgsType.AnnotLine)
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.Thickness, lineWidth);
|
|
|
- else
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.Thickness, lineWidth);
|
|
|
-
|
|
|
- AnnotEvent?.UpdateAnnot();
|
|
|
- }
|
|
|
+ get { return _basicVm; }
|
|
|
+ set => SetProperty(ref _basicVm, value);
|
|
|
}
|
|
|
|
|
|
private Geometry dataPath = null;
|
|
@@ -150,19 +74,6 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
set
|
|
|
{
|
|
|
SetProperty(ref dash, value);
|
|
|
- if (IsMultiSelected)
|
|
|
- {
|
|
|
- foreach (var item in PropertyPanel.AnnotEvents)
|
|
|
- {
|
|
|
- UpdateDash(item);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- UpdateDash(AnnotEvent);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -189,17 +100,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
attribEvent?.UpdateAnnot();
|
|
|
}
|
|
|
|
|
|
- private bool _isMultiSelected = false;
|
|
|
- public bool IsMultiSelected
|
|
|
- {
|
|
|
- get { return _isMultiSelected; }
|
|
|
- set => SetProperty(ref _isMultiSelected, value);
|
|
|
- }
|
|
|
-
|
|
|
#endregion
|
|
|
|
|
|
public DelegateCommand<object> SelectedThickCommand { get; set; }
|
|
|
- public DelegateCommand<object> SelectedColorCommand { get; set; }
|
|
|
+ public DelegateCommand<object> SelectedBorderColorCommand { get; set; }
|
|
|
|
|
|
public DelegateCommand<object> SelectedFillOpacityCommand { get; set; }
|
|
|
public DelegateCommand<object> SelectedFillColorCommand { get; set; }
|
|
@@ -214,15 +118,16 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
public event EventHandler<object> LoadPropertyHandler;
|
|
|
public SharpsAnnotPropertyViewModel()
|
|
|
{
|
|
|
- SelectedThickCommand = new DelegateCommand<object>(SelectedThick_Command);
|
|
|
- SelectedColorCommand = new DelegateCommand<object>(SelectedColor_Command);
|
|
|
+ SharpsTypeCommand = new DelegateCommand<object>(SharpsType_Command);
|
|
|
SelectedFillOpacityCommand = new DelegateCommand<object>(SelectedFillOpacity_Command);
|
|
|
SelectedFillColorCommand = new DelegateCommand<object>(SelectedFillColor_Command);
|
|
|
- LineStyleCommand = new DelegateCommand<object>(LineStyle_Command);
|
|
|
- SharpsTypeCommand = new DelegateCommand<object>(SharpsType_Command);
|
|
|
- ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged_Command);
|
|
|
+
|
|
|
+ SelectedThickCommand = new DelegateCommand<object>(SelectedThick_Command);
|
|
|
+ SelectedBorderColorCommand = new DelegateCommand<object>(SelectedBorderColor);
|
|
|
SelectedOpacityValueCommand = new DelegateCommand<object>(SelectedOpacityValue);
|
|
|
|
|
|
+ ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged_Command);
|
|
|
+ LineStyleCommand = new DelegateCommand<object>(LineStyle_Command);
|
|
|
}
|
|
|
|
|
|
private void ThicknessChanged_Command(object obj)
|
|
@@ -234,7 +139,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (content != null)
|
|
|
{
|
|
|
var intData = int.Parse(content);
|
|
|
- LineWidth = intData;
|
|
|
+ BasicVm.AnnotThickness = intData;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -313,34 +218,34 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
dashAnnot.Dashes.Add(0);
|
|
|
dashAnnot.Dashes.Add(0);
|
|
|
Dash = dashAnnot;
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.LineStyle, DashStyles.Solid);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
-
|
|
|
DashStyle dashAnnot = new DashStyle();
|
|
|
dashAnnot.Dashes.Add(1);
|
|
|
dashAnnot.Dashes.Add(1);
|
|
|
Dash = dashAnnot;
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.LineStyle, dash);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
private void SelectedFillColor_Command(object obj)
|
|
|
{
|
|
|
- if (obj != null)
|
|
|
+ if (obj != null && PropertyPanel != null)
|
|
|
{
|
|
|
var colorValue = (Color)obj;
|
|
|
if (colorValue != null)
|
|
|
{
|
|
|
-
|
|
|
- FillColor = new SolidColorBrush(colorValue);
|
|
|
- FillColor.Opacity = FillOpacity;
|
|
|
-
|
|
|
- Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
|
|
|
- changeData[AnnotArgsType.AnnotFreehand] = obj;
|
|
|
- PropertyPanel.InvokeToMyTools(this, changeData);
|
|
|
+ BasicVm.FillColor = new SolidColorBrush(colorValue);
|
|
|
+ BasicVm.FillColor.Opacity = BasicVm.FillOpacity;
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.FillColor, colorValue);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
|
|
|
}
|
|
|
|
|
@@ -348,14 +253,12 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
if (obj != null)
|
|
|
{
|
|
|
- FillOpacity = (double)obj;
|
|
|
- SelectColor.Opacity = FillOpacity;
|
|
|
-
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, FillOpacity);
|
|
|
- AnnotEvent?.UpdateAnnot();
|
|
|
- Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
|
|
|
- changeData[AnnotArgsType.AnnotFreehand] = FillOpacity;
|
|
|
- PropertyPanel.InvokeToMyTools(this, changeData);
|
|
|
+ BasicVm.FillOpacity = (double)obj;
|
|
|
+ BasicVm.FillColor.Opacity = BasicVm.FillOpacity;
|
|
|
+
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
|
|
|
+ PropertyPanel.InvokeToMyTools(AnnotArgsType.AnnotFreehand, BasicVm.FillOpacity);
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -364,36 +267,29 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
if (obj != null)
|
|
|
{
|
|
|
- FillOpacity = (double)obj;
|
|
|
- SelectColor.Opacity = FillOpacity;
|
|
|
-
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, FillOpacity);
|
|
|
- AnnotEvent?.UpdateAnnot();
|
|
|
- Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
|
|
|
- changeData[AnnotArgsType.AnnotFreehand] = FillOpacity;
|
|
|
- PropertyPanel.InvokeToMyTools(this, changeData);
|
|
|
+ BasicVm.FillOpacity = (double)obj;
|
|
|
+ BasicVm.FillColor.Opacity = BasicVm.FillOpacity;
|
|
|
+
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
|
|
|
+ PropertyPanel.InvokeToMyTools(AnnotArgsType.AnnotFreehand, BasicVm.FillOpacity);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- private void SelectedColor_Command(object obj)
|
|
|
+ private void SelectedBorderColor(object obj)
|
|
|
{
|
|
|
- if (obj != null)
|
|
|
+
|
|
|
+ if (obj != null && PropertyPanel != null)
|
|
|
{
|
|
|
var colorValue = (Color)obj;
|
|
|
if (colorValue != null)
|
|
|
{
|
|
|
-
|
|
|
- SelectColor = new SolidColorBrush(colorValue);
|
|
|
- SelectColor.Opacity = FillOpacity;
|
|
|
-
|
|
|
- Dictionary<AnnotArgsType, object> changeData = new Dictionary<AnnotArgsType, object>();
|
|
|
- changeData[AnnotArgsType.AnnotFreehand] = obj;
|
|
|
- PropertyPanel.InvokeToMyTools(this, changeData);
|
|
|
+ BasicVm.BorderColor = new SolidColorBrush(colorValue);
|
|
|
+ BasicVm.BorderColor.Opacity = BasicVm.BorderOpacity;
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Color, colorValue);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|
|
@@ -403,11 +299,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (obj is double)
|
|
|
{
|
|
|
var tran = (double)obj;
|
|
|
- BorderOpacity = tran;
|
|
|
- SelectColor.Opacity = tran;
|
|
|
-
|
|
|
- AnnotEvent?.UpdateAttrib(AnnotAttrib.Transparency, tran);
|
|
|
- AnnotEvent?.UpdateAnnot();
|
|
|
+ BasicVm.AnnotThickness = tran;
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Thickness, tran);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -418,18 +311,18 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
|
{
|
|
|
- IsMultiSelected = false;
|
|
|
+ BasicVm.IsMultiSelected = false;
|
|
|
}
|
|
|
|
|
|
private void SetAnnotType()
|
|
|
{
|
|
|
- switch (AnnotType)
|
|
|
+ switch (BasicVm.AnnotType)
|
|
|
{
|
|
|
case AnnotArgsType.AnnotCircle:
|
|
|
- AnnotTypeTitle = "圆";
|
|
|
+ BasicVm.AnnotTypeTitle = "圆";
|
|
|
break;
|
|
|
case AnnotArgsType.AnnotSquare:
|
|
|
- AnnotTypeTitle = "矩形";
|
|
|
+ BasicVm.AnnotTypeTitle = "矩形";
|
|
|
break;
|
|
|
case AnnotArgsType.AnnotLine:
|
|
|
|
|
@@ -437,9 +330,9 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (annotLine != null)
|
|
|
{
|
|
|
if (annotLine.TailLineType == C_LINE_TYPE.LINETYPE_ARROW && annotLine.HeadLineType == C_LINE_TYPE.LINETYPE_NONE)
|
|
|
- AnnotTypeTitle = "箭头";
|
|
|
+ BasicVm.AnnotTypeTitle = "箭头";
|
|
|
else
|
|
|
- AnnotTypeTitle = "线";
|
|
|
+ BasicVm.AnnotTypeTitle = "线";
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
@@ -455,18 +348,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (PropertyPanel != null)
|
|
|
{
|
|
|
AnnotEvent = PropertyPanel.AnnotEvent;
|
|
|
- AnnotType = PropertyPanel.annot.EventType;
|
|
|
+ BasicVm.AnnotType = PropertyPanel.annot.EventType;
|
|
|
Annot = PropertyPanel.annot;
|
|
|
- if (PropertyPanel.annotlists != null && PropertyPanel.annotlists.Count > 1)
|
|
|
- {
|
|
|
- IsMultiSelected = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- IsMultiSelected = false;
|
|
|
- }
|
|
|
-
|
|
|
- if(IsMultiSelected)
|
|
|
+ BasicVm.IsMultiSelected = PropertyPanel.IsMultiSelected;
|
|
|
+ if(BasicVm.IsMultiSelected)
|
|
|
{
|
|
|
|
|
|
}
|
|
@@ -484,20 +369,34 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
if (Annot != null)
|
|
|
{
|
|
|
+ bool isSolid = true;
|
|
|
switch (Annot.EventType)
|
|
|
{
|
|
|
case AnnotArgsType.AnnotSquare:
|
|
|
if (Annot is SquareAnnotArgs)
|
|
|
{
|
|
|
var Square = Annot as SquareAnnotArgs;
|
|
|
- SelectColor = new SolidColorBrush(Square.LineColor);
|
|
|
- FillColor = new SolidColorBrush(Square.BgColor);
|
|
|
- BorderOpacity = Square.Transparency;
|
|
|
- FillOpacity = Square.Transparency;
|
|
|
- LineWidth = Square.LineWidth;
|
|
|
+ BasicVm.BorderColor = new SolidColorBrush(Square.LineColor);
|
|
|
+ BasicVm.FillColor = new SolidColorBrush(Square.BgColor);
|
|
|
+ BasicVm.BorderOpacity = Square.Transparency;
|
|
|
+ BasicVm.FillOpacity = Square.Transparency;
|
|
|
+ BasicVm.AnnotThickness = Square.LineWidth;
|
|
|
Dash = Square.LineDash;
|
|
|
SharpsType("Rect",true);
|
|
|
-
|
|
|
+
|
|
|
+ if (Square.LineDash != null && Square.LineDash.Dashes.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var item in Square.LineDash.Dashes)
|
|
|
+ {
|
|
|
+ if (item > 0)
|
|
|
+ {
|
|
|
+ isSolid = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -505,13 +404,26 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (Annot is CircleAnnotArgs)
|
|
|
{
|
|
|
var Circle = Annot as CircleAnnotArgs;
|
|
|
- SelectColor = new SolidColorBrush(Circle.LineColor);
|
|
|
- FillColor = new SolidColorBrush(Circle.BgColor);
|
|
|
- BorderOpacity = Circle.Transparency;
|
|
|
- FillOpacity = Circle.Transparency;
|
|
|
- LineWidth = Circle.LineWidth;
|
|
|
+ BasicVm.BorderColor = new SolidColorBrush(Circle.LineColor);
|
|
|
+ BasicVm.FillColor = new SolidColorBrush(Circle.BgColor);
|
|
|
+ BasicVm.BorderOpacity = Circle.Transparency;
|
|
|
+ BasicVm.FillOpacity = Circle.Transparency;
|
|
|
+ BasicVm.AnnotThickness = Circle.LineWidth;
|
|
|
Dash = Circle.LineDash;
|
|
|
SharpsType("Circle", true);
|
|
|
+
|
|
|
+ if (Circle.LineDash != null && Circle.LineDash.Dashes.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var item in Circle.LineDash.Dashes)
|
|
|
+ {
|
|
|
+ if (item > 0)
|
|
|
+ {
|
|
|
+ isSolid = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -519,22 +431,36 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (Annot is LineAnnotArgs)
|
|
|
{
|
|
|
var line = Annot as LineAnnotArgs;
|
|
|
- SelectColor = new SolidColorBrush(line.LineColor);
|
|
|
- FillColor = new SolidColorBrush(line.LineColor);
|
|
|
- BorderOpacity = line.Transparency;
|
|
|
- FillOpacity = line.Transparency;
|
|
|
- LineWidth = line.LineWidth;
|
|
|
+ BasicVm.BorderColor = new SolidColorBrush(line.LineColor);
|
|
|
+ BasicVm.FillColor = new SolidColorBrush(line.LineColor);
|
|
|
+ BasicVm.BorderOpacity = line.Transparency;
|
|
|
+ BasicVm.FillOpacity = line.Transparency;
|
|
|
+ BasicVm.AnnotThickness = line.LineWidth;
|
|
|
Dash = line.LineDash;
|
|
|
|
|
|
if (line.TailLineType == C_LINE_TYPE.LINETYPE_ARROW && line.HeadLineType == C_LINE_TYPE.LINETYPE_NONE)
|
|
|
SharpsType("Arrow", true);
|
|
|
else
|
|
|
SharpsType("Line", true);
|
|
|
+
|
|
|
+ if (line.LineDash != null && line.LineDash.Dashes.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (var item in line.LineDash.Dashes)
|
|
|
+ {
|
|
|
+ if (item > 0)
|
|
|
+ {
|
|
|
+ isSolid = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
+ BasicVm.SetStrDashStyle(isSolid ? "Solid" : "Dash");
|
|
|
+
|
|
|
}
|
|
|
|
|
|
}
|