private void SaveSignature() { if (SigChanged) { //This check short-circuits so that sigBoxTopaz.Visible will not be checked in MONO ever. //if(allowTopaz && sigBoxTopaz.Visible) { if (sigBoxTopaz.Visible) { TPcur.SigIsTopaz = true; if (CodeBase.TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz) == 0) { TPcur.Signature = ""; return; } CodeBase.TopazWrapper.SetTopazCompressionMode(sigBoxTopaz, 0); CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 0); CodeBase.TopazWrapper.SetTopazKeyString(sigBoxTopaz, TreatPlans.GetHashString(TPcur, proctpList)); CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 2); CodeBase.TopazWrapper.SetTopazCompressionMode(sigBoxTopaz, 2); TPcur.Signature = CodeBase.TopazWrapper.GetTopazString(sigBoxTopaz); } else { TPcur.SigIsTopaz = false; if (sigBox.NumberOfTabletPoints() == 0) { TPcur.Signature = ""; return; } //sigBox.SetSigCompressionMode(0); //sigBox.SetEncryptionMode(0); sigBox.SetKeyString(TreatPlans.GetHashString(TPcur, proctpList)); //"0000000000000000"); //sigBox.SetAutoKeyData(ProcCur.Note+ProcCur.UserNum.ToString()); //sigBox.SetEncryptionMode(2); //sigBox.SetSigCompressionMode(2); TPcur.Signature = sigBox.GetSigString(); } } }
private void FormTPsign_Load(object sender, System.EventArgs e) { //this window never comes up for new TP. Always saved ahead of time. if (!Security.IsAuthorized(Permissions.TreatPlanEdit, TPcur.DateTP)) { butOK.Enabled = false; sigBox.Enabled = false; butClearSig.Enabled = false; butTopazSign.Enabled = false; } LayoutToolBar(); ToolBarMain.Buttons["FullPage"].Pushed = true; previewContr.Location = new Point(0, ToolBarMain.Bottom); previewContr.Size = new Size(ClientRectangle.Width, ClientRectangle.Height - ToolBarMain.Height - panelSig.Height); if (Document.DefaultPageSettings.PrintableArea.Height == 0) { Document.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100); } SetSize(); previewContr.Document = Document; ToolBarMain.Buttons["PageNum"].Text = (previewContr.StartPage + 1).ToString() + " / " + TotalPages.ToString(); labelInvalidSig.Visible = false; sigBox.Visible = true; proctpList = ProcTPs.RefreshForTP(TPcur.TreatPlanNum); if (TPcur.SigIsTopaz) { if (TPcur.Signature != "") { //if(allowTopaz) { sigBox.Visible = false; sigBoxTopaz.Visible = true; CodeBase.TopazWrapper.ClearTopaz(sigBoxTopaz); CodeBase.TopazWrapper.SetTopazCompressionMode(sigBoxTopaz, 0); CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 0); string keystring = TreatPlans.GetHashString(TPcur, proctpList); CodeBase.TopazWrapper.SetTopazKeyString(sigBoxTopaz, keystring); CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 2); //high encryption CodeBase.TopazWrapper.SetTopazCompressionMode(sigBoxTopaz, 2); //high encryption CodeBase.TopazWrapper.SetTopazSigString(sigBoxTopaz, TPcur.Signature); sigBoxTopaz.Refresh(); //If sig is not showing, then try encryption mode 3 for signatures signed with old SigPlusNet.dll. if (CodeBase.TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz) == 0) { CodeBase.TopazWrapper.SetTopazEncryptionMode(sigBoxTopaz, 3); //Unknown mode (told to use via TopazSystems) CodeBase.TopazWrapper.SetTopazSigString(sigBoxTopaz, TPcur.Signature); } if (CodeBase.TopazWrapper.GetTopazNumberOfTabletPoints(sigBoxTopaz) == 0) { labelInvalidSig.Visible = true; } //} } } else { if (TPcur.Signature != "") { sigBox.Visible = true; sigBoxTopaz.Visible = false; sigBox.ClearTablet(); //sigBox.SetSigCompressionMode(0); //sigBox.SetEncryptionMode(0); sigBox.SetKeyString(TreatPlans.GetHashString(TPcur, proctpList)); //"0000000000000000"); //sigBox.SetAutoKeyData(ProcCur.Note+ProcCur.UserNum.ToString()); //sigBox.SetEncryptionMode(2);//high encryption //sigBox.SetSigCompressionMode(2);//high compression sigBox.SetSigString(TPcur.Signature); if (sigBox.NumberOfTabletPoints() == 0) { labelInvalidSig.Visible = true; } sigBox.SetTabletState(0); //not accepting input. To accept input, change the note, or clear the sig. } } }