WalletBarcode WalletBarcode WalletBarcode WalletBarcode Class

Definition

Represents a bar code assigned to a wallet item.

public : sealed class WalletBarcode : IWalletBarcodepublic sealed class WalletBarcode : IWalletBarcodePublic NotInheritable Class WalletBarcode Implements IWalletBarcode// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Remarks

Use WalletBarcode(WalletBarcodeSymbology, String) to construct a scheme-generated barcode image (which is realized when you call GetImageAsync ). Use WalletBarcode(IRandomAccessStreamReference) to construct a barcode that you supply the image for.

The WalletBarcode class provides the value for the WalletItem.Barcode property.

Constructors

WalletBarcode(WalletBarcodeSymbology, String) WalletBarcode(WalletBarcodeSymbology, String) WalletBarcode(WalletBarcodeSymbology, String) WalletBarcode(WalletBarcodeSymbology, String)

Initializes a new instance of the WalletBarcode class.

public : WalletBarcode(WalletBarcodeSymbology symbology, PlatForm::String value)public WalletBarcode(WalletBarcodeSymbology symbology, String value)Public Sub New(symbology As WalletBarcodeSymbology, value As String)// You can use this method in JavaScript.
Parameters
symbology
WalletBarcodeSymbology WalletBarcodeSymbology WalletBarcodeSymbology WalletBarcodeSymbology

The symbology type for this barcode. Use one of the supported symbologies, such as Upca. Don't set to Invalid or Custom.

value
PlatForm::String String String String

The message (Value ) that the barcode represents.

See Also

WalletBarcode(IRandomAccessStreamReference) WalletBarcode(IRandomAccessStreamReference) WalletBarcode(IRandomAccessStreamReference) WalletBarcode(IRandomAccessStreamReference)

Initializes a new instance of the WalletBarcode class.

public : WalletBarcode(IRandomAccessStreamReference streamToBarcodeImage)public WalletBarcode(IRandomAccessStreamReference streamToBarcodeImage)Public Sub New(streamToBarcodeImage As IRandomAccessStreamReference)// You can use this method in JavaScript.
Parameters
See Also

Properties

Symbology Symbology Symbology Symbology

Gets the symbology used by the bar code.

public : WalletBarcodeSymbology Symbology { get; }public WalletBarcodeSymbology Symbology { get; }Public ReadOnly Property Symbology As WalletBarcodeSymbology// You can use this property in JavaScript.

Remarks

A symbology is the convention that defines the mapping between barcodes and the messages they represent. Barcodes for wallet items support several of the most common barcode symbologies, as defined by the values in WalletBarcodeSymbology. For other symbologies, you can provide your own barcode image (construct using WalletBarcode(IRandomAccessStreamReference) ).

See Also

Value Value Value Value

Gets a string representation of the barcode (its message).

public : PlatForm::String Value { get; }public string Value { get; }Public ReadOnly Property Value As string// You can use this property in JavaScript.
Value
PlatForm::String string string string

The string representation of the barcode, which is the data message that the barcode represents.

Methods

GetImageAsync() GetImageAsync() GetImageAsync() GetImageAsync()

Creates and returns a bitmap image stream for the barcode (or returns the custom image used during instantiation).

public : IAsyncOperation<IRandomAccessStreamReference> GetImageAsync()public IAsyncOperation<IRandomAccessStreamReference> GetImageAsync()Public Function GetImageAsync() As IAsyncOperation( Of IRandomAccessStreamReference )// You can use this method in JavaScript.
Returns

An asynchronous operation. If you use Asynchronous programming, the result type on successful completion is an IRandomAccessStreamReference instance. This can be assigned as the source for an image (with some additional code).

Remarks

If the WalletBarcode object was instantiated using the WalletBarcode constructor that takes a custom image as a parameter, that custom image is returned on completion. Otherwise, an image of the system-defined barcode is created and then returned.

This method doesn't literally return an image object that's ready for UI, it returns a stream that defines a bitmap image. To actually set an image in JavaScript, you can use code similar to this:

var awns = Windows.ApplicationModel.Wallet;
var wbc = new awns.WalletBarcode(awns.WalletBarcodeSymbology.qr, "123123123123");
wbc.getImageAsync().done(function (img) {
    if (img) {
        var img1 = document.getElementById("img1"); //existing <img> tag in this script's scope
        img.openReadAsync().done(function (blob) {
            var stream = MSApp.createStreamFromInputStream("image/bmp", blob);
            img1.src = URL.createObjectURL(stream);
        })
     }
});
See Also