Sdílet prostřednictvím


XpsSignatureDefinition.SpotId Vlastnost

Definice

Získá nebo nastaví jedinečný identifikátor pro tento XpsSignatureDefinition.

public:
 property Nullable<Guid> SpotId { Nullable<Guid> get(); void set(Nullable<Guid> value); };
public Guid? SpotId { get; set; }
member this.SpotId : Nullable<Guid> with get, set
Public Property SpotId As Nullable(Of Guid)

Hodnota vlastnosti

A (Nullable), Guid který představuje ID definice podpisu. Výchozí hodnota je null.

Příklady

Následující příklad ukazuje, jak nastavit tuto vlastnost.


private void SignatureDefinitionCommandHandler(object sender, RoutedEventArgs e)
{
    SignatureDefinition sigDefDialog = new SignatureDefinition();
    if (sigDefDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
    {
        XpsSignatureDefinition signatureDefinition = new XpsSignatureDefinition();
        signatureDefinition.RequestedSigner = sigDefDialog.RequestedSigner.Text;
        signatureDefinition.Intent = sigDefDialog.Intent.Text;
        signatureDefinition.SigningLocale = sigDefDialog.SigningLocale.Text;
        try
        {
            signatureDefinition.SignBy = DateTime.Parse(sigDefDialog.SignBy.Text);
        }
        catch (FormatException)
        {
        }
        signatureDefinition.SpotId = Guid.NewGuid();
        IXpsFixedDocumentSequenceReader docSeq = _xpsDocument.FixedDocumentSequenceReader; //_xpsDocument is type System.Windows.Xps.Packaging.XpsDocument
        IXpsFixedDocumentReader doc = docSeq.FixedDocuments[0];
        doc.AddSignatureDefinition(signatureDefinition);
        doc.CommitSignatureDefinition();
        InitializeSignatureDisplay();
    }
}

Private Sub SignatureDefinitionCommandHandler(sender As Object, e As RoutedEventArgs)
    Using sigDefDialog As New SignatureDefinition()
        If sigDefDialog.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            Dim signatureDefinition As New XpsSignatureDefinition With {
                .RequestedSigner = sigDefDialog.RequestedSigner.Text,
                .Intent = sigDefDialog.Intent.Text,
                .SigningLocale = sigDefDialog.SigningLocale.Text
            }
            Try
                signatureDefinition.SignBy = Date.Parse(sigDefDialog.SignBy.Text)
            Catch e1 As FormatException
            End Try
            signatureDefinition.SpotId = Guid.NewGuid()
            Dim docSeq As IXpsFixedDocumentSequenceReader = _xpsDocument.FixedDocumentSequenceReader '_xpsDocument is type System.Windows.Xps.Packaging.XpsDocument
            Dim doc As IXpsFixedDocumentReader = docSeq.FixedDocuments(0)
            doc.AddSignatureDefinition(signatureDefinition)
            doc.CommitSignatureDefinition()
            InitializeSignatureDisplay()
        End If
    End Using
End Sub

Poznámky

Chcete-li propojit Signature prvek s tímto XpsSignatureDefinitionobjektem Id , je nutné nastavit atribut atributu Signature na hodnotu SpotId vlastnosti. Další informace o Signature prvcích najdete v tématu Open Packaging Conventions schéma.

Další informace o atributu SpotID elementu SignatureDefinition v balíčku XPS (XML Paper Specification) najdete v kapitole 10 specifikace XPS (XML Paper Specification), kterou můžete získat v XPS: Specifikace a stažení licencí.

Platí pro