/// <summary>
        /// How to use "PosExplorer" sample1.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExample1_Click(object sender, System.EventArgs e)
        {
            //Use a Logical Device Name which has been set on the SetupPOS.
            try
            {
                //Create PosExplorer
                PosExplorer posExplorer = new PosExplorer();

                DeviceInfo deviceInfo = null;

                //Get DeviceInfo use devicecategory and logicalname.
                deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, m_strLogicalName);

                m_PosCommon = (PosCommon)posExplorer.CreateInstance(deviceInfo);

                //Open the device
                m_PosCommon.Open();

                //Get the exclusive control right for the opened device.
                //Then the device is disable from other application.
                m_PosCommon.Claim(1000);

                //Enable the device.
                m_PosCommon.DeviceEnabled = true;

                //CheckHealth.
                m_PosCommon.CheckHealth(Microsoft.PointOfService.HealthCheckLevel.Interactive);

                //Close device
                m_PosCommon.Close();
            }
            catch (Exception)
            {
            }
        }
        /// <summary>
        /// How to use "PosExplorer" sample2.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnExample2_Click(object sender, System.EventArgs e)
        {
            try
            {
                //Create PosExplorer
                PosExplorer      posExplorer = new PosExplorer();
                DeviceInfo       deviceInfo  = null;
                DeviceCollection deviceCollection;

                //Get DeviceCollection use device categoly
                deviceCollection = posExplorer.GetDevices(DeviceType.PosPrinter);
                string[] astrLogicalNames;

                Hashtable hashDevice = new Hashtable(0);
                foreach (DeviceInfo devInfo in deviceCollection)
                {
                    //if the device name is registered.
                    if (devInfo.LogicalNames.Length > 0)
                    {
                        astrLogicalNames = devInfo.LogicalNames;
                        for (int i = 0; i < astrLogicalNames.Length; i++)
                        {
                            if (!hashDevice.ContainsKey(astrLogicalNames[i]))
                            {
                                m_PosCommon = (PosCommon)posExplorer.CreateInstance(devInfo);

                                //Use Legacy Opos
                                //if(m_PosCommon.Compatibility.Equals(DeviceCompatibilities.Opos))
                                //Use Opos for .Net
                                if (m_PosCommon.Compatibility.Equals
                                        (DeviceCompatibilities.CompatibilityLevel1))
                                {
                                    try
                                    {
                                        //Register hashtable key:LogicalName,Value:DeviceInfo
                                        hashDevice.Add(astrLogicalNames[i], devInfo);
                                    }
                                    catch (Exception)
                                    {
                                    }
                                }
                            }
                        }
                    }
                }

                deviceInfo = (DeviceInfo)hashDevice[m_strLogicalName];

                m_PosCommon = (PosCommon)posExplorer.CreateInstance(deviceInfo);

                //Open the device
                m_PosCommon.Open();

                //Get the exclusive control right for the opened device.
                //Then the device is disable from other application.
                m_PosCommon.Claim(1000);

                //Enable the device.
                m_PosCommon.DeviceEnabled = true;

                //CheckHealth.
                m_PosCommon.CheckHealth(Microsoft.PointOfService.HealthCheckLevel.Interactive);

                //Close device
                m_PosCommon.Close();
            }
            catch (Exception)
            {
            }
        }