|
@@ -1,11 +1,13 @@
|
|
|
using ComPDFKitViewer.AnnotEvent;
|
|
|
using ComPDFKitViewer.PdfViewer;
|
|
|
+using PDF_Office.CustomControl;
|
|
|
using PDF_Office.EventAggregators;
|
|
|
using PDF_Office.Model;
|
|
|
using Prism.Commands;
|
|
|
using Prism.Events;
|
|
|
using Prism.Mvvm;
|
|
|
using Prism.Regions;
|
|
|
+using Prism.Services.Dialogs;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
@@ -20,8 +22,12 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
|
|
|
|
|
|
public IRegionManager redactionRegion;
|
|
|
|
|
|
+ public IDialogService dialogs;
|
|
|
+
|
|
|
private CPDFViewer PDFViewer;
|
|
|
|
|
|
+ private ViewContentViewModel viewContentViewModel;
|
|
|
+
|
|
|
public string RedactionDocumentRegionName { get; set; }
|
|
|
public string RedactionBottomBarRegionName { get; set; }
|
|
|
|
|
@@ -31,16 +37,55 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
|
|
|
|
|
|
public DelegateCommand CloseEditToolCommand { get; set; }
|
|
|
|
|
|
- public RedactionContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator)
|
|
|
+ public DelegateCommand ApplyCommmand { get; set; }
|
|
|
+
|
|
|
+ public DelegateCommand RemoveCommand { get; set; }
|
|
|
+
|
|
|
+ public DelegateCommand PageRedactionCommand { get; set; }
|
|
|
+
|
|
|
+ public RedactionContentViewModel(IRegionManager regionManager, IEventAggregator eventAggregator,IDialogService dialogService)
|
|
|
{
|
|
|
this.redactionRegion = regionManager;
|
|
|
this.eventAggregator = eventAggregator;
|
|
|
+ this.dialogs = dialogService;
|
|
|
|
|
|
RedactionDocumentRegionName = Guid.NewGuid().ToString();
|
|
|
Unicode = App.mainWindowViewModel.SelectedItem.Unicode;
|
|
|
CloseEditToolCommand = new DelegateCommand(CloseEditTool);
|
|
|
+ ApplyCommmand = new DelegateCommand(apply);
|
|
|
+ RemoveCommand = new DelegateCommand(remove);
|
|
|
+ PageRedactionCommand = new DelegateCommand(pageMark);
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 应用
|
|
|
+ /// </summary>
|
|
|
+ private void apply()
|
|
|
+ {
|
|
|
+ AlertsMessage alertsMessage = new AlertsMessage();
|
|
|
+ alertsMessage.ShowDialog("Apply Redactions", "Use blank blocks to remove selected sensitive content."+
|
|
|
+
|
|
|
+"This action will permanently delete the marked ciphertext information from this document and you will not be able to retrieve the marked ciphertext information.","Cancel","Apply & Save As");
|
|
|
+ if(alertsMessage.result== ContentResult.Ok)
|
|
|
+ {
|
|
|
+ viewContentViewModel.saveAsFile(true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 擦除
|
|
|
+ /// </summary>
|
|
|
+ private void remove()
|
|
|
+ {
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ private void pageMark()
|
|
|
+ {
|
|
|
+ dialogs.ShowDialog(DialogNames.PageMarkDialog);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
public void CloseEditTool()
|
|
|
{
|
|
|
PDFViewer.SetMouseMode(MouseModes.Default);
|
|
@@ -49,6 +94,8 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
|
|
|
this.eventAggregator.GetEvent<CloseEditToolEvent>().Publish(new EnumCloseModeUnicode { Unicode = this.Unicode, Status = EnumCloseMode.StatusCancel });
|
|
|
}
|
|
|
|
|
|
+ #region Navigation
|
|
|
+
|
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
|
{
|
|
|
return true;
|
|
@@ -61,7 +108,8 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
{
|
|
|
navigationContext.Parameters.TryGetValue<CPDFViewer>(ParameterNames.PDFViewer, out PDFViewer);
|
|
|
- if(!redactionRegion.Regions[RedactionDocumentRegionName].Views.Contains(PDFViewer))
|
|
|
+ navigationContext.Parameters.TryGetValue<ViewContentViewModel>(ParameterNames.ViewContentViewModel, out viewContentViewModel);
|
|
|
+ if (!redactionRegion.Regions[RedactionDocumentRegionName].Views.Contains(PDFViewer))
|
|
|
{
|
|
|
RedactionAnnotArgs redactionArgs = new RedactionAnnotArgs();
|
|
|
AnnotHandlerEventArgs annotArgs = null;
|
|
@@ -89,5 +137,6 @@ namespace PDF_Office.ViewModels.EditTools.Redaction
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ #endregion
|
|
|
}
|
|
|
}
|