|
@@ -14,6 +14,8 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using System.Windows;
|
|
|
+using System.Windows.Controls;
|
|
|
using System.Windows.Media;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.Form
|
|
@@ -46,7 +48,7 @@ namespace PDF_Office.ViewModels.Form
|
|
|
public bool IsMultiLine
|
|
|
{
|
|
|
get { return _isMultiline; }
|
|
|
- set { SetProperty(ref _isMultiline, value); }
|
|
|
+ set { SetProperty(ref _isMultiline, value); ChangeFieldValue("IsMultiLine"); }
|
|
|
}
|
|
|
|
|
|
//滚动显示长文本
|
|
@@ -54,11 +56,75 @@ namespace PDF_Office.ViewModels.Form
|
|
|
public bool IsScrollText
|
|
|
{
|
|
|
get { return _isScrollText; }
|
|
|
- set { SetProperty(ref _isScrollText, value); }
|
|
|
+ set { SetProperty(ref _isScrollText, value); ChangeFieldValue("IsScrollText"); }
|
|
|
}
|
|
|
|
|
|
+ private ResetColor _resetColorOne = new ResetColor();
|
|
|
+ public ResetColor ResetColorOne
|
|
|
+ {
|
|
|
+ get { return _resetColorOne; }
|
|
|
+ set { SetProperty(ref _resetColorOne, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private ResetColor _resetColorTwo = new ResetColor();
|
|
|
+ public ResetColor ResetColorTwo
|
|
|
+ {
|
|
|
+ get { return _resetColorTwo; }
|
|
|
+ set { SetProperty(ref _resetColorTwo, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private ResetColor _resetColorThree = new ResetColor();
|
|
|
+ public ResetColor ResetColorThree
|
|
|
+ {
|
|
|
+ get { return _resetColorThree; }
|
|
|
+ set { SetProperty(ref _resetColorThree, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private ResetColor _resetColorForth = new ResetColor();
|
|
|
+ public ResetColor ResetColorForth
|
|
|
+ {
|
|
|
+ get { return _resetColorForth; }
|
|
|
+ set { SetProperty(ref _resetColorForth, value); }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
+ private FontFamily _fontFamily;
|
|
|
+ public FontFamily FontFamilyItem
|
|
|
+ {
|
|
|
+ get { return _fontFamily; }
|
|
|
+ set { SetProperty(ref _fontFamily, value); ChangeFieldValue("FontFamilyItem"); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private FontStyle _fontStyle;
|
|
|
+ public FontStyle FontStyleItem
|
|
|
+ {
|
|
|
+ get { return _fontStyle; }
|
|
|
+ set { SetProperty(ref _fontStyle, value); ChangeFieldValue("FontStyleItem"); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private FontWeight _fontWeight;
|
|
|
+ public FontWeight FontWeightItem
|
|
|
+ {
|
|
|
+ get { return _fontWeight; }
|
|
|
+ set { SetProperty(ref _fontWeight, value); ChangeFieldValue("FontWeightItem"); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private C_TEXT_ALIGNMENT _textAlignment;
|
|
|
+ public C_TEXT_ALIGNMENT TextAlignmentItem
|
|
|
+ {
|
|
|
+ get { return _textAlignment; }
|
|
|
+ set { SetProperty(ref _textAlignment, value); ChangeFieldValue("TextAlignmentItem"); }
|
|
|
+ }
|
|
|
+
|
|
|
+ private string _content;
|
|
|
+ public string FormContent
|
|
|
+ {
|
|
|
+ get { return _content; }
|
|
|
+ set { SetProperty(ref _content, value); ChangeFieldValue("FormContent"); }
|
|
|
+ }
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region Command变量
|
|
@@ -70,8 +136,17 @@ namespace PDF_Office.ViewModels.Form
|
|
|
|
|
|
//外观
|
|
|
public DelegateCommand<object> ThicknessChangedCommand { get; set; }
|
|
|
-
|
|
|
|
|
|
+ public DelegateCommand<object> ResetColorCommand { get; set; }
|
|
|
+ public DelegateCommand<object> ResetColorCheckedBtnCommand { get; set; }
|
|
|
+ public DelegateCommand<object> FontFamilyChangedCommand { get; set; }
|
|
|
+ public DelegateCommand<object> FontStyleChangedCommand { get; set; }
|
|
|
+
|
|
|
+ public DelegateCommand<object> AlignmentChangedCommand { get; set; }
|
|
|
+ public DelegateCommand<string> FormContentTextChangedCommand { get; set; }
|
|
|
+
|
|
|
+ public DelegateCommand<object> IsMultiLineCheckedCommand { get; set; }
|
|
|
+ public DelegateCommand<object> IsScrollToDisplayCheckedCommand { get; set; }
|
|
|
#endregion
|
|
|
|
|
|
#region 变量
|
|
@@ -80,6 +155,7 @@ namespace PDF_Office.ViewModels.Form
|
|
|
private WidgetTextBoxArgs textBoxArgs;
|
|
|
private bool IsCurrentWidget = false;
|
|
|
private IDialogService dialogs;
|
|
|
+
|
|
|
#endregion
|
|
|
|
|
|
#region 初始化
|
|
@@ -92,7 +168,32 @@ namespace PDF_Office.ViewModels.Form
|
|
|
|
|
|
private void InitVariable()
|
|
|
{
|
|
|
+ ResetColorOne = new ResetColor() {
|
|
|
+ BorderColor = new SolidColorBrush(Colors.Transparent),
|
|
|
+ FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
|
|
|
+ FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
|
|
|
+ };
|
|
|
+
|
|
|
+ ResetColorTwo = new ResetColor()
|
|
|
+ {
|
|
|
+ BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
|
|
|
+ FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
|
|
|
+ FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00))
|
|
|
+ };
|
|
|
|
|
|
+ ResetColorThree = new ResetColor()
|
|
|
+ {
|
|
|
+ BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
|
|
|
+ FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0x00, 0x00, 0x00)),
|
|
|
+ FillColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xBD, 0xDF, 0xFD))
|
|
|
+ };
|
|
|
+
|
|
|
+ ResetColorForth = new ResetColor()
|
|
|
+ {
|
|
|
+ BorderColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
|
|
|
+ FontColor = new SolidColorBrush(Color.FromArgb(0xFF, 0xff, 0x00, 0x00)),
|
|
|
+ FillColor = new SolidColorBrush(Colors.Transparent)
|
|
|
+ };
|
|
|
}
|
|
|
|
|
|
private void InitCommand()
|
|
@@ -103,16 +204,190 @@ namespace PDF_Office.ViewModels.Form
|
|
|
RequiredFieldCheckedCommand = new DelegateCommand<object>(RequiredFieldChecked);
|
|
|
//外观
|
|
|
ThicknessChangedCommand = new DelegateCommand<object>(ThicknessChanged);
|
|
|
+ ResetColorCommand = new DelegateCommand<object>(ResetColorEvent);
|
|
|
|
|
|
+ ResetColorCheckedBtnCommand = new DelegateCommand<object>(ResetColorCheckedBtn);
|
|
|
+ FontFamilyChangedCommand = new DelegateCommand<object>(FontFamilyChanged);
|
|
|
+ FontStyleChangedCommand = new DelegateCommand<object>(FontStyleChanged);
|
|
|
+ AlignmentChangedCommand = new DelegateCommand<object>(AlignmentChanged);
|
|
|
+ FormContentTextChangedCommand = new DelegateCommand<string>(FormContentTextChanged);
|
|
|
+
|
|
|
+ IsMultiLineCheckedCommand = new DelegateCommand<object>(IsMultiLineChecked);
|
|
|
+ IsScrollToDisplayCheckedCommand = new DelegateCommand<object>(IsScrollToDisplayChecked);
|
|
|
ChangeValueHandler -= ChangeValue;
|
|
|
ChangeValueHandler += ChangeValue;
|
|
|
}
|
|
|
|
|
|
+ private void IsScrollToDisplayChecked(object obj)
|
|
|
+ {
|
|
|
+ if(obj != null)
|
|
|
+ {
|
|
|
+ IsScrollText = (bool)obj;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void IsMultiLineChecked(object obj)
|
|
|
+ {
|
|
|
+ if (obj != null)
|
|
|
+ {
|
|
|
+ IsMultiLine = (bool)obj;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void FormContentTextChanged(string obj)
|
|
|
+ {
|
|
|
+ if(obj != null)
|
|
|
+ {
|
|
|
+ FormContent = obj;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void AlignmentChanged(object obj)
|
|
|
+ {
|
|
|
+ if (obj != null)
|
|
|
+ {
|
|
|
+ var combo = (ComboBoxItem)obj;
|
|
|
+ if (combo != null)
|
|
|
+ {
|
|
|
+ switch (combo.Content)
|
|
|
+ {
|
|
|
+ case "Left":
|
|
|
+ TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_LEFT;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Center":
|
|
|
+ TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_CENTER;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Right":
|
|
|
+ TextAlignmentItem = C_TEXT_ALIGNMENT.ALIGNMENT_RIGHT;
|
|
|
+ break;
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void FontStyleChanged(object obj)
|
|
|
+ {
|
|
|
+ if(obj != null)
|
|
|
+ {
|
|
|
+ var combo = (ComboBoxItem)obj;
|
|
|
+ if(combo != null)
|
|
|
+ {
|
|
|
+ switch(combo.Content)
|
|
|
+ {
|
|
|
+ case "Regular":
|
|
|
+ FontStyleItem = FontStyles.Normal;
|
|
|
+ FontWeightItem = FontWeights.Normal;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Bold":
|
|
|
+ FontStyleItem = FontStyles.Normal;
|
|
|
+ FontWeightItem = FontWeights.Bold;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Italic":
|
|
|
+ FontStyleItem = FontStyles.Italic;
|
|
|
+ FontWeightItem = FontWeights.Normal;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Bold Italic":
|
|
|
+ FontStyleItem = FontStyles.Italic;
|
|
|
+ FontWeightItem = FontWeights.Bold;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void FontFamilyChanged(object obj)
|
|
|
+ {
|
|
|
+ if(obj!= null)
|
|
|
+ {
|
|
|
+ switch((int)obj)
|
|
|
+ {
|
|
|
+ case 0:
|
|
|
+ FontFamilyItem = new FontFamily("Courier");
|
|
|
+ break;
|
|
|
+ case 1:
|
|
|
+ FontFamilyItem = new FontFamily("Helvetica");
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ FontFamilyItem = new FontFamily("Times Roman");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ResetColorCheckedBtn(object obj)
|
|
|
+ {
|
|
|
+ if(obj != null)
|
|
|
+ {
|
|
|
+ var str = obj as string;
|
|
|
+ if(str != null)
|
|
|
+ {
|
|
|
+ switch(str)
|
|
|
+ {
|
|
|
+ case "One":
|
|
|
+ BorderColor = ResetColorOne.BorderColor.Color;
|
|
|
+ ContentColor = ResetColorOne.FontColor.Color;
|
|
|
+
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Two":
|
|
|
+ BorderColor = ResetColorTwo.BorderColor.Color;
|
|
|
+ ContentColor = ResetColorTwo.FontColor.Color;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Three":
|
|
|
+ BorderColor = ResetColorThree.BorderColor.Color;
|
|
|
+ ContentColor = ResetColorThree.FontColor.Color;
|
|
|
+ break;
|
|
|
+
|
|
|
+ case "Forth":
|
|
|
+ BorderColor = ResetColorForth.BorderColor.Color;
|
|
|
+ ContentColor = ResetColorForth.FontColor.Color;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ResetColorEvent(object obj)
|
|
|
+ {
|
|
|
+ //if(obj != null && (ResetColor)obj != null)
|
|
|
+ // {
|
|
|
+ // var resetcolor = obj as ResetColor;
|
|
|
+
|
|
|
+ // }
|
|
|
+
|
|
|
+ bool result = true;
|
|
|
+ DialogParameters value = new DialogParameters();
|
|
|
+ value.Add(ParameterNames.PDFViewer, PDFViewer);
|
|
|
+ dialogs.ShowDialog(DialogNames.EditPresetColorsDialog, value, e =>
|
|
|
+ {
|
|
|
+ if (e.Result != ButtonResult.OK)
|
|
|
+ {
|
|
|
+ result = false;
|
|
|
+ }
|
|
|
+ EditPresetColorsDialogViewModel DialogVM = e.Parameters.GetValue<EditPresetColorsDialogViewModel>(ParameterNames.DataModel);
|
|
|
+ if (DialogVM != null)
|
|
|
+ {
|
|
|
+ // CreateSignature(DialogVM);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!result)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private void ThicknessChanged(object obj)
|
|
|
{
|
|
|
if(obj != null)
|
|
|
{
|
|
|
- var str = (double)obj;
|
|
|
+ BorderThiness = (double)obj;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -253,8 +528,8 @@ namespace PDF_Office.ViewModels.Form
|
|
|
break;
|
|
|
|
|
|
case FormAttributeType.HeightSize:
|
|
|
- // textBoxArgs.DefaultWidth = HeightSize;
|
|
|
- //AttribEvent?.UpdateAttrib(, BorderThiness);
|
|
|
+ textBoxArgs.DefaultWidth = HeightSize;
|
|
|
+ // AttribEvent?.UpdateAttrib(AnnotAttrib.h, HeightSize);
|
|
|
break;
|
|
|
|
|
|
case FormAttributeType.BorderThiness:
|
|
@@ -300,6 +575,34 @@ namespace PDF_Office.ViewModels.Form
|
|
|
textBoxArgs.FormField = FormField.Visible;
|
|
|
AttribEvent?.UpdateAttrib(AnnotAttrib.FormField,FormPos);
|
|
|
break;
|
|
|
+ case "FontFamilyItem":
|
|
|
+ textBoxArgs.FontFamily = FontFamilyItem.Source;
|
|
|
+ AttribEvent?.UpdateAttrib(AnnotAttrib.FontFamily, FontFamilyItem.Source);
|
|
|
+ break;
|
|
|
+ case "FontStyleItem":
|
|
|
+ textBoxArgs.FontStyle = FontStyleItem;
|
|
|
+ AttribEvent?.UpdateAttrib(AnnotAttrib.FontStyle, FontStyleItem);
|
|
|
+ break;
|
|
|
+ case "FontWeightItem":
|
|
|
+ textBoxArgs.FontWeight = FontWeightItem;
|
|
|
+ AttribEvent?.UpdateAttrib(AnnotAttrib.FontWeight, FontWeightItem);
|
|
|
+ break;
|
|
|
+ case "TextAlignmentItem":
|
|
|
+ textBoxArgs.Alignment = TextAlignmentItem;
|
|
|
+ AttribEvent?.UpdateAttrib(AnnotAttrib.TextAlign, TextAlignmentItem);
|
|
|
+ break;
|
|
|
+ case "FormContent":
|
|
|
+ textBoxArgs.Content = FormContent;
|
|
|
+ AttribEvent?.UpdateAttrib(AnnotAttrib.Text, FormContent);
|
|
|
+ break;
|
|
|
+ case "IsScrollText":
|
|
|
+ textBoxArgs.ScrollFlag = IsScrollText;
|
|
|
+ AttribEvent?.UpdateAttrib(AnnotAttrib.ScrollFlag, IsScrollText);
|
|
|
+ break;
|
|
|
+ case "IsMultiLine":
|
|
|
+ textBoxArgs.IsMultiLine = IsMultiLine;
|
|
|
+ AttribEvent?.UpdateAttrib(AnnotAttrib.IsMutilLine, IsMultiLine);
|
|
|
+ break;
|
|
|
}
|
|
|
AttribEvent?.UpdateAnnot();
|
|
|
}
|