SignEvent.ReturnStatus 属性

定义

获取或设置事件的返回状态 OnSign

public:
 property bool ReturnStatus { bool get(); void set(bool value); };
public bool ReturnStatus { get; set; }
member this.ReturnStatus : bool with get, set
Public Property ReturnStatus As Boolean

属性值

实现

示例

在以下示例中,如果在 OnSign 事件处理程序中将 ReturnStatus 属性设置为 false,则将再次显示数字签名向导,以将另一个签名添加到可以签名的数据集中。 对于可以签名的第一组数据,如果已存在三个签名,则 OnSign 事件处理程序将退出, 并将 ReturnStatus 属性设置为 true,这会关闭数字签名向导并显示警报:

[InfoPathEventHandler(EventType=InfoPathEventType.OnSign)]
public void OnSign(SignEvent e)
{
 Signature thisSignature = e.SignedDataBlock.Signatures.Create();

 // check if the current signed data block is the first signed data block in list
 // if it is the first signed data block, then do special handling
 // else use the default handler (triggered by e.ReturnStatus = false)

 if ( e.SignedDataBlock.Name == thisXDocument.SignedDataBlocks[0].Name )
 {
  // check the number of signatures in the first signed data block
  // if there are three signatures, don’t add another signature  and set ReturnStatus to true)
  // else add the signature (use the Sign() method to show the wizard) and don’t do anything else (ReturnStatus is true)
  if ( thisXDocument.SignedDataBlocks[0].Signatures.Count > 3 )
  {
   thisXDocument.UI.Alert("Only 3 signatures are allowed on this set of data : " + e.SignedDataBlock.Name );
   e.<span class="label">ReturnStatus</span> = true;
  }
  else
  {
   thisSignature.Sign();
   e.<span class="label">ReturnStatus</span> = true;
  }
 }
 else
 {
  e.<span class="label">ReturnStatus</span> = false;
 }
}

注解

如果对象的 ReturnStatus 属性 SignEventObject 设置为 false,则会显示“数字签名向导”对话框,直到用户退出对话框。

适用于