|
@@ -32,7 +32,9 @@ namespace PDFViewer
|
|
private FormControl formControl = new FormControl();
|
|
private FormControl formControl = new FormControl();
|
|
private ContentEditControl contentEditControl = new ContentEditControl();
|
|
private ContentEditControl contentEditControl = new ContentEditControl();
|
|
private PageEditControl pageEditControl = new PageEditControl();
|
|
private PageEditControl pageEditControl = new PageEditControl();
|
|
- private CPDFBOTABarControl botaBarControl = new CPDFBOTABarControl(BOTATools.Thumbnail | BOTATools.Outline | BOTATools.Bookmark | BOTATools.Search | BOTATools.Annotation);
|
|
|
|
|
|
+ private DigitalSignatureControl digitalSignatureControl = new DigitalSignatureControl();
|
|
|
|
+ private SignatureStatusBarControl signatureStatusBarControl = new SignatureStatusBarControl();
|
|
|
|
+ private CPDFBOTABarControl botaBarControl = new CPDFBOTABarControl();
|
|
private CPDFDisplaySettingsControl displaySettingsControl = new CPDFDisplaySettingsControl();
|
|
private CPDFDisplaySettingsControl displaySettingsControl = new CPDFDisplaySettingsControl();
|
|
|
|
|
|
private PanelState panelState = PanelState.GetInstance();
|
|
private PanelState panelState = PanelState.GetInstance();
|
|
@@ -166,6 +168,7 @@ namespace PDFViewer
|
|
|
|
|
|
ViewSettingBtn.IsChecked = false;
|
|
ViewSettingBtn.IsChecked = false;
|
|
botaBarControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
botaBarControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
|
+ botaBarControl.AddBOTAContent(new []{BOTATools.Thumbnail , BOTATools.Outline , BOTATools.Bookmark , BOTATools.Annotation , BOTATools.Search});
|
|
botaBarControl.SelectBotaTool(BOTATools.Thumbnail);
|
|
botaBarControl.SelectBotaTool(BOTATools.Thumbnail);
|
|
displaySettingsControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
displaySettingsControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
LoadCustomControl();
|
|
LoadCustomControl();
|
|
@@ -266,6 +269,11 @@ namespace PDFViewer
|
|
regularViewerControl.SetBOTAContainer(botaBarControl);
|
|
regularViewerControl.SetBOTAContainer(botaBarControl);
|
|
regularViewerControl.SetDisplaySettingsControl(displaySettingsControl);
|
|
regularViewerControl.SetDisplaySettingsControl(displaySettingsControl);
|
|
PDFGrid.Child = regularViewerControl;
|
|
PDFGrid.Child = regularViewerControl;
|
|
|
|
+
|
|
|
|
+ SignatureHelper.InitEffectiveSignatureList(pdfViewer.PDFView.Document);
|
|
|
|
+ SignatureHelper.VerifySignatureList(pdfViewer.PDFView.Document);
|
|
|
|
+ digitalSignatureControl.LoadUndoManagerEvent(pdfViewer.PDFView);
|
|
|
|
+ signatureStatusBarControl.SetStatus(SignatureHelper.SignatureList);
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -289,7 +297,50 @@ namespace PDFViewer
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Command for opening a PDF file saved with a signature.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender"></param>
|
|
|
|
+ /// <param name="e"></param>
|
|
|
|
+ private void DigitalSignatureControl_AfterFillSignature(object sender, string e)
|
|
|
|
+ {
|
|
|
|
+ OpenFile(e);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Event handler for deleting a signature from the BOTA. Set the CanSave property to true and update the signature status.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender"></param>
|
|
|
|
+ /// <param name="e"></param>
|
|
|
|
+ private void BotaControlOnDeleteSignatureEvent(object sender, EventArgs e)
|
|
|
|
+ {
|
|
|
|
+ pdfViewer.PDFView.UndoManager.CanSave = true;
|
|
|
|
+ DigitalSignatureControl_OnSignatureStatusChanged(sender, e);
|
|
|
|
+ //this.CanSave = true;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Event handler for updating a signature. Update the signature status.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender"></param>
|
|
|
|
+ /// <param name="e"></param>
|
|
|
|
+ private void DigitalSignatureControl_OnSignatureStatusChanged(object sender, EventArgs e)
|
|
|
|
+ {
|
|
|
|
+ SignatureHelper.InitEffectiveSignatureList(pdfViewer.PDFView.Document);
|
|
|
|
+ SignatureHelper.VerifySignatureList(pdfViewer.PDFView.Document);
|
|
|
|
+ signatureStatusBarControl.SetStatus(SignatureHelper.SignatureList);
|
|
|
|
+ botaBarControl.LoadSignatureList();
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /// <summary>
|
|
|
|
+ /// Event handler for updating the CanSave property.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="sender"></param>
|
|
|
|
+ /// <param name="e"></param>
|
|
|
|
+ private void DigitalSignatureControl_OnCanSaveChanged(object sender, bool e)
|
|
|
|
+ {
|
|
|
|
+ this.CanSave = e;
|
|
|
|
+ }
|
|
|
|
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
@@ -336,6 +387,12 @@ namespace PDFViewer
|
|
pageEditControl.ExitPageEdit -= PageEditControl_ExitPageEdit;
|
|
pageEditControl.ExitPageEdit -= PageEditControl_ExitPageEdit;
|
|
NotDocsEditorVisible = Visibility.Visible;
|
|
NotDocsEditorVisible = Visibility.Visible;
|
|
}
|
|
}
|
|
|
|
+ else if (currentMode == "Digital Signature")
|
|
|
|
+ {
|
|
|
|
+ digitalSignatureControl.UnloadEvent();
|
|
|
|
+ digitalSignatureControl.ClearViewerControl();
|
|
|
|
+ botaBarControl.RemoveBOTAContent(BOTATools.Signature);
|
|
|
|
+ }
|
|
|
|
|
|
if (item.Content as string == "Viewer")
|
|
if (item.Content as string == "Viewer")
|
|
{
|
|
{
|
|
@@ -416,6 +473,26 @@ namespace PDFViewer
|
|
PDFGrid.Child = pageEditControl;
|
|
PDFGrid.Child = pageEditControl;
|
|
NotDocsEditorVisible = Visibility.Collapsed;
|
|
NotDocsEditorVisible = Visibility.Collapsed;
|
|
}
|
|
}
|
|
|
|
+ else if (item.Content as string == "Digital Signature")
|
|
|
|
+ {
|
|
|
|
+ if (contentEditControl.pdfContentEditControl != null && contentEditControl.PdfViewControl.PDFView != null)
|
|
|
|
+ {
|
|
|
|
+ PDFGrid.Child = digitalSignatureControl;
|
|
|
|
+ digitalSignatureControl.PDFViewControl.PDFView.SetMouseMode(MouseModes.Viewer);
|
|
|
|
+ digitalSignatureControl.PDFViewControl = pdfViewer;
|
|
|
|
+ botaBarControl.AddBOTAContent(BOTATools.Signature);
|
|
|
|
+ digitalSignatureControl.InitWithPDFViewer(pdfViewer.PDFView);
|
|
|
|
+ digitalSignatureControl.SetBOTAContainer(botaBarControl);
|
|
|
|
+ digitalSignatureControl.SetDisplaySettingsControl(displaySettingsControl);
|
|
|
|
+ digitalSignatureControl.SetSignatureStatusBarControl(signatureStatusBarControl);
|
|
|
|
+ digitalSignatureControl.OnCanSaveChanged -= DigitalSignatureControl_OnCanSaveChanged;
|
|
|
|
+ digitalSignatureControl.OnCanSaveChanged += DigitalSignatureControl_OnCanSaveChanged;
|
|
|
|
+ digitalSignatureControl.SignatureStatusChanged -= DigitalSignatureControl_OnSignatureStatusChanged;
|
|
|
|
+ digitalSignatureControl.SignatureStatusChanged += DigitalSignatureControl_OnSignatureStatusChanged;
|
|
|
|
+ digitalSignatureControl.AfterFillSignature -= DigitalSignatureControl_AfterFillSignature;
|
|
|
|
+ digitalSignatureControl.AfterFillSignature += DigitalSignatureControl_AfterFillSignature;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
currentMode = item.Content as string;
|
|
currentMode = item.Content as string;
|
|
RightToolPanelButtonIsChecked = false;
|
|
RightToolPanelButtonIsChecked = false;
|
|
}
|
|
}
|
|
@@ -520,9 +597,12 @@ namespace PDFViewer
|
|
pdfViewer.PDFView.UndoManager.CanSave = false;
|
|
pdfViewer.PDFView.UndoManager.CanSave = false;
|
|
}
|
|
}
|
|
|
|
|
|
- private void OpenFile()
|
|
|
|
|
|
+ private void OpenFile(string filePath = "")
|
|
{
|
|
{
|
|
- string filePath = CommonHelper.GetExistedPathOrEmpty();
|
|
|
|
|
|
+ if (string.IsNullOrEmpty(filePath))
|
|
|
|
+ {
|
|
|
|
+ filePath = CommonHelper.GetExistedPathOrEmpty();
|
|
|
|
+ }
|
|
string oldFilePath = pdfViewer.PDFView.Document.FilePath;
|
|
string oldFilePath = pdfViewer.PDFView.Document.FilePath;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(filePath) && regularViewerControl.PdfViewControl != null)
|
|
if (!string.IsNullOrEmpty(filePath) && regularViewerControl.PdfViewControl != null)
|