|
@@ -35,6 +35,29 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
set => SetProperty(ref _basicVm, value);
|
|
set => SetProperty(ref _basicVm, value);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private bool _isFillFreeText = false;
|
|
|
|
+ public bool IsFillFreeTextAnnot
|
|
|
|
+ {
|
|
|
|
+ get { return _isFillFreeText; }
|
|
|
|
+ set => SetProperty(ref _isFillFreeText, value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private bool _isCheckedTime = false;
|
|
|
|
+ public bool IsCheckedTime
|
|
|
|
+ {
|
|
|
|
+ get { return _isCheckedTime; }
|
|
|
|
+ set => SetProperty(ref _isCheckedTime, value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private ComboDataItem _currrentDateFormat = new ComboDataItem("M/d", "format");
|
|
|
|
+ public ComboDataItem CurrrentDateFormat
|
|
|
|
+ {
|
|
|
|
+ get { return _currrentDateFormat; }
|
|
|
|
+ set => SetProperty(ref _currrentDateFormat, value);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public List<ComboDataItem> DateFormatItems { get; private set; }
|
|
|
|
+
|
|
public AnnotAttribEvent AnnotEvent { get; set; }
|
|
public AnnotAttribEvent AnnotEvent { get; set; }
|
|
private FreeTextAnnotArgs Annot;
|
|
private FreeTextAnnotArgs Annot;
|
|
private AnnotPropertyPanel PropertyPanel;
|
|
private AnnotPropertyPanel PropertyPanel;
|
|
@@ -59,6 +82,9 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
public DelegateCommand ReDefineFontStyleCommand { get; set; }
|
|
public DelegateCommand ReDefineFontStyleCommand { get; set; }
|
|
public DelegateCommand RestoreDefaultStyleCommand { get; set; }
|
|
public DelegateCommand RestoreDefaultStyleCommand { get; set; }
|
|
|
|
|
|
|
|
+ public DelegateCommand DateFormatChangedCommand { get; set; }
|
|
|
|
+ public DelegateCommand ShowTimeCheckedChnagedCommand { get; set; }
|
|
|
|
+
|
|
public event EventHandler<object> LoadPropertyHandler;
|
|
public event EventHandler<object> LoadPropertyHandler;
|
|
|
|
|
|
public FreetextAnnotPropertyViewModel()
|
|
public FreetextAnnotPropertyViewModel()
|
|
@@ -87,15 +113,43 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
//内容对齐
|
|
//内容对齐
|
|
TextAlignCheckedCommand = new DelegateCommand<object>(TextAlignChecked);
|
|
TextAlignCheckedCommand = new DelegateCommand<object>(TextAlignChecked);
|
|
|
|
|
|
|
|
+ //填写与签名:日期
|
|
|
|
+ DateFormatChangedCommand = new DelegateCommand(DateFormatChanged);
|
|
|
|
+ ShowTimeCheckedChnagedCommand = new DelegateCommand(ShowTimeCheckedChnaged);
|
|
//MVP不上
|
|
//MVP不上
|
|
LineModeCheckedCommand = new DelegateCommand<object>(LineMode_Checked);
|
|
LineModeCheckedCommand = new DelegateCommand<object>(LineMode_Checked);
|
|
SelectedOpacityValueCommand = new DelegateCommand<object>(SelectedOpacityValue);
|
|
SelectedOpacityValueCommand = new DelegateCommand<object>(SelectedOpacityValue);
|
|
InitVariable();
|
|
InitVariable();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
private void InitVariable()
|
|
private void InitVariable()
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+ DateFormatItems = new List<ComboDataItem>();
|
|
|
|
+ DateFormatItems = TextFont.GetDateFormats();
|
|
|
|
+ UpdateDateFormatLists();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void UpdateDateFormatLists()
|
|
|
|
+ {
|
|
|
|
+ string strTime = " HH:mm:ss";
|
|
|
|
+ foreach (var item in DateFormatItems)
|
|
|
|
+ {
|
|
|
|
+ if (IsCheckedTime)
|
|
|
|
+ strTime = item.ValueStr + " HH:mm:ss";
|
|
|
|
+ else
|
|
|
|
+ strTime = item.ValueStr;
|
|
|
|
+
|
|
|
|
+ string stadate = System.DateTime.Now.ToString(strTime);
|
|
|
|
+ item.SetContent(stadate);
|
|
|
|
+
|
|
|
|
+ if (CurrrentDateFormat != null && item.ValueStr == CurrrentDateFormat.ValueStr)
|
|
|
|
+ CurrrentDateFormat.SetContent(stadate);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CurrrentDateFormat = new ComboDataItem(CurrrentDateFormat.ValueStr, CurrrentDateFormat.Content);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
@@ -318,6 +372,28 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
// var item = FontStyleList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
|
|
// var item = FontStyleList.FirstOrDefault(temp => temp.mTag == CurrentPresetFont.ValueStr);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void DateFormatChanged()
|
|
|
|
+ {
|
|
|
|
+ if(CurrrentDateFormat != null)
|
|
|
|
+ {
|
|
|
|
+ if (IsCheckedTime)
|
|
|
|
+ UpdateDateFormatLists();
|
|
|
|
+
|
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.NoteText, CurrrentDateFormat.Content);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void ShowTimeCheckedChnaged()
|
|
|
|
+ {
|
|
|
|
+ if (CurrrentDateFormat != null)
|
|
|
|
+ {
|
|
|
|
+ UpdateDateFormatLists();
|
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.NoteText, CurrrentDateFormat.Content);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
{
|
|
{
|
|
return true;
|
|
return true;
|
|
@@ -326,6 +402,7 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
{
|
|
{
|
|
BasicVm.IsMultiSelected = false;
|
|
BasicVm.IsMultiSelected = false;
|
|
|
|
+ // IsCheckedTime = false;
|
|
}
|
|
}
|
|
|
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
@@ -333,11 +410,13 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
navigationContext.Parameters.TryGetValue<AnnotPropertyPanel>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
|
|
navigationContext.Parameters.TryGetValue<AnnotPropertyPanel>(ParameterNames.PropertyPanelContentViewModel, out PropertyPanel);
|
|
if (PropertyPanel != null)
|
|
if (PropertyPanel != null)
|
|
{
|
|
{
|
|
|
|
+
|
|
AnnotEvent = PropertyPanel.AnnotEvent;
|
|
AnnotEvent = PropertyPanel.AnnotEvent;
|
|
Annot = PropertyPanel.annot as FreeTextAnnotArgs;
|
|
Annot = PropertyPanel.annot as FreeTextAnnotArgs;
|
|
LoadPropertyHandler?.Invoke(this, Annot);
|
|
LoadPropertyHandler?.Invoke(this, Annot);
|
|
BasicVm.AnnotTypeTitle = "文字";
|
|
BasicVm.AnnotTypeTitle = "文字";
|
|
BasicVm.IsMultiSelected = PropertyPanel.IsMultiSelected;
|
|
BasicVm.IsMultiSelected = PropertyPanel.IsMultiSelected;
|
|
|
|
+ IsFillFreeTextAnnot = PropertyPanel.IsTextFill;
|
|
if (BasicVm.IsMultiSelected)
|
|
if (BasicVm.IsMultiSelected)
|
|
{
|
|
{
|
|
IsAttributeEquals();
|
|
IsAttributeEquals();
|
|
@@ -347,6 +426,8 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
{
|
|
{
|
|
GetAnnotProperty();
|
|
GetAnnotProperty();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ IsFillFreeTextAnnot = PropertyPanel.IsTextFill;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -473,7 +554,10 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
FontVm.GetCurrentFontFamily(Annot.FontFamily.ToString(), Annot.FontFamily.ToString());
|
|
FontVm.GetCurrentFontFamily(Annot.FontFamily.ToString(), Annot.FontFamily.ToString());
|
|
FontVm.GetFontWeights_Style(Annot.FontStyle, Annot.FontWeight);
|
|
FontVm.GetFontWeights_Style(Annot.FontStyle, Annot.FontWeight);
|
|
|
|
|
|
- string str = "";
|
|
|
|
|
|
+ GetTimeFormat();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ string str = "";
|
|
if (Annot.Align == TextAlignment.Left)
|
|
if (Annot.Align == TextAlignment.Left)
|
|
str = "AlignLeft";
|
|
str = "AlignLeft";
|
|
else if (Annot.Align == TextAlignment.Center)
|
|
else if (Annot.Align == TextAlignment.Center)
|
|
@@ -489,6 +573,63 @@ namespace PDF_Office.ViewModels.PropertyPanel.AnnotPanel
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void GetTimeFormat()
|
|
|
|
+ {
|
|
|
|
+ if (IsFillFreeTextAnnot == false)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ if(string.IsNullOrEmpty(Annot.TextContent))
|
|
|
|
+ {
|
|
|
|
+ if (CurrrentDateFormat != null)
|
|
|
|
+ {
|
|
|
|
+ if (IsCheckedTime)
|
|
|
|
+ UpdateDateFormatLists();
|
|
|
|
+
|
|
|
|
+ PropertyPanel.UpdateAnnotAAttrib(AnnotAttrib.NoteText, CurrrentDateFormat.Content);
|
|
|
|
+ }
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ DateTime dtDate;
|
|
|
|
+ bool isTime = false;
|
|
|
|
+ foreach (var item in DateFormatItems)
|
|
|
|
+ {
|
|
|
|
+ var strFormat = "";
|
|
|
|
+ var strArr = Annot.TextContent.Split(' ');
|
|
|
|
+ if (strArr != null && strArr.Count() == 2)
|
|
|
|
+ {
|
|
|
|
+ strFormat = item.ValueStr + " HH:mm:ss";
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ strFormat = item.ValueStr;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (DateTime.TryParseExact(Annot.TextContent, strFormat, System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.AdjustToUniversal, out dtDate))
|
|
|
|
+ {
|
|
|
|
+ if (strArr != null && strArr.Count() == 2)
|
|
|
|
+ {
|
|
|
|
+ isTime = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ foreach (var item2 in DateFormatItems)
|
|
|
|
+ {
|
|
|
|
+ string stadate = System.DateTime.Now.ToString(strFormat);
|
|
|
|
+ item.SetContent(stadate);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ CurrrentDateFormat = new ComboDataItem(item.ValueStr, item.Content);
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ IsCheckedTime = isTime;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|