|
@@ -12,6 +12,7 @@ using Compdfkit_Tools.Helper;
|
|
|
using ComPDFKit.DigitalSign;
|
|
|
using ComPDFKit.PDFAnnotation.Form;
|
|
|
using ComPDFKitViewer;
|
|
|
+using static ComPDFKit.Tool.CPDFToolManager;
|
|
|
|
|
|
namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
@@ -42,9 +43,9 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- if (PDFViewControl != null && PDFViewControl.PDFView != null)
|
|
|
+ if (PDFViewControl != null && PDFViewControl.PDFViewTool.GetCPDFViewer() != null)
|
|
|
{
|
|
|
- return PDFViewControl.PDFView.UndoManager.CanUndo;
|
|
|
+ return PDFViewControl.PDFViewTool.GetCPDFViewer().UndoManager.CanUndo;
|
|
|
}
|
|
|
return false;
|
|
|
}
|
|
@@ -57,9 +58,10 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- if (PDFViewControl != null && PDFViewControl.PDFView != null)
|
|
|
+ if (PDFViewControl != null && PDFViewControl.PDFViewTool.GetCPDFViewer() != null)
|
|
|
{
|
|
|
- return PDFViewControl.PDFView.UndoManager.CanRedo;
|
|
|
+
|
|
|
+ return PDFViewControl.PDFViewTool.GetCPDFViewer().UndoManager.CanRedo;
|
|
|
}
|
|
|
|
|
|
return false;
|
|
@@ -73,9 +75,13 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
{
|
|
|
get
|
|
|
{
|
|
|
- if (PDFViewControl != null && PDFViewControl.PDFView != null)
|
|
|
+ if (PDFViewControl != null && PDFViewControl.PDFViewTool.GetCPDFViewer() != null)
|
|
|
{
|
|
|
- return PDFViewControl.PDFView.UndoManager.CanSave;
|
|
|
+ if (PDFViewControl.PDFViewTool.GetCPDFViewer().UndoManager.CanRedo ||
|
|
|
+ PDFViewControl.PDFViewTool.GetCPDFViewer().UndoManager.CanUndo)
|
|
|
+ {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
return false;
|
|
@@ -118,24 +124,22 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
/// Init controls with pdfViewer, and load events.
|
|
|
/// </summary>
|
|
|
/// <param name="pdfViewer"></param>
|
|
|
- public void InitWithPDFViewer(CPDFViewer pdfViewer)
|
|
|
+ public void InitWithPDFViewer(PDFViewControl pdfViewer)
|
|
|
{
|
|
|
- PDFViewControl.PDFView = pdfViewer;
|
|
|
+ PDFViewControl = pdfViewer;
|
|
|
PDFGrid.Child = PDFViewControl;
|
|
|
FloatPageTool.InitWithPDFViewer(pdfViewer);
|
|
|
|
|
|
- PDFViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
|
|
|
- PDFViewControl.PDFView.SetShowLink(true);
|
|
|
- PDFViewControl.PDFView.SetFormFieldHighlight(true);
|
|
|
- PDFViewControl.PDFView.UndoManager.ClearHistory();
|
|
|
+ PDFViewControl.PDFToolManager.SetToolType(ToolType.Viewer);
|
|
|
+ PDFViewControl.PDFViewTool.GetCPDFViewer().UndoManager.ClearHistory();
|
|
|
|
|
|
DigitalSignatureBarControl.DigitalSignatureActionChanged -= DigitalSignatureBarControl_DigitalSignatureActionChanged;
|
|
|
DigitalSignatureBarControl.DigitalSignatureActionChanged += DigitalSignatureBarControl_DigitalSignatureActionChanged;
|
|
|
|
|
|
- PDFViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
|
|
|
- PDFViewControl.PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
|
|
|
- PDFViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
|
|
|
- PDFViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
|
|
|
+ //PDFViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
|
|
|
+ //PDFViewControl.PDFView.WidgetClickHandler += PDFView_WidgetClickHandler;
|
|
|
+ //PDFViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
|
|
|
+ //PDFViewControl.PDFView.AnnotCommandHandler += PDFView_AnnotCommandHandler;
|
|
|
|
|
|
panelState.PropertyChanged -= PanelState_PropertyChanged;
|
|
|
panelState.PropertyChanged += PanelState_PropertyChanged;
|
|
@@ -147,9 +151,9 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
/// <param name="pdfViewer"></param>
|
|
|
public void LoadUndoManagerEvent(CPDFViewer pdfViewer)
|
|
|
{
|
|
|
- PDFViewControl.PDFView = pdfViewer;
|
|
|
- PDFViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
|
|
|
- PDFViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
|
|
|
+ //PDFViewControl.PDFView = pdfViewer;
|
|
|
+ //PDFViewControl.PDFView.UndoManager.PropertyChanged -= UndoManager_PropertyChanged;
|
|
|
+ //PDFViewControl.PDFView.UndoManager.PropertyChanged += UndoManager_PropertyChanged;
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -253,14 +257,14 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
/// </summary>
|
|
|
private void CreateSign()
|
|
|
{
|
|
|
- PDFViewControl.PDFView.SetMouseMode(MouseModes.FormEditTool);
|
|
|
- WidgetSignArgs signArgs = new WidgetSignArgs
|
|
|
- {
|
|
|
- LineWidth = 1,
|
|
|
- LineColor = Colors.Black,
|
|
|
- FieldName = "Signature" + GetTime()
|
|
|
- };
|
|
|
- PDFViewControl.PDFView.SetToolParam(signArgs);
|
|
|
+ //PDFViewControl.PDFView.SetMouseMode(MouseModes.FormEditTool);
|
|
|
+ //WidgetSignArgs signArgs = new WidgetSignArgs
|
|
|
+ //{
|
|
|
+ // LineWidth = 1,
|
|
|
+ // LineColor = Colors.Black,
|
|
|
+ // FieldName = "Signature" + GetTime()
|
|
|
+ //};
|
|
|
+ //PDFViewControl.PDFView.SetToolParam(signArgs);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -304,27 +308,27 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
/// </summary>
|
|
|
/// <param name="sender"></param>
|
|
|
/// <param name="e"></param>
|
|
|
- private void PDFView_WidgetClickHandler(object sender, WidgetArgs e)
|
|
|
- {
|
|
|
- var signatureWidget = (e as WidgetSignArgs).Sign;
|
|
|
- CPDFSignature sig = signatureWidget.GetSignature(PDFViewControl.PDFView.Document);
|
|
|
- if (signatureWidget.IsSigned() && sig!=null && sig?.SignerList.Count > 0)
|
|
|
- {
|
|
|
- ViewSignatureEvent(sender, sig);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- Window parentWindow = Window.GetWindow((DependencyObject)sender);
|
|
|
- AddCertificationDialog addCertificationControl = new AddCertificationDialog
|
|
|
- {
|
|
|
- Owner = parentWindow
|
|
|
- };
|
|
|
- currentSignatureWidget = signatureWidget;
|
|
|
- addCertificationControl.FillSignatureEvent -= AddCertificationControl_FillSignatureEvent;
|
|
|
- addCertificationControl.FillSignatureEvent += AddCertificationControl_FillSignatureEvent;
|
|
|
- addCertificationControl.ShowDialog();
|
|
|
- }
|
|
|
- }
|
|
|
+ //private void PDFView_WidgetClickHandler(object sender, WidgetArgs e)
|
|
|
+ //{
|
|
|
+ // var signatureWidget = (e as WidgetSignArgs).Sign;
|
|
|
+ // CPDFSignature sig = signatureWidget.GetSignature(PDFViewControl.PDFView.Document);
|
|
|
+ // if (signatureWidget.IsSigned() && sig!=null && sig?.SignerList.Count > 0)
|
|
|
+ // {
|
|
|
+ // ViewSignatureEvent(sender, sig);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // Window parentWindow = Window.GetWindow((DependencyObject)sender);
|
|
|
+ // AddCertificationDialog addCertificationControl = new AddCertificationDialog
|
|
|
+ // {
|
|
|
+ // Owner = parentWindow
|
|
|
+ // };
|
|
|
+ // currentSignatureWidget = signatureWidget;
|
|
|
+ // addCertificationControl.FillSignatureEvent -= AddCertificationControl_FillSignatureEvent;
|
|
|
+ // addCertificationControl.FillSignatureEvent += AddCertificationControl_FillSignatureEvent;
|
|
|
+ // addCertificationControl.ShowDialog();
|
|
|
+ // }
|
|
|
+ //}
|
|
|
|
|
|
/// <summary>
|
|
|
/// Event of filling a signature.
|
|
@@ -338,7 +342,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
FilePath = e.filePath,
|
|
|
Password = e.password,
|
|
|
SignatureWidget = currentSignatureWidget,
|
|
|
- Document = PDFViewControl.PDFView.Document,
|
|
|
+ //Document = PDFViewControl.PDFView.Document,
|
|
|
Owner = Window.GetWindow(this)
|
|
|
};
|
|
|
fillDigitalSignatureDialog.AfterFillSignature += FillDigitalSignatureDialog_AfterFillSignature; ;
|
|
@@ -368,7 +372,7 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
}
|
|
|
else if (e == Common.CPDFDigitalSignatureBarControl.DigitalSignatureAction.Signing)
|
|
|
{
|
|
|
- PDFViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
|
|
|
+ PDFViewControl.PDFToolManager.SetToolType(ToolType.Viewer);
|
|
|
}
|
|
|
else if (e == Common.CPDFDigitalSignatureBarControl.DigitalSignatureAction.VerifySignature)
|
|
|
{
|
|
@@ -422,9 +426,9 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
/// <param name="e"></param>
|
|
|
private void CommandBinding_Executed_Undo(object sender, ExecutedRoutedEventArgs e)
|
|
|
{
|
|
|
- if (PDFViewControl != null && PDFViewControl.PDFView != null && CanUndo)
|
|
|
+ if (PDFViewControl != null && PDFViewControl.PDFViewTool.GetCPDFViewer() != null && CanUndo)
|
|
|
{
|
|
|
- PDFViewControl.PDFView.UndoManager?.Undo();
|
|
|
+ PDFViewControl.PDFViewTool.GetCPDFViewer().UndoManager?.Undo();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -435,9 +439,9 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
/// <param name="e"></param>
|
|
|
private void CommandBinding_Executed_Redo(object sender, ExecutedRoutedEventArgs e)
|
|
|
{
|
|
|
- if (PDFViewControl != null && PDFViewControl.PDFView != null && CanUndo)
|
|
|
+ if (PDFViewControl != null && PDFViewControl.PDFViewTool.GetCPDFViewer() != null && CanUndo)
|
|
|
{
|
|
|
- PDFViewControl.PDFView.UndoManager?.Redo();
|
|
|
+ PDFViewControl.PDFViewTool.GetCPDFViewer().UndoManager?.Redo();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -448,9 +452,9 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
/// <param name="e"></param>
|
|
|
private void UndoButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- if (PDFViewControl != null && PDFViewControl.PDFView != null && CanUndo)
|
|
|
+ if (PDFViewControl != null && PDFViewControl.PDFViewTool.GetCPDFViewer() != null && CanUndo)
|
|
|
{
|
|
|
- PDFViewControl.PDFView.UndoManager?.Undo();
|
|
|
+ PDFViewControl.PDFViewTool.GetCPDFViewer().UndoManager?.Undo();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -461,9 +465,9 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
/// <param name="e"></param>
|
|
|
private void RedoButton_Click(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- if (PDFViewControl != null && PDFViewControl.PDFView != null && CanRedo)
|
|
|
+ if (PDFViewControl != null && PDFViewControl.PDFViewTool.GetCPDFViewer() != null && CanRedo)
|
|
|
{
|
|
|
- PDFViewControl.PDFView.UndoManager?.Redo();
|
|
|
+ PDFViewControl.PDFViewTool.GetCPDFViewer().UndoManager?.Redo();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -476,168 +480,168 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
/// </summary>
|
|
|
/// <param name="sender"></param>
|
|
|
/// <param name="e"></param>
|
|
|
- private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
|
|
|
- {
|
|
|
- if (e != null && e.CommandType == CommandType.Context)
|
|
|
- {
|
|
|
- if (e.CommandTarget == TargetType.WidgetView)
|
|
|
- {
|
|
|
- e.Handle = true;
|
|
|
- e.PopupMenu = new ContextMenu();
|
|
|
- var sign = e.Sign.GetSignature(PDFViewControl.PDFView.Document);
|
|
|
- if (e.Sign.IsSigned() && sign != null && sign.SignerList.Any())
|
|
|
- {
|
|
|
- MenuItem DeleteMenu = new MenuItem()
|
|
|
- { Header = "Delete" };
|
|
|
- DeleteMenu.Click += (o, args) =>
|
|
|
- {
|
|
|
- PDFViewControl.PDFView.Document.RemoveSignature(sign, true);
|
|
|
- e.Sign.ResetForm();
|
|
|
- e.Sign.SetIsLocked(false);
|
|
|
- PDFViewControl.PDFView.ReloadVisibleAnnots();
|
|
|
+ //private void PDFView_AnnotCommandHandler(object sender, AnnotCommandArgs e)
|
|
|
+ //{
|
|
|
+ // if (e != null && e.CommandType == CommandType.Context)
|
|
|
+ // {
|
|
|
+ // if (e.CommandTarget == TargetType.WidgetView)
|
|
|
+ // {
|
|
|
+ // e.Handle = true;
|
|
|
+ // e.PopupMenu = new ContextMenu();
|
|
|
+ // var sign = e.Sign.GetSignature(PDFViewControl.PDFView.Document);
|
|
|
+ // if (e.Sign.IsSigned() && sign != null && sign.SignerList.Any())
|
|
|
+ // {
|
|
|
+ // MenuItem DeleteMenu = new MenuItem()
|
|
|
+ // { Header = "Delete" };
|
|
|
+ // DeleteMenu.Click += (o, args) =>
|
|
|
+ // {
|
|
|
+ // PDFViewControl.PDFView.Document.RemoveSignature(sign, true);
|
|
|
+ // e.Sign.ResetForm();
|
|
|
+ // e.Sign.SetIsLocked(false);
|
|
|
+ // PDFViewControl.PDFView.ReloadVisibleAnnots();
|
|
|
|
|
|
- PDFViewControl.PDFView.UndoManager.CanSave = true;
|
|
|
- SignatureStatusChanged?.Invoke(this, null);
|
|
|
- };
|
|
|
- e.PopupMenu.Items.Add(DeleteMenu);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- e.PopupMenu.Items.Add(new MenuItem()
|
|
|
- { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
|
|
|
- e.PopupMenu.Items.Add(new MenuItem()
|
|
|
- { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
|
|
|
- e.PopupMenu.Items.Add(new MenuItem()
|
|
|
- { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- e.Handle = true;
|
|
|
- e.PopupMenu = new ContextMenu();
|
|
|
-
|
|
|
- e.PopupMenu.Items.Add(new MenuItem()
|
|
|
- { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
|
|
|
- e.PopupMenu.Items.Add(new Separator());
|
|
|
-
|
|
|
- MenuItem fitWidthMenu = new MenuItem();
|
|
|
- fitWidthMenu.Header = "Automatically Resize";
|
|
|
- fitWidthMenu.Click += (o, p) =>
|
|
|
- {
|
|
|
- if (PDFViewControl != null)
|
|
|
- {
|
|
|
- PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitWidth);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- e.PopupMenu.Items.Add(fitWidthMenu);
|
|
|
-
|
|
|
- MenuItem fitSizeMenu = new MenuItem();
|
|
|
- fitSizeMenu.Header = "Actual Size";
|
|
|
- fitSizeMenu.Click += (o, p) =>
|
|
|
- {
|
|
|
- if (PDFViewControl != null)
|
|
|
- {
|
|
|
- PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitSize);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- e.PopupMenu.Items.Add(fitSizeMenu);
|
|
|
-
|
|
|
- MenuItem zoomInMenu = new MenuItem();
|
|
|
- zoomInMenu.Header = "Zoom In";
|
|
|
- zoomInMenu.Click += (o, p) =>
|
|
|
- {
|
|
|
- if (PDFViewControl != null)
|
|
|
- {
|
|
|
- double newZoom = CommandHelper.CheckZoomLevel(zoomLevelList,
|
|
|
- PDFViewControl.PDFView.ZoomFactor + 0.01, true);
|
|
|
- PDFViewControl.PDFView?.Zoom(newZoom);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- e.PopupMenu.Items.Add(zoomInMenu);
|
|
|
-
|
|
|
- MenuItem zoomOutMenu = new MenuItem();
|
|
|
- zoomOutMenu.Header = "Zoom Out";
|
|
|
- zoomOutMenu.Click += (o, p) =>
|
|
|
- {
|
|
|
- if (PDFViewControl != null)
|
|
|
- {
|
|
|
- double newZoom = CommandHelper.CheckZoomLevel(zoomLevelList,
|
|
|
- PDFViewControl.PDFView.ZoomFactor - 0.01, false);
|
|
|
- PDFViewControl.PDFView?.Zoom(newZoom);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- e.PopupMenu.Items.Add(zoomOutMenu);
|
|
|
- e.PopupMenu.Items.Add(new Separator());
|
|
|
-
|
|
|
- MenuItem singleView = new MenuItem();
|
|
|
- singleView.Header = "Single Page";
|
|
|
- singleView.Click += (o, p) =>
|
|
|
- {
|
|
|
- if (PDFViewControl != null)
|
|
|
- {
|
|
|
- PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Single);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- e.PopupMenu.Items.Add(singleView);
|
|
|
-
|
|
|
- MenuItem singleContinuousView = new MenuItem();
|
|
|
- singleContinuousView.Header = "Single Page Continuous";
|
|
|
- singleContinuousView.Click += (o, p) =>
|
|
|
- {
|
|
|
- if (PDFViewControl != null)
|
|
|
- {
|
|
|
- PDFViewControl.PDFView?.ChangeViewMode(ViewMode.SingleContinuous);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- e.PopupMenu.Items.Add(singleContinuousView);
|
|
|
-
|
|
|
- MenuItem doubleView = new MenuItem();
|
|
|
- doubleView.Header = "Two Pages";
|
|
|
- doubleView.Click += (o, p) =>
|
|
|
- {
|
|
|
- if (PDFViewControl != null)
|
|
|
- {
|
|
|
- PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Double);
|
|
|
- }
|
|
|
- };
|
|
|
-
|
|
|
- e.PopupMenu.Items.Add(doubleView);
|
|
|
-
|
|
|
- MenuItem doubleContinuousView = new MenuItem();
|
|
|
- doubleContinuousView.Header = "Two Pages Continuous";
|
|
|
- doubleContinuousView.Click += (o, p) =>
|
|
|
- {
|
|
|
- if (PDFViewControl != null)
|
|
|
- {
|
|
|
- PDFViewControl.PDFView?.ChangeViewMode(ViewMode.DoubleContinuous);
|
|
|
- }
|
|
|
- };
|
|
|
- e.PopupMenu.Items.Add(doubleContinuousView);
|
|
|
-
|
|
|
- MenuItem resetFormMenu = new MenuItem();
|
|
|
- resetFormMenu.Header = "Reset Forms";
|
|
|
- resetFormMenu.Click += (o, p) =>
|
|
|
- {
|
|
|
- if (PDFViewControl != null)
|
|
|
- {
|
|
|
- PDFViewControl.PDFView?.ResetForm(null);
|
|
|
- }
|
|
|
- };
|
|
|
- e.PopupMenu.Items.Add(new Separator());
|
|
|
- e.PopupMenu.Items.Add(resetFormMenu);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- e.DoCommand();
|
|
|
- }
|
|
|
- }
|
|
|
+ // PDFViewControl.PDFView.UndoManager.CanSave = true;
|
|
|
+ // SignatureStatusChanged?.Invoke(this, null);
|
|
|
+ // };
|
|
|
+ // e.PopupMenu.Items.Add(DeleteMenu);
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // e.PopupMenu.Items.Add(new MenuItem()
|
|
|
+ // { Header = "Copy", Command = ApplicationCommands.Copy, CommandTarget = (UIElement)sender });
|
|
|
+ // e.PopupMenu.Items.Add(new MenuItem()
|
|
|
+ // { Header = "Cut", Command = ApplicationCommands.Cut, CommandTarget = (UIElement)sender });
|
|
|
+ // e.PopupMenu.Items.Add(new MenuItem()
|
|
|
+ // { Header = "Delete", Command = ApplicationCommands.Delete, CommandTarget = (UIElement)sender });
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // e.Handle = true;
|
|
|
+ // e.PopupMenu = new ContextMenu();
|
|
|
+
|
|
|
+ // e.PopupMenu.Items.Add(new MenuItem()
|
|
|
+ // { Header = "Paste", Command = ApplicationCommands.Paste, CommandTarget = (UIElement)sender });
|
|
|
+ // e.PopupMenu.Items.Add(new Separator());
|
|
|
+
|
|
|
+ // MenuItem fitWidthMenu = new MenuItem();
|
|
|
+ // fitWidthMenu.Header = "Automatically Resize";
|
|
|
+ // fitWidthMenu.Click += (o, p) =>
|
|
|
+ // {
|
|
|
+ // if (PDFViewControl != null)
|
|
|
+ // {
|
|
|
+ // PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitWidth);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // e.PopupMenu.Items.Add(fitWidthMenu);
|
|
|
+
|
|
|
+ // MenuItem fitSizeMenu = new MenuItem();
|
|
|
+ // fitSizeMenu.Header = "Actual Size";
|
|
|
+ // fitSizeMenu.Click += (o, p) =>
|
|
|
+ // {
|
|
|
+ // if (PDFViewControl != null)
|
|
|
+ // {
|
|
|
+ // PDFViewControl.PDFView?.ChangeFitMode(FitMode.FitSize);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // e.PopupMenu.Items.Add(fitSizeMenu);
|
|
|
+
|
|
|
+ // MenuItem zoomInMenu = new MenuItem();
|
|
|
+ // zoomInMenu.Header = "Zoom In";
|
|
|
+ // zoomInMenu.Click += (o, p) =>
|
|
|
+ // {
|
|
|
+ // if (PDFViewControl != null)
|
|
|
+ // {
|
|
|
+ // double newZoom = CommandHelper.CheckZoomLevel(zoomLevelList,
|
|
|
+ // PDFViewControl.PDFView.ZoomFactor + 0.01, true);
|
|
|
+ // PDFViewControl.PDFView?.Zoom(newZoom);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // e.PopupMenu.Items.Add(zoomInMenu);
|
|
|
+
|
|
|
+ // MenuItem zoomOutMenu = new MenuItem();
|
|
|
+ // zoomOutMenu.Header = "Zoom Out";
|
|
|
+ // zoomOutMenu.Click += (o, p) =>
|
|
|
+ // {
|
|
|
+ // if (PDFViewControl != null)
|
|
|
+ // {
|
|
|
+ // double newZoom = CommandHelper.CheckZoomLevel(zoomLevelList,
|
|
|
+ // PDFViewControl.PDFView.ZoomFactor - 0.01, false);
|
|
|
+ // PDFViewControl.PDFView?.Zoom(newZoom);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // e.PopupMenu.Items.Add(zoomOutMenu);
|
|
|
+ // e.PopupMenu.Items.Add(new Separator());
|
|
|
+
|
|
|
+ // MenuItem singleView = new MenuItem();
|
|
|
+ // singleView.Header = "Single Page";
|
|
|
+ // singleView.Click += (o, p) =>
|
|
|
+ // {
|
|
|
+ // if (PDFViewControl != null)
|
|
|
+ // {
|
|
|
+ // PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Single);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // e.PopupMenu.Items.Add(singleView);
|
|
|
+
|
|
|
+ // MenuItem singleContinuousView = new MenuItem();
|
|
|
+ // singleContinuousView.Header = "Single Page Continuous";
|
|
|
+ // singleContinuousView.Click += (o, p) =>
|
|
|
+ // {
|
|
|
+ // if (PDFViewControl != null)
|
|
|
+ // {
|
|
|
+ // PDFViewControl.PDFView?.ChangeViewMode(ViewMode.SingleContinuous);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // e.PopupMenu.Items.Add(singleContinuousView);
|
|
|
+
|
|
|
+ // MenuItem doubleView = new MenuItem();
|
|
|
+ // doubleView.Header = "Two Pages";
|
|
|
+ // doubleView.Click += (o, p) =>
|
|
|
+ // {
|
|
|
+ // if (PDFViewControl != null)
|
|
|
+ // {
|
|
|
+ // PDFViewControl.PDFView?.ChangeViewMode(ViewMode.Double);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+
|
|
|
+ // e.PopupMenu.Items.Add(doubleView);
|
|
|
+
|
|
|
+ // MenuItem doubleContinuousView = new MenuItem();
|
|
|
+ // doubleContinuousView.Header = "Two Pages Continuous";
|
|
|
+ // doubleContinuousView.Click += (o, p) =>
|
|
|
+ // {
|
|
|
+ // if (PDFViewControl != null)
|
|
|
+ // {
|
|
|
+ // PDFViewControl.PDFView?.ChangeViewMode(ViewMode.DoubleContinuous);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ // e.PopupMenu.Items.Add(doubleContinuousView);
|
|
|
+
|
|
|
+ // MenuItem resetFormMenu = new MenuItem();
|
|
|
+ // resetFormMenu.Header = "Reset Forms";
|
|
|
+ // resetFormMenu.Click += (o, p) =>
|
|
|
+ // {
|
|
|
+ // if (PDFViewControl != null)
|
|
|
+ // {
|
|
|
+ // PDFViewControl.PDFView?.ResetForm(null);
|
|
|
+ // }
|
|
|
+ // };
|
|
|
+ // e.PopupMenu.Items.Add(new Separator());
|
|
|
+ // e.PopupMenu.Items.Add(resetFormMenu);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // else
|
|
|
+ // {
|
|
|
+ // e.DoCommand();
|
|
|
+ // }
|
|
|
+ //}
|
|
|
#endregion
|
|
|
|
|
|
#region Load Unload Event
|
|
@@ -659,8 +663,8 @@ namespace Compdfkit_Tools.PDFControl
|
|
|
/// <param name="e"></param>
|
|
|
private void UserControl_Unloaded(object sender, RoutedEventArgs e)
|
|
|
{
|
|
|
- PDFViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
|
|
|
- PDFViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
|
|
|
+ //PDFViewControl.PDFView.AnnotCommandHandler -= PDFView_AnnotCommandHandler;
|
|
|
+ //PDFViewControl.PDFView.WidgetClickHandler -= PDFView_WidgetClickHandler;
|
|
|
}
|
|
|
|
|
|
#endregion
|