Exemplo n.º 1
0
        private void FillSignatureHelperTopaz(string keyData, string signature)
        {
            if (!CheckTopaz())
            {
                return;
            }
            //According to Jeff Robertson from Topaz, the method SetKeyString() should be used to clear out the key string before loading a signature.
            //For that reason, it should only be called with 16 zeros as its arguments. The actual data that the signature will be bound to should be passed
            //to the method SetAutoKeyData().
            sigBox.Visible          = false;
            sigBoxTopaz.Visible     = true;
            labelInvalidSig.Visible = false;
            TopazWrapper.ClearTopaz(sigBoxTopaz);
            TopazWrapper.SetTopazCompressionMode(sigBoxTopaz, 0);
            TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 0);
            TopazWrapper.SetTopazKeyString(sigBoxTopaz, "0000000000000000"); //Clear out the key string
            TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 2);             //high encryption
            TopazWrapper.SetTopazCompressionMode(sigBoxTopaz, 2);            //high compression
            string hashedKeyData;

            switch (_signatureMode)
            {
            case SigMode.TreatPlan:
                hashedKeyData = TreatPlans.GetHashStringForSignature(keyData);                      //Passed in key data has not been hashed yet.
                TopazWrapper.SetTopazAutoKeyData(sigBoxTopaz, hashedKeyData);
                break;

            case SigMode.OrthoChart:
                hashedKeyData = OrthoCharts.GetHashStringForSignature(keyData);                      //Passed in key data has not been hashed yet.
                TopazWrapper.SetTopazAutoKeyData(sigBoxTopaz, hashedKeyData);
                break;

            case SigMode.Document:
            case SigMode.Default:
            default:
                TopazWrapper.SetTopazAutoKeyData(sigBoxTopaz, keyData);
                break;
            }
            TopazWrapper.SetTopazSigString(sigBoxTopaz, signature);
            if (TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz) == 0)
            {
                //Try reading in the signature using the old way that we used to handle signatures.
                FillSignatureTopazOld(keyData, signature);
            }
            //If sig still not showing it must be invalid.
            if (TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz) == 0)
            {
                labelInvalidSig.Visible = true;
            }
            TopazWrapper.SetTopazState(sigBoxTopaz, 0);
        }
Exemplo n.º 2
0
 ///<summary>If this is called externally, then the event SignatureChanged will also fire.</summary>
 public void ClearSignature()
 {
     sigBox.Enabled = true;
     sigBox.ClearTablet();
     sigBox.Visible = true;
     //if(allowTopaz) {
     TopazWrapper.ClearTopaz(sigBoxTopaz);
     sigBoxTopaz.Visible = false;         //until user explicitly starts it.
     //}
     sigBox.SetTabletState(1);            //on-screen box is now accepting input.
     sigChanged = true;
     labelInvalidSig.Visible = false;
     OnSignatureChanged();
 }
Exemplo n.º 3
0
 private void butTopazSign_Click(object sender, EventArgs e)
 {
     //this button is not even visible if Topaz is not allowed
     if (SignTopazClicked != null)
     {
         SignTopazClicked(this, new EventArgs());
     }
     sigBox.Visible      = false;
     sigBoxTopaz.Visible = true;
     //if(allowTopaz){
     TopazWrapper.ClearTopaz(sigBoxTopaz);
     TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 0);
     TopazWrapper.SetTopazState(sigBoxTopaz, 1);
     //}
     labelInvalidSig.Visible = false;
     sigBoxTopaz.Focus();
     OnSignatureChanged();
 }
Exemplo n.º 4
0
 ///<summary>If this is called externally, then the event SignatureChanged will also fire.</summary>
 public void ClearSignature(bool clearTopazTablet = true)
 {
     sigBox.Enabled = true;
     sigBox.ClearTablet();
     sigBox.Visible = true;
     if (sigBoxTopaz != null)
     {
         if (clearTopazTablet)
         {
             TopazWrapper.ClearTopaz(sigBoxTopaz);
         }
         sigBoxTopaz.Visible = false;     //until user explicitly starts it.
     }
     sigBox.SetTabletState(1);            //on-screen box is now accepting input.
     SigChanged = true;
     labelInvalidSig.Visible = false;
     OnSignatureChanged();
 }