|
@@ -24,7 +24,6 @@ using System.Windows.Media;
|
|
|
|
|
|
namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
-
|
|
|
public class DashStyleConverter : IValueConverter
|
|
|
{
|
|
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
|
@@ -52,10 +51,13 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
throw new NotImplementedException();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public class SharpsAnnotPropertyViewModel : BindableBase, INavigationAware
|
|
|
{
|
|
|
#region 属性
|
|
|
+
|
|
|
private bool isRect = false;
|
|
|
+
|
|
|
public bool IsRect
|
|
|
{
|
|
|
get { return isRect; }
|
|
@@ -63,6 +65,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private bool isCircle = false;
|
|
|
+
|
|
|
public bool IsCircle
|
|
|
{
|
|
|
get { return isCircle; }
|
|
@@ -70,6 +73,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private bool isArrow = false;
|
|
|
+
|
|
|
public bool IsArrow
|
|
|
{
|
|
|
get { return isArrow; }
|
|
@@ -77,6 +81,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private bool isLine = false;
|
|
|
+
|
|
|
public bool IsLine
|
|
|
{
|
|
|
get { return isLine; }
|
|
@@ -93,9 +98,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
SetProperty(ref _strShapeChecked, value);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
public List<ComboDataItem> ThicknessItems { get; protected set; }
|
|
|
|
|
|
private AnnotCommon _basicVm = new AnnotCommon();
|
|
|
+
|
|
|
public AnnotCommon BasicVm
|
|
|
{
|
|
|
get { return _basicVm; }
|
|
@@ -103,6 +110,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private Geometry dataPath = null;
|
|
|
+
|
|
|
public Geometry DataPath
|
|
|
{
|
|
|
get { return dataPath; }
|
|
@@ -113,6 +121,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private DashStyle dash = new DashStyle();
|
|
|
+
|
|
|
public DashStyle Dash
|
|
|
{
|
|
|
get { return dash; }
|
|
@@ -123,6 +132,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
|
|
|
private bool _isLineAnnot = false;
|
|
|
+
|
|
|
public bool IsLineAnnot
|
|
|
{
|
|
|
get { return _isLineAnnot; }
|
|
@@ -132,7 +142,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- #endregion
|
|
|
+ #endregion 属性
|
|
|
|
|
|
public DelegateCommand<object> SelectedThickCommand { get; set; }
|
|
|
public DelegateCommand<object> SelectedBorderColorCommand { get; set; }
|
|
@@ -146,8 +156,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
public DelegateCommand<object> ThicknessChangedCommand { get; set; }
|
|
|
public DelegateCommand<object> SelectedOpacityValueCommand { get; set; }
|
|
|
|
|
|
-
|
|
|
public event EventHandler<object> LoadPropertyHandler;
|
|
|
+
|
|
|
public SharpsAnnotPropertyViewModel()
|
|
|
{
|
|
|
InitColorItems();
|
|
@@ -225,6 +235,8 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
DataPath = rectPath;
|
|
|
changeData[AnnotArgsType.AnnotSquare] = tag;
|
|
|
IsLineAnnot = false;
|
|
|
+ if (IsRect == false)
|
|
|
+ IsRect = true;
|
|
|
break;
|
|
|
|
|
|
case "Circle":
|
|
@@ -235,11 +247,12 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
DataPath = circlePath;
|
|
|
changeData[AnnotArgsType.AnnotCircle] = tag;
|
|
|
IsLineAnnot = false;
|
|
|
+ if (IsCircle == false)
|
|
|
+ IsCircle = true;
|
|
|
break;
|
|
|
|
|
|
case "Arrow":
|
|
|
{
|
|
|
-
|
|
|
ArrowHelper arrowLine = new ArrowHelper();
|
|
|
arrowLine.ArrowLength = 8;
|
|
|
arrowLine.LineStart = new Point(8, 24);
|
|
@@ -248,7 +261,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
arrowLine.EndSharp = C_LINE_TYPE.LINETYPE_ARROW;
|
|
|
DataPath = arrowLine.BuildArrowBody();
|
|
|
changeData[AnnotArgsType.AnnotLine] = tag;
|
|
|
- IsLineAnnot = true;
|
|
|
+ if (IsLineAnnot == false)
|
|
|
+ IsLineAnnot = true;
|
|
|
+ if (isArrow == false)
|
|
|
+ isArrow = true;
|
|
|
// changeData[AnnotArgsType.AnnotLine] = tag;
|
|
|
}
|
|
|
|
|
@@ -261,7 +277,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
arrowLine.LineEnd = new Point(32, 0);
|
|
|
DataPath = arrowLine.BuildArrowBody();
|
|
|
changeData[AnnotArgsType.AnnotLine] = tag;
|
|
|
- IsLineAnnot = true;
|
|
|
+ if (IsLineAnnot == false)
|
|
|
+ IsLineAnnot = true;
|
|
|
+ if (IsLine == false)
|
|
|
+ IsLine = true;
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -271,6 +290,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
PropertyPanel.AnnotTypeChangedInvoke(this, changeData);
|
|
|
|
|
|
StrShapeChecked = tag;
|
|
|
+ PropertyPanel.SharpsAnnot = tag;
|
|
|
BasicVm.SetOtherTag(tag);
|
|
|
}
|
|
|
|
|
@@ -301,8 +321,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
private void SelectedFillColor_Command(object obj)
|
|
|
{
|
|
|
if (obj != null && PropertyPanel != null)
|
|
@@ -318,8 +336,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void SelectedFillOpacity_Command(object obj)
|
|
@@ -331,9 +347,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
|
|
|
PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, BasicVm.FillOpacity);
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void SelectedOpacityValue(object obj)
|
|
@@ -346,14 +360,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.Transparency, BasicVm.FillOpacity);
|
|
|
PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, BasicVm.FillOpacity);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
private void SelectedBorderColor(object obj)
|
|
|
{
|
|
|
-
|
|
|
if (obj != null && PropertyPanel != null)
|
|
|
{
|
|
|
var colorValue = (Color)obj;
|
|
@@ -367,7 +377,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
PropertyPanel.InvokeToMyTools(BasicVm.AnnotType, Annot);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private void SelectedThick_Command(object obj)
|
|
@@ -400,9 +409,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
case AnnotArgsType.AnnotCircle:
|
|
|
BasicVm.AnnotTypeTitle = "圆";
|
|
|
break;
|
|
|
+
|
|
|
case AnnotArgsType.AnnotSquare:
|
|
|
BasicVm.AnnotTypeTitle = "矩形";
|
|
|
break;
|
|
|
+
|
|
|
case AnnotArgsType.AnnotLine:
|
|
|
|
|
|
var annotLine = Annot as LineAnnotArgs;
|
|
@@ -415,12 +426,12 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
public AnnotAttribEvent AnnotEvent { get; set; }
|
|
|
private AnnotHandlerEventArgs Annot;
|
|
|
private AnnotTransfer PropertyPanel;
|
|
|
+
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
{
|
|
|
navigationContext.Parameters.TryGetValue<AnnotTransfer>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
|
|
@@ -441,7 +452,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
LoadPropertyHandler?.Invoke(null, Annot);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
private List<SquareAnnotArgs> ConvertLists()
|
|
@@ -461,6 +471,7 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
else
|
|
|
return FreeTextLists;
|
|
|
}
|
|
|
+
|
|
|
private void IsAttributeEquals()
|
|
|
{
|
|
|
var list = ConvertLists();
|
|
@@ -491,12 +502,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
if (temp.LineColor.A != item.LineColor.A || temp.LineColor.R != item.LineColor.R || temp.LineColor.G != item.LineColor.G || temp.LineColor.B != item.LineColor.B)
|
|
|
{
|
|
|
- BasicVm.BorderColor = new SolidColorBrush(Color.FromArgb(0x01,0xff,0xff,0xff));
|
|
|
+ BasicVm.BorderColor = new SolidColorBrush(Color.FromArgb(0x01, 0xff, 0xff, 0xff));
|
|
|
isNoEqualsDir["LineColor"] = true;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (isNoEqualsDir["Thickness"] == false)
|
|
|
{
|
|
|
isNoEqualsDir["Thickness"] = true;
|
|
@@ -523,13 +533,11 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
if (isNoEqualsDir["FillColor"] == false)
|
|
|
{
|
|
|
BasicVm.FillColor = new SolidColorBrush(temp.BgColor);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (isNoEqualsDir["LineColor"] == false)
|
|
|
{
|
|
|
BasicVm.BorderColor = new SolidColorBrush(temp.LineColor);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
if (isNoEqualsDir["Thickness"] == false)
|
|
@@ -547,11 +555,9 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
BasicVm.IsSolidLine = isSolid;
|
|
|
BasicVm.IsDashLine = !isSolid;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
private bool IsSolidStyle(AnnotHandlerEventArgs annot)
|
|
|
{
|
|
|
bool isSolid = true;
|
|
@@ -594,7 +600,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
SharpsType("Rect", true);
|
|
|
BasicVm.AnnotTypeTitle = "矩形";
|
|
|
IsLineAnnot = false;
|
|
|
- IsRect = true;
|
|
|
+ //IsRect = true;
|
|
|
+ //IsCircle = false;
|
|
|
+ //IsArrow=false;
|
|
|
+ //IsLine= false;
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -611,7 +620,10 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
SharpsType("Circle", true);
|
|
|
BasicVm.AnnotTypeTitle = "圆";
|
|
|
IsLineAnnot = false;
|
|
|
- IsCircle = true;
|
|
|
+ //IsCircle = true;
|
|
|
+ //IsRect = false;
|
|
|
+ //IsArrow = false;
|
|
|
+ //IsLine = false;
|
|
|
}
|
|
|
break;
|
|
|
|
|
@@ -630,17 +642,22 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
{
|
|
|
SharpsType("Arrow", true);
|
|
|
BasicVm.AnnotTypeTitle = "箭头";
|
|
|
- IsArrow = true;
|
|
|
+ //IsArrow = true;
|
|
|
+ //IsCircle = false;
|
|
|
+ //IsRect = false;
|
|
|
+ //IsLine = false;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
SharpsType("Line", true);
|
|
|
BasicVm.AnnotTypeTitle = "线条";
|
|
|
- IsLine = true;
|
|
|
+ //IsLine = true;
|
|
|
+ //IsCircle = false;
|
|
|
+ //IsRect = false;
|
|
|
+ //IsArrow = false;
|
|
|
}
|
|
|
|
|
|
IsLineAnnot = true;
|
|
|
-
|
|
|
}
|
|
|
|
|
|
break;
|
|
@@ -650,9 +667,6 @@ namespace PDF_Master.ViewModels.PropertyPanel.AnnotPanel
|
|
|
BasicVm.IsSolidLine = isSolid;
|
|
|
BasicVm.IsDashLine = !isSolid;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
-}
|
|
|
+}
|