|
@@ -1,4 +1,7 @@
|
|
|
-using Prism.Commands;
|
|
|
+using ComPDFKitViewer;
|
|
|
+using ComPDFKitViewer.AnnotEvent;
|
|
|
+using PDF_Office.Model;
|
|
|
+using Prism.Commands;
|
|
|
using Prism.Mvvm;
|
|
|
using Prism.Services.Dialogs;
|
|
|
using System;
|
|
@@ -6,6 +9,8 @@ using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
|
using System.Text;
|
|
|
using System.Threading.Tasks;
|
|
|
+using System.Windows;
|
|
|
+using System.Windows.Media;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.Dialog.Redaction
|
|
|
{
|
|
@@ -15,16 +20,190 @@ namespace PDF_Office.ViewModels.Dialog.Redaction
|
|
|
|
|
|
public event Action<IDialogResult> RequestClose;
|
|
|
|
|
|
+ private RedactionAnnotArgs annotArgs;
|
|
|
public DelegateCommand OkCommand { get; set; }
|
|
|
|
|
|
public DelegateCommand CancelCommand { get; set; }
|
|
|
|
|
|
+ public DelegateCommand<string> AlignCommand { get; set; }
|
|
|
+
|
|
|
+
|
|
|
+ private Color lineColor;
|
|
|
+
|
|
|
+ public Color LineColor
|
|
|
+ {
|
|
|
+ get { return lineColor; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref lineColor, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Color bgColor;
|
|
|
+
|
|
|
+ public Color BgColor
|
|
|
+ {
|
|
|
+ get { return bgColor; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref bgColor, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private Color fontColor;
|
|
|
+
|
|
|
+ public Color FontColor
|
|
|
+ {
|
|
|
+ get { return fontColor; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref fontColor, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private bool isUserText;
|
|
|
+
|
|
|
+ public bool IsUseText
|
|
|
+ {
|
|
|
+ get { return isUserText; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref isUserText, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool leftChecked = true;
|
|
|
+
|
|
|
+ public bool LeftChecked
|
|
|
+ {
|
|
|
+ get { return leftChecked; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref leftChecked, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool centerChecked;
|
|
|
+
|
|
|
+ public bool CenterChecked
|
|
|
+ {
|
|
|
+ get { return centerChecked; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref centerChecked, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private bool rightChecked;
|
|
|
+
|
|
|
+ public bool RightChecked
|
|
|
+ {
|
|
|
+ get { return rightChecked; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref rightChecked, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private bool strechChecked;
|
|
|
+
|
|
|
+ public bool StrechChecked
|
|
|
+ {
|
|
|
+ get { return strechChecked; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref strechChecked, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private string overText;
|
|
|
+
|
|
|
+ public string OvertText
|
|
|
+ {
|
|
|
+ get { return overText; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref overText, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private int fontFamilySelectedIndex;
|
|
|
+
|
|
|
+ public int FontFamilySelectedIndex
|
|
|
+ {
|
|
|
+ get { return fontFamilySelectedIndex; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref fontFamilySelectedIndex, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private string fontFamily = "";
|
|
|
+
|
|
|
+ private int fontWeightSelectedIndex;
|
|
|
+
|
|
|
+ public int FontWeightSelectedIndex
|
|
|
+ {
|
|
|
+ get { return fontWeightSelectedIndex; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref fontWeightSelectedIndex, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private FontWeight fontWeight = FontWeights.Regular;
|
|
|
+
|
|
|
+ private int fontSizeSelectedIndex;
|
|
|
+
|
|
|
+ public int FontSizeSelectedIndex
|
|
|
+ {
|
|
|
+ get { return fontSizeSelectedIndex; }
|
|
|
+ set
|
|
|
+ {
|
|
|
+ SetProperty(ref fontSizeSelectedIndex, value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public List<string> FontFamilys { get; set; }
|
|
|
+
|
|
|
+ public List<string> FontWeight { get; set; }
|
|
|
+
|
|
|
+ public List<string> FontSizes { get; set; }
|
|
|
+
|
|
|
|
|
|
|
|
|
public MarkSettingDialogViewModel()
|
|
|
{
|
|
|
OkCommand = new DelegateCommand(ok);
|
|
|
CancelCommand = new DelegateCommand(cancel);
|
|
|
+ AlignCommand = new DelegateCommand<string>(align);
|
|
|
+
|
|
|
+ InitFontFamily();
|
|
|
+ InitFontWeight();
|
|
|
+ InitFontSize();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void InitFontFamily()
|
|
|
+ {
|
|
|
+ FontFamilys.Add("Courier New");
|
|
|
+ FontFamilys.Add("Arial");
|
|
|
+ FontFamilys.Add("Times New Roman");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void InitFontWeight()
|
|
|
+ {
|
|
|
+ FontWeight.Add("Regular");
|
|
|
+ FontWeight.Add("Bold");
|
|
|
+ FontWeight.Add("Italic");
|
|
|
+ FontWeight.Add("Bold Italic");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void InitFontSize()
|
|
|
+ {
|
|
|
+ FontSizes.Add("Auto");
|
|
|
}
|
|
|
|
|
|
private void cancel()
|
|
@@ -34,7 +213,26 @@ namespace PDF_Office.ViewModels.Dialog.Redaction
|
|
|
|
|
|
private void ok()
|
|
|
{
|
|
|
-
|
|
|
+ //annotArgs.UpdateAttrib(AnnotAttrib.FillColor, frm.SaveredactionArgs.BgColor);
|
|
|
+ //annotArgs.UpdateAttrib(AnnotAttrib.NoteText, frm.SaveredactionArgs.Content);
|
|
|
+ //annotArgs.UpdateAttrib(AnnotAttrib.FontColor, frm.SaveredactionArgs.FontColor);
|
|
|
+
|
|
|
+ //annotArgs.UpdateAttrib(AnnotAttrib.Color, frm.SaveredactionArgs.LineColor);
|
|
|
+
|
|
|
+ //annotArgs.UpdateAttrib(AnnotAttrib.FontSize, frm.SaveredactionArgs.FontSize);
|
|
|
+
|
|
|
+ //annotArgs.UpdateAttrib(AnnotAttrib.TextAlign, frm.SaveredactionArgs.Align);
|
|
|
+ //if (IsUseText)
|
|
|
+ //{
|
|
|
+ // annotArgs.UpdateAttrib(AnnotAttrib.NoteText, string.Empty);
|
|
|
+ //}
|
|
|
+ //annotArgs.UpdateAnnot();
|
|
|
+ RequestClose.Invoke(new DialogResult(ButtonResult.OK));
|
|
|
+ }
|
|
|
+
|
|
|
+ private void align(string tag)
|
|
|
+ {
|
|
|
+
|
|
|
}
|
|
|
|
|
|
public bool CanCloseDialog()
|
|
@@ -49,7 +247,29 @@ namespace PDF_Office.ViewModels.Dialog.Redaction
|
|
|
|
|
|
public void OnDialogOpened(IDialogParameters parameters)
|
|
|
{
|
|
|
-
|
|
|
+ annotArgs = parameters.GetValue<RedactionAnnotArgs>(ParameterNames.DataModel);
|
|
|
+
|
|
|
+ BgColor = annotArgs.BgColor;
|
|
|
+ LineColor = annotArgs.LineColor;
|
|
|
+ FontColor = annotArgs.FontColor;
|
|
|
+
|
|
|
+ OvertText = annotArgs.Content;
|
|
|
+ switch (annotArgs.FontFamily.ToString())
|
|
|
+ {
|
|
|
+ case "":
|
|
|
+ FontFamilySelectedIndex = 0;
|
|
|
+ break;
|
|
|
+ case "1":
|
|
|
+ FontFamilySelectedIndex = 1;
|
|
|
+ break;
|
|
|
+ case "2":
|
|
|
+ FontFamilySelectedIndex = 2;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
}
|