VintaSoft Barcode .NET SDK v10.0
Vintasoft.Barcode.BarcodeInfo Namespace / MailmarkCmdmValueItem Class
Members Example




In This Topic
    MailmarkCmdmValueItem Class
    In This Topic
    Contains information about a decoded value of Mailmark CMDM 2D barcode.
    Object Model
    MailmarkCmdmValueItem Class
    Syntax
    'Declaration
     
    Public Class MailmarkCmdmValueItem 
       Inherits ValueItemBase
    'Usage
     
    Dim instance As MailmarkCmdmValueItem
    public class MailmarkCmdmValueItem : ValueItemBase 
    public __gc class MailmarkCmdmValueItem : public ValueItemBase 
    public ref class MailmarkCmdmValueItem : public ValueItemBase 
    Example
    Here is a simple example that demonstrates how to generate Mailmark CMDM 2D barcode:
    Imports System.Drawing   
       
    Imports Vintasoft.Barcode   
    Imports Vintasoft.Barcode.BarcodeInfo   
    Imports Vintasoft.Barcode.SymbologySubsets   
       
    ''' <summary>   
    ''' Test that demonstrates how to generate an image with Mailmark CMDM Type29 barcode and   
    ''' how to recognize Mailmark CMDM Type29 barcode on the image.   
    ''' </summary>   
    Class MailmarkCmdmValueItemExample   
       
    	''' <summary>   
    	''' Runs the test.   
    	''' </summary>   
    	Public Shared Sub Test()   
    		' create the Mailmark CMDM 2D barcode value   
    		Dim item As New MailmarkCmdmValueItem()   
    		item.InformationTypeId = "0"   
    		item.VersionId = "1"   
    		item.[Class] = "0"   
    		item.SupplyChainId = "1000009"   
    		item.ItemId = "00009609"   
    		item.Dps = "W1T1HQ9Z "   
    		item.RtsFlag = "0"   
    		item.ReturnToSenderPostCode = "SN35XX "   
    		item.CustomerContent = "ABCDEFGHIJ1234567890A"   
       
    		' create the barcode writer   
    		Dim writer As New BarcodeWriter()   
       
    		' encode Mailmark CMDM Type29 barcode   
    		BarcodeSymbologySubsets.MailmarkCmdmType29.Encode(item, writer.Settings)   
       
    		Dim infos As IBarcodeInfo()   
       
    		' get image with barcode   
    		Using image As Image = writer.GetBarcodeAsBitmap()   
    			' create the barcode reader   
    			Using reader As New BarcodeReader()   
    				' specify that reader must search for Mailmark CMDM Type29 barcodes only   
    				reader.Settings.ScanBarcodeTypes = BarcodeType.None   
    				reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.MailmarkCmdmType29)   
       
    				' recognize barcode   
    				infos = reader.ReadBarcodes(image)   
    			End Using   
    		End Using   
       
    		' get barcode value   
    		Dim readItem As MailmarkCmdmValueItem = DirectCast(infos(0).ValueItems(0), MailmarkCmdmValueItem)   
       
    		' print barcode value   
    		Console.WriteLine("Decoded value =              '{0}'", item.ToString())   
    		Console.WriteLine("Information Type ID =        '{0}'", item.InformationTypeId)   
    		Console.WriteLine("Version ID =                 '{0}'", item.VersionId)   
    		Console.WriteLine("Class =                      '{0}'", item.[Class])   
    		Console.WriteLine("Supply Chain ID =            '{0}'", item.SupplyChainId)   
    		Console.WriteLine("Item ID =                    '{0}'", item.ItemId)   
    		Console.WriteLine("DPS =                        '{0}'", item.Dps)   
    		Console.WriteLine("RTS Flag =                   '{0}'", item.RtsFlag)   
    		Console.WriteLine("Return To Sender Post Code = '{0}'", item.ReturnToSenderPostCode)   
    		Console.WriteLine("Customer Content =           '{0}'", item.CustomerContent)   
       
    		' check recognized barcode value   
    		If item.ToString() <> readItem.ToString() Then   
    			Throw New ApplicationException()   
    		End If   
    	End Sub   
    End Class   
       
    ' This code example produces the following output:    
    '   
    '   Decoded value =              'JGB 010100000900009609W1T1HQ9Z 0SN35XX       ABCDEFGHIJ1234567890A'   
    '   Information Type ID =        '0'   
    '   Version ID =                 '1'   
    '   Class =                      '0'   
    '   Supply Chain ID =            '1000009'   
    '   Item ID =                    '00009609'   
    '   DPS =                        'W1T1HQ9Z '   
    '   RTS Flag =                   '0'   
    '   Return To Sender Post Code = 'SN35XX '   
    '   Customer Content =           'ABCDEFGHIJ1234567890A'   
    '
    using System;
    using System.Drawing;
                
    using Vintasoft.Barcode;
    using Vintasoft.Barcode.BarcodeInfo;
    using Vintasoft.Barcode.SymbologySubsets;
                
    /// <summary>
    /// Test that demonstrates how to generate an image with Mailmark CMDM Type29 barcode and
    /// how to recognize Mailmark CMDM Type29 barcode on the image.
    /// </summary>
    class MailmarkCmdmValueItemExample
    {
                
        /// <summary>
        /// Runs the test.
        /// </summary>
        public static void Test()
        {
            // create the Mailmark CMDM 2D barcode value
            MailmarkCmdmValueItem item = new MailmarkCmdmValueItem();
            item.InformationTypeId = "0";
            item.VersionId = "1";
            item.Class = "0";
            item.SupplyChainId = "1000009";
            item.ItemId = "00009609";
            item.Dps = "W1T1HQ9Z ";
            item.RtsFlag = "0";
            item.ReturnToSenderPostCode = "SN35XX ";
            item.CustomerContent = "ABCDEFGHIJ1234567890A";
                
            // create the barcode writer
            BarcodeWriter writer = new BarcodeWriter();
            
            // encode Mailmark CMDM Type29 barcode
            BarcodeSymbologySubsets.MailmarkCmdmType29.Encode(item, writer.Settings);
            
            IBarcodeInfo[] infos;
            
            // get image with barcode
            using (Image image = writer.GetBarcodeAsBitmap())
            {
                // create the barcode reader
                using (BarcodeReader reader = new BarcodeReader())
                {
                    // specify that reader must search for Mailmark CMDM Type29 barcodes only
                    reader.Settings.ScanBarcodeTypes = BarcodeType.None;
                    reader.Settings.ScanBarcodeSubsets.Add(BarcodeSymbologySubsets.MailmarkCmdmType29);
                
                    // recognize barcode
                    infos = reader.ReadBarcodes(image);
                }
            }
                
            // get barcode value
            MailmarkCmdmValueItem readItem = (MailmarkCmdmValueItem)infos[0].ValueItems[0];
                
            // print barcode value
            Console.WriteLine("Decoded value =              '{0}'", item.ToString());
            Console.WriteLine("Information Type ID =        '{0}'", item.InformationTypeId);
            Console.WriteLine("Version ID =                 '{0}'", item.VersionId);
            Console.WriteLine("Class =                      '{0}'", item.Class);
            Console.WriteLine("Supply Chain ID =            '{0}'", item.SupplyChainId);
            Console.WriteLine("Item ID =                    '{0}'", item.ItemId);
            Console.WriteLine("DPS =                        '{0}'", item.Dps);
            Console.WriteLine("RTS Flag =                   '{0}'", item.RtsFlag);
            Console.WriteLine("Return To Sender Post Code = '{0}'", item.ReturnToSenderPostCode);
            Console.WriteLine("Customer Content =           '{0}'", item.CustomerContent);
                
            // check recognized barcode value
            if (item.ToString() != readItem.ToString())
                throw new ApplicationException();
        }
    }
                
    /* This code example produces the following output: 
                
       Decoded value =              'JGB 010100000900009609W1T1HQ9Z 0SN35XX       ABCDEFGHIJ1234567890A'
       Information Type ID =        '0'
       Version ID =                 '1'
       Class =                      '0'
       Supply Chain ID =            '1000009'
       Item ID =                    '00009609'
       DPS =                        'W1T1HQ9Z '
       RTS Flag =                   '0'
       Return To Sender Post Code = 'SN35XX '
       Customer Content =           'ABCDEFGHIJ1234567890A'
    */
    Inheritance Hierarchy

    System.Object
       Vintasoft.Barcode.BarcodeInfo.ValueItemBase
          Vintasoft.Barcode.BarcodeInfo.MailmarkCmdmValueItem

    Requirements

    Target Platforms: Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also