private void btnOK_Click(object sender, EventArgs e) { SignatureQueueServiceClient service = null; try { m_progressWindow.Show(null, Tools.GetLocalizedString("Signing")); service = WSTools.GetSignatureQueueServiceClient(); BiometricSignatureContext context = service.BeginBiometricSignatureProvider( m_jobReferenceEx.id, m_signatureIndex, m_jobReferenceEx.queueName, m_SignatureClientBehaviour.signatureId, m_SignatureClientBehaviour.signatureAccount, m_SignatureClientBehaviour.uri, m_SignatureClientBehaviour.providerParameter, null); if (context != null && context.instance != null) { byte[] biometricFinalState = sealSignBSSPanel1.GetSignature(context.instance, context.biometricState); if (biometricFinalState != null) { m_signedDocument = service.EndBiometricSignatureProvider( context.instance, biometricFinalState, m_jobReferenceEx.id, m_signatureIndex, m_jobReferenceEx.queueName, m_SignatureClientBehaviour.uri, m_SignatureClientBehaviour.providerParameter); } else { service.Close(); return; } } m_progressWindow.SetMessage(Tools.GetLocalizedString("SignatureSuccess"), 2000); this.DialogResult = DialogResult.OK; sealSignBSSPanel1.CleanSignature(); m_progressWindow.Close(); this.Close(); } catch (Exception ex) { sealSignBSSPanel1.CleanSignature(); m_progressWindow.Close(); Tools.ShowUnexpectedError(this, ex); this.DialogResult = DialogResult.Cancel; this.Close(); } finally { try { if (service != null) { service.Close(); } } catch { } } }
private void btnSign_Click(object sender, EventArgs e) { SignatureQueueServiceClient service = null; try { if (bSigning) { return; } bSigning = true; sealSignBSSWacomSTUPanel1.Stop(); m_otherProgressWindow = new ProgressWindow(); m_otherProgressWindow.Show(null, Tools.GetLocalizedString("Signing")); service = WSTools.GetSignatureQueueServiceClient(); BiometricSignatureContext context = service.BeginBiometricSignatureProvider( m_jobReferenceEx.id, m_signatureIndex, m_jobReferenceEx.queueName, m_SignatureClientBehaviour.signatureId, m_SignatureClientBehaviour.signatureAccount, m_SignatureClientBehaviour.uri, m_SignatureClientBehaviour.providerParameter, null); if (context != null && context.instance != null) { byte[] biometricFinalState = sealSignBSSWacomSTUPanel1.GetSignature(context.instance, context.biometricState); if (biometricFinalState != null) { m_signedDocument = service.EndBiometricSignatureProvider( context.instance, biometricFinalState, m_jobReferenceEx.id, m_signatureIndex, m_jobReferenceEx.queueName, m_SignatureClientBehaviour.uri, m_SignatureClientBehaviour.providerParameter); } else { // Te error has already reported on the error handler return; } } m_otherProgressWindow.SetMessage(Tools.GetLocalizedString("SignatureSuccess"), 1500); m_otherProgressWindow.Close(); this.DialogResult = DialogResult.OK; } catch (Exception ex) { sealSignBSSWacomSTUPanel1.Stop(); m_otherProgressWindow.Close(); Tools.ShowUnexpectedError(this, ex); } finally { if (service != null) { try { service.Close(); } catch { } } this.CloseWindow(); bSigning = false; } }