public DTUSignatureForm(int signatureIndex, SignatureClientBehaviour signatureClientBehaviour, JobReferenceEx jobReferenceEx)
        {
            try
            {
                m_SignatureClientBehaviour = signatureClientBehaviour;
                m_jobReferenceEx           = jobReferenceEx;
                m_signatureIndex           = signatureIndex;

                m_ErrorCaptureEvent += new SealSignBSSClientLibrary.SealSignBSSPanel.ErrorCapture(sealSignBSSPanel1_ErrorCaptureEvent);

                m_progressWindow = new ProgressWindow(Convert.ToInt32(Tools.GetAppSettings("wacom_dtu_screen_number")) - 1);

                InitializeComponent();
            }
            catch (Exception ex)
            {
                if (m_progressWindow != null)
                {
                    m_progressWindow.Close();
                }

                Tools.ShowUnexpectedError(this, ex);
            }
        }
        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;
            }
        }