|
@@ -1,18 +1,24 @@
|
|
using ComPDFKit.PDFWatermark;
|
|
using ComPDFKit.PDFWatermark;
|
|
|
|
+using ComPDFKitViewer.PdfViewer;
|
|
|
|
+using PDF_Office.CustomControl;
|
|
using PDF_Office.Helper;
|
|
using PDF_Office.Helper;
|
|
using PDF_Office.Model.EditTools.Watermark;
|
|
using PDF_Office.Model.EditTools.Watermark;
|
|
|
|
+using PDF_Office.Model.PageEdit;
|
|
using Prism.Commands;
|
|
using Prism.Commands;
|
|
using Prism.Mvvm;
|
|
using Prism.Mvvm;
|
|
using Prism.Regions;
|
|
using Prism.Regions;
|
|
using System;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
|
+using System.Diagnostics;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
|
|
|
namespace PDF_Office.ViewModels.EditTools.Watermark
|
|
namespace PDF_Office.ViewModels.EditTools.Watermark
|
|
{
|
|
{
|
|
- public class WatermarkCreateFileContentViewModel : BindableBase,INavigationAware
|
|
|
|
|
|
+ public class WatermarkCreateFileContentViewModel : BindableBase, INavigationAware
|
|
{
|
|
{
|
|
- public WatermarkInfo WatermarkInfo { get; set; } = new WatermarkInfo();
|
|
|
|
|
|
+ public WatermarkInfo WatermarkInfo = new WatermarkInfo();
|
|
|
|
+
|
|
|
|
+ public CPDFViewer currentViewer;
|
|
|
|
|
|
private List<string> _opacityList = new List<string>();
|
|
private List<string> _opacityList = new List<string>();
|
|
public List<string> OpacityList
|
|
public List<string> OpacityList
|
|
@@ -164,6 +170,19 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public string PageRangeText{get;set;} = "0";
|
|
|
|
+
|
|
|
|
+ private int _pageRangeSelectIndex = 0;
|
|
|
|
+ public int PageRangeSelectIndex
|
|
|
|
+ {
|
|
|
|
+ get { return _pageRangeSelectIndex; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _pageRangeSelectIndex, value);
|
|
|
|
+ EditToolsHelper.GetPageRange(PageRangeSelectIndex, currentViewer.Document,ref WatermarkInfo.PageRange, PageRangeText);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private int _isFrontSelectedIndex = 0;
|
|
private int _isFrontSelectedIndex = 0;
|
|
public int IsFrontSelectedIndex
|
|
public int IsFrontSelectedIndex
|
|
{
|
|
{
|
|
@@ -174,27 +193,40 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
|
|
SetIsFront(IsFrontSelectedIndex);
|
|
SetIsFront(IsFrontSelectedIndex);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ private string _fileNameText = "";
|
|
|
|
+ public string FileNameText
|
|
|
|
+ {
|
|
|
|
+ get { return _fileNameText; }
|
|
|
|
+ set
|
|
|
|
+ {
|
|
|
|
+ SetProperty(ref _fileNameText, value);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private ObservableDictionary<string, bool> _getLocationFromNumber = new ObservableDictionary<string, bool>();
|
|
|
|
+ public ObservableDictionary<string, bool> GetLocationFromNumber
|
|
|
|
+ {
|
|
|
|
+ get { return _getLocationFromNumber; }
|
|
|
|
+ set { _getLocationFromNumber = value; }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
public DelegateCommand<object> ChangeLocationCommand { get; set; }
|
|
public DelegateCommand<object> ChangeLocationCommand { get; set; }
|
|
|
|
|
|
|
|
+ public DelegateCommand OpenFileCommand { get; set; }
|
|
|
|
+
|
|
public WatermarkCreateFileContentViewModel()
|
|
public WatermarkCreateFileContentViewModel()
|
|
{
|
|
{
|
|
|
|
|
|
ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
|
|
ChangeLocationCommand = new DelegateCommand<object>(ChangeLocation);
|
|
|
|
+ OpenFileCommand = new DelegateCommand(OpenFile);
|
|
InitList();
|
|
InitList();
|
|
WatermarkInfo.WatermarkHorizalign = C_Watermark_Horizalign.WATERMARK_HORIZALIGN_CENTER;
|
|
WatermarkInfo.WatermarkHorizalign = C_Watermark_Horizalign.WATERMARK_HORIZALIGN_CENTER;
|
|
WatermarkInfo.WatermarkVertalign = C_Watermark_Vertalign.WATERMARK_VERTALIGN_CENTER;
|
|
WatermarkInfo.WatermarkVertalign = C_Watermark_Vertalign.WATERMARK_VERTALIGN_CENTER;
|
|
InitLocationButtonMatrix();
|
|
InitLocationButtonMatrix();
|
|
}
|
|
}
|
|
|
|
|
|
- private ObservableDictionary<string, bool> _getLocationFromNumber = new ObservableDictionary<string, bool>();
|
|
|
|
- public ObservableDictionary<string, bool> GetLocationFromNumber
|
|
|
|
- {
|
|
|
|
- get { return _getLocationFromNumber; }
|
|
|
|
- set { _getLocationFromNumber = value; }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void SetIsFront(int Index)
|
|
private void SetIsFront(int Index)
|
|
{
|
|
{
|
|
if (Index == 0)
|
|
if (Index == 0)
|
|
@@ -242,6 +274,17 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public void OpenFile(){
|
|
|
|
+ System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
|
|
|
|
+ dlg.Multiselect = false;
|
|
|
|
+ dlg.Filter = "PDF|*.png;*.jpg;";
|
|
|
|
+ if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
|
|
|
|
+ {
|
|
|
|
+ FileNameText = dlg.FileName;
|
|
|
|
+ EditToolsHelper.ChooseFile(dlg.FileName, ref WatermarkInfo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
{
|
|
{
|
|
return true;
|
|
return true;
|
|
@@ -253,7 +296,6 @@ namespace PDF_Office.ViewModels.EditTools.Watermark
|
|
|
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
{
|
|
{
|
|
-
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|