﻿Imports System
Imports System.Linq
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports Bt
Imports Bt.ScanLib
'Imports KDPL1000.BtScanLib
Imports BTClientLib
Imports System.IO
Imports System.Reflection
Imports Newtonsoft
Imports Microsoft.WindowsCE.Forms
Imports BtScan2

Public Class frm1E30
    Inherits System.Windows.Forms.Form
    Private btScanLib As BtScanLib
    Private scanHandler As Boolean = False
    'Private dbClient As BtrieveDbClient
    Private tmpStr As List(Of Dictionary(Of String, String))
    Private affected_rows As Integer

#Region " Windows tH[€ fUCiลถฌณ๊ฝR[h "

    Public Sub New()
        MyBase.New()

        ' ฑฬฤัoตอ Windows tH[€ fUCiล•K—vลทB
        InitializeComponent()

        ' InitializeComponent() ฤัoตฬใษ๚ป๐’วมตทB

    End Sub

    ' Form อAR“|[l“g๊——ษใ—๐ภsท้ฝ฿ษ dispose ๐I[o[ChตทB
    'Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
    '    If disposing Then
    '        If Not (components Is Nothing) Then
    '            components.Dispose()
    '        End If
    '    End If
    '    MyBase.Dispose(disposing)
    'End Sub

    ' Windows tH[€ fUCiล•K—vลทB
    'Private components As System.ComponentModel.IContainer

    '  : ศบฬvV[WอAWindows tH[€ fUCiล•K—vลทB
    'Windows tH[€ fUCi๐gมฤ•ฯXตฤญพณขB  
    ' R[h GfB^๐gมฤ•ฯXตศขลญพณขB
    'Friend WithEvents WarpFrame1 As WarpControl.WarpFrame
    'Friend WithEvents WarpBox1 As WarpControl.WarpBox
    'Friend WithEvents wfName As WarpControl.WarpField
    'Friend WithEvents WarpHWBcr1 As WarpControl.WarpHWBcr
    'Friend WithEvents wfKey As WarpControl.WarpField
    'Friend WithEvents wfCheck As WarpControl.WarpField
    'Friend WithEvents wfTotal As WarpControl.WarpField
    'Friend WithEvents wfMSC As WarpControl.WarpField
    'Friend WithEvents wfPNT As WarpControl.WarpField
    'Friend WithEvents wfTrm As WarpControl.WarpField
    'Friend WithEvents wfCaseNo As WarpControl.WarpField
    'Friend WithEvents wfSerial As WarpControl.WarpField
    'Friend WithEvents wfPartNo As WarpControl.WarpField
    'Friend WithEvents wfCrtnNo As WarpControl.WarpField
    'Friend WithEvents wfCaseNo2 As WarpControl.WarpField
    'Friend WithEvents wfTrm2 As WarpControl.WarpField
    'Friend WithEvents wfPNT2 As WarpControl.WarpField
    'Friend WithEvents wfMSC2 As WarpControl.WarpField
    'Friend WithEvents wfLine As WarpControl.WarpField
    'Friend WithEvents wfLine2 As WarpControl.WarpField
    'Friend WithEvents WarpField1 As WarpControl.WarpField
    '<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    '    Me.WarpFrame1 = New WarpControl.WarpFrame()
    '    Me.WarpField1 = New WarpControl.WarpField()
    '    Me.wfLine2 = New WarpControl.WarpField()
    '    Me.wfLine = New WarpControl.WarpField()
    '    Me.wfCaseNo2 = New WarpControl.WarpField()
    '    Me.wfTrm2 = New WarpControl.WarpField()
    '    Me.wfPNT2 = New WarpControl.WarpField()
    '    Me.wfMSC2 = New WarpControl.WarpField()
    '    Me.wfSerial = New WarpControl.WarpField()
    '    Me.wfPartNo = New WarpControl.WarpField()
    '    Me.wfCrtnNo = New WarpControl.WarpField()
    '    Me.wfCaseNo = New WarpControl.WarpField()
    '    Me.wfTrm = New WarpControl.WarpField()
    '    Me.wfPNT = New WarpControl.WarpField()
    '    Me.wfMSC = New WarpControl.WarpField()
    '    Me.wfTotal = New WarpControl.WarpField()
    '    Me.wfCheck = New WarpControl.WarpField()
    '    Me.wfName = New WarpControl.WarpField()
    '    Me.WarpBox1 = New WarpControl.WarpBox()
    '    Me.wfKey = New WarpControl.WarpField()
    '    Me.WarpHWBcr1 = New WarpControl.WarpHWBcr()
    '    Me.WarpFrame1.SuspendLayout()
    '    Me.SuspendLayout()
    '
    'WarpFrame1
    '
    'Me.WarpFrame1.Controls.Add(Me.WarpField1)
    'Me.WarpFrame1.Controls.Add(Me.wfLine2)
    'Me.WarpFrame1.Controls.Add(Me.wfLine)
    'Me.WarpFrame1.Controls.Add(Me.wfCaseNo2)
    'Me.WarpFrame1.Controls.Add(Me.wfTrm2)
    'Me.WarpFrame1.Controls.Add(Me.wfPNT2)
    'Me.WarpFrame1.Controls.Add(Me.wfMSC2)
    'Me.WarpFrame1.Controls.Add(Me.wfSerial)
    'Me.WarpFrame1.Controls.Add(Me.wfPartNo)
    'Me.WarpFrame1.Controls.Add(Me.wfCrtnNo)
    'Me.WarpFrame1.Controls.Add(Me.wfCaseNo)
    'Me.WarpFrame1.Controls.Add(Me.wfTrm)
    'Me.WarpFrame1.Controls.Add(Me.wfPNT)
    'Me.WarpFrame1.Controls.Add(Me.wfMSC)
    'Me.WarpFrame1.Controls.Add(Me.wfTotal)
    'Me.WarpFrame1.Controls.Add(Me.wfCheck)
    'Me.WarpFrame1.Controls.Add(Me.wfName)
    'Me.WarpFrame1.Controls.Add(Me.WarpBox1)
    'Me.WarpFrame1.Controls.Add(Me.wfKey)
    'Me.WarpFrame1.Font = New System.Drawing.Font("MS UI Gothic", 9.0!)
    'Me.WarpFrame1.Location = New System.Drawing.Point(0, 0)
    'Me.WarpFrame1.Name = "WarpFrame1"
    'Me.WarpFrame1.Size = New System.Drawing.Size(240, 296)
    'Me.WarpFrame1.TabIndex = 1
    'Me.WarpFrame1.Text = "WarpFrame1"
    'Me.WarpFrame1.UseMacro = False
    'Me.WarpFrame1.UseMacroFileName = ""
    '
    'WarpField1
    '
    'Me.WarpField1.DecimalPointPosition = CType(0, Short)
    'Me.WarpField1.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.WarpField1.FontSize = WarpControl.FontSizes.Small
    'Me.WarpField1.Format = ""
    'Me.WarpField1.Length = CType(1, Short)
    'Me.WarpField1.Location = New System.Drawing.Point(145, 7)
    'Me.WarpField1.MacroBcr = ""
    'Me.WarpField1.MacroIn = ""
    'Me.WarpField1.MacroKey = ""
    'Me.WarpField1.MacroOut = ""
    'Me.WarpField1.Name = "WarpField1"
    'Me.WarpField1.Size = New System.Drawing.Size(15, 30)
    'Me.WarpField1.TabIndex = CType(71, Short)
    'Me.WarpField1.Text = "/"
    '
    'wfLine2
    '
    'Me.wfLine2.DecimalPointPosition = CType(0, Short)
    'Me.wfLine2.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfLine2.Format = ""
    'Me.wfLine2.Length = CType(2, Short)
    'Me.wfLine2.Location = New System.Drawing.Point(4, 90)
    'Me.wfLine2.MacroBcr = ""
    'Me.wfLine2.MacroIn = ""
    'Me.wfLine2.MacroKey = ""
    'Me.wfLine2.MacroOut = ""
    'Me.wfLine2.Name = "wfLine2"
    'Me.wfLine2.Size = New System.Drawing.Size(36, 36)
    'Me.wfLine2.TabIndex = CType(70, Short)
    'Me.wfLine2.Text = "XX"
    '
    'wfLine
    '
    'Me.wfLine.DecimalPointPosition = CType(0, Short)
    'Me.wfLine.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfLine.Format = ""
    'Me.wfLine.Length = CType(2, Short)
    'Me.wfLine.Location = New System.Drawing.Point(4, 4)
    'Me.wfLine.MacroBcr = ""
    'Me.wfLine.MacroIn = ""
    'Me.wfLine.MacroKey = ""
    'Me.wfLine.MacroOut = ""
    'Me.wfLine.Name = "wfLine"
    'Me.wfLine.Size = New System.Drawing.Size(36, 36)
    'Me.wfLine.TabIndex = CType(69, Short)
    'Me.wfLine.Text = "XX"
    '
    'wfCaseNo2
    '
    'Me.wfCaseNo2.DecimalPointPosition = CType(0, Short)
    'Me.wfCaseNo2.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfCaseNo2.FontSize = WarpControl.FontSizes.Small4
    'Me.wfCaseNo2.Format = ""
    'Me.wfCaseNo2.Length = CType(9, Short)
    'Me.wfCaseNo2.Location = New System.Drawing.Point(156, 126)
    'Me.wfCaseNo2.MacroBcr = ""
    'Me.wfCaseNo2.MacroIn = ""
    'Me.wfCaseNo2.MacroKey = ""
    'Me.wfCaseNo2.MacroOut = ""
    'Me.wfCaseNo2.Name = "wfCaseNo2"
    'Me.wfCaseNo2.Size = New System.Drawing.Size(81, 18)
    'Me.wfCaseNo2.TabIndex = CType(68, Short)
    'Me.wfCaseNo2.Text = "XXX-XX-XX"
    '
    'wfTrm2
    '
    'Me.wfTrm2.DecimalPointPosition = CType(0, Short)
    'Me.wfTrm2.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfTrm2.FontSize = WarpControl.FontSizes.Small4
    'Me.wfTrm2.Format = ""
    'Me.wfTrm2.Length = CType(3, Short)
    'Me.wfTrm2.Location = New System.Drawing.Point(120, 126)
    'Me.wfTrm2.MacroBcr = ""
    'Me.wfTrm2.MacroIn = ""
    'Me.wfTrm2.MacroKey = ""
    'Me.wfTrm2.MacroOut = ""
    'Me.wfTrm2.Name = "wfTrm2"
    'Me.wfTrm2.Size = New System.Drawing.Size(27, 18)
    'Me.wfTrm2.TabIndex = CType(67, Short)
    'Me.wfTrm2.Text = "XXX"
    '
    'wfPNT2
    '
    'Me.wfPNT2.DecimalPointPosition = CType(0, Short)
    'Me.wfPNT2.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfPNT2.FontSize = WarpControl.FontSizes.Small4
    'Me.wfPNT2.Format = ""
    'Me.wfPNT2.Length = CType(3, Short)
    'Me.wfPNT2.Location = New System.Drawing.Point(84, 126)
    'Me.wfPNT2.MacroBcr = ""
    'Me.wfPNT2.MacroIn = ""
    'Me.wfPNT2.MacroKey = ""
    'Me.wfPNT2.MacroOut = ""
    'Me.wfPNT2.Name = "wfPNT2"
    'Me.wfPNT2.Size = New System.Drawing.Size(27, 18)
    'Me.wfPNT2.TabIndex = CType(66, Short)
    'Me.wfPNT2.Text = "XXX"
    '
    'wfMSC2
    '
    'Me.wfMSC2.DecimalPointPosition = CType(0, Short)
    'Me.wfMSC2.Font = New System.Drawing.Font("lr SVbN", 16.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfMSC2.FontSize = WarpControl.FontSizes.Small4
    'Me.wfMSC2.Format = ""
    'Me.wfMSC2.Length = CType(8, Short)
    'Me.wfMSC2.Location = New System.Drawing.Point(0, 126)
    'Me.wfMSC2.MacroBcr = ""
    'Me.wfMSC2.MacroIn = ""
    'Me.wfMSC2.MacroKey = ""
    'Me.wfMSC2.MacroOut = ""
    'Me.wfMSC2.Name = "wfMSC2"
    'Me.wfMSC2.Size = New System.Drawing.Size(72, 18)
    'Me.wfMSC2.TabIndex = CType(65, Short)
    'Me.wfMSC2.Text = "XXXX-XXX"
    '
    'wfSerial
    '
    'Me.wfSerial.DecimalPointPosition = CType(0, Short)
    'Me.wfSerial.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfSerial.FontSize = WarpControl.FontSizes.Small2
    'Me.wfSerial.Format = ""
    'Me.wfSerial.Length = CType(6, Short)
    'Me.wfSerial.Location = New System.Drawing.Point(144, 166)
    'Me.wfSerial.MacroBcr = ""
    'Me.wfSerial.MacroIn = ""
    'Me.wfSerial.MacroKey = ""
    'Me.wfSerial.MacroOut = ""
    'Me.wfSerial.Name = "wfSerial"
    'Me.wfSerial.Size = New System.Drawing.Size(72, 24)
    'Me.wfSerial.TabIndex = CType(64, Short)
    'Me.wfSerial.Text = "XXXXXX"
    '
    'wfPartNo
    '
    'Me.wfPartNo.DecimalPointPosition = CType(0, Short)
    'Me.wfPartNo.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfPartNo.FontSize = WarpControl.FontSizes.Small2
    'Me.wfPartNo.Format = ""
    'Me.wfPartNo.Length = CType(12, Short)
    'Me.wfPartNo.Location = New System.Drawing.Point(0, 166)
    'Me.wfPartNo.MacroBcr = ""
    'Me.wfPartNo.MacroIn = ""
    'Me.wfPartNo.MacroKey = ""
    'Me.wfPartNo.MacroOut = ""
    'Me.wfPartNo.Name = "wfPartNo"
    'Me.wfPartNo.Size = New System.Drawing.Size(144, 24)
    'Me.wfPartNo.TabIndex = CType(62, Short)
    'Me.wfPartNo.Text = "XXX-XX-XX"
    '
    'wfCrtnNo
    '
    'Me.wfCrtnNo.DecimalPointPosition = CType(0, Short)
    'Me.wfCrtnNo.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfCrtnNo.FontSize = WarpControl.FontSizes.Small2
    'Me.wfCrtnNo.Format = ""
    'Me.wfCrtnNo.Length = CType(8, Short)
    'Me.wfCrtnNo.Location = New System.Drawing.Point(0, 144)
    'Me.wfCrtnNo.MacroBcr = ""
    'Me.wfCrtnNo.MacroIn = ""
    'Me.wfCrtnNo.MacroKey = ""
    'Me.wfCrtnNo.MacroOut = ""
    'Me.wfCrtnNo.Name = "wfCrtnNo"
    'Me.wfCrtnNo.Size = New System.Drawing.Size(96, 24)
    'Me.wfCrtnNo.TabIndex = CType(59, Short)
    'Me.wfCrtnNo.Text = "XXXX-XXX"
    '
    'wfCaseNo
    '
    'Me.wfCaseNo.DecimalPointPosition = CType(0, Short)
    'Me.wfCaseNo.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfCaseNo.FontSize = WarpControl.FontSizes.Small2
    'Me.wfCaseNo.Format = ""
    'Me.wfCaseNo.Length = CType(9, Short)
    'Me.wfCaseNo.Location = New System.Drawing.Point(0, 66)
    'Me.wfCaseNo.MacroBcr = ""
    'Me.wfCaseNo.MacroIn = ""
    'Me.wfCaseNo.MacroKey = ""
    'Me.wfCaseNo.MacroOut = ""
    'Me.wfCaseNo.Name = "wfCaseNo"
    'Me.wfCaseNo.Size = New System.Drawing.Size(108, 24)
    'Me.wfCaseNo.TabIndex = CType(56, Short)
    'Me.wfCaseNo.Text = "XXX-XX-XX"
    '
    'wfTrm
    '
    'Me.wfTrm.DecimalPointPosition = CType(0, Short)
    'Me.wfTrm.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfTrm.FontSize = WarpControl.FontSizes.Small2
    'Me.wfTrm.Format = ""
    'Me.wfTrm.Length = CType(3, Short)
    'Me.wfTrm.Location = New System.Drawing.Point(163, 39)
    'Me.wfTrm.MacroBcr = ""
    'Me.wfTrm.MacroIn = ""
    'Me.wfTrm.MacroKey = ""
    'Me.wfTrm.MacroOut = ""
    'Me.wfTrm.Name = "wfTrm"
    'Me.wfTrm.Size = New System.Drawing.Size(36, 24)
    'Me.wfTrm.TabIndex = CType(55, Short)
    'Me.wfTrm.Text = "XXX"
    '
    'wfPNT
    '
    'Me.wfPNT.DecimalPointPosition = CType(0, Short)
    'Me.wfPNT.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfPNT.FontSize = WarpControl.FontSizes.Small2
    'Me.wfPNT.Format = ""
    'Me.wfPNT.Length = CType(3, Short)
    'Me.wfPNT.Location = New System.Drawing.Point(102, 39)
    'Me.wfPNT.MacroBcr = ""
    'Me.wfPNT.MacroIn = ""
    'Me.wfPNT.MacroKey = ""
    'Me.wfPNT.MacroOut = ""
    'Me.wfPNT.Name = "wfPNT"
    'Me.wfPNT.Size = New System.Drawing.Size(36, 24)
    'Me.wfPNT.TabIndex = CType(54, Short)
    'Me.wfPNT.Text = "XXX"
    '
    'wfMSC
    '
    'Me.wfMSC.DecimalPointPosition = CType(0, Short)
    'Me.wfMSC.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfMSC.FontSize = WarpControl.FontSizes.Small2
    'Me.wfMSC.Format = ""
    'Me.wfMSC.Length = CType(8, Short)
    'Me.wfMSC.Location = New System.Drawing.Point(0, 40)
    'Me.wfMSC.MacroBcr = ""
    'Me.wfMSC.MacroIn = ""
    'Me.wfMSC.MacroKey = ""
    'Me.wfMSC.MacroOut = ""
    'Me.wfMSC.Name = "wfMSC"
    'Me.wfMSC.Size = New System.Drawing.Size(96, 24)
    'Me.wfMSC.TabIndex = CType(53, Short)
    'Me.wfMSC.Text = "XXXX-XXX"
    '
    'wfTotal
    '
    'Me.wfTotal.DecimalPointPosition = CType(0, Short)
    'Me.wfTotal.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfTotal.FontSize = WarpControl.FontSizes.Small
    'Me.wfTotal.Format = ""
    'Me.wfTotal.InputMode.Right = True
    'Me.wfTotal.Length = CType(5, Short)
    'Me.wfTotal.Location = New System.Drawing.Point(163, 7)
    'Me.wfTotal.MacroBcr = ""
    'Me.wfTotal.MacroIn = ""
    'Me.wfTotal.MacroKey = ""
    'Me.wfTotal.MacroOut = ""
    'Me.wfTotal.Name = "wfTotal"
    'Me.wfTotal.Size = New System.Drawing.Size(75, 30)
    'Me.wfTotal.TabIndex = CType(49, Short)
    'Me.wfTotal.Text = "ZZZZ9"
    '
    'wfCheck
    '
    'Me.wfCheck.DecimalPointPosition = CType(0, Short)
    'Me.wfCheck.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfCheck.FontSize = WarpControl.FontSizes.Small
    'Me.wfCheck.Format = ""
    'Me.wfCheck.InputMode.Right = True
    'Me.wfCheck.Length = CType(5, Short)
    'Me.wfCheck.Location = New System.Drawing.Point(64, 6)
    'Me.wfCheck.MacroBcr = ""
    'Me.wfCheck.MacroIn = ""
    'Me.wfCheck.MacroKey = ""
    'Me.wfCheck.MacroOut = ""
    'Me.wfCheck.Name = "wfCheck"
    'Me.wfCheck.Size = New System.Drawing.Size(75, 30)
    'Me.wfCheck.TabIndex = CType(47, Short)
    'Me.wfCheck.Text = "ZZZZ9"
    '
    'wfName
    '
    'Me.wfName.DecimalPointPosition = CType(0, Short)
    'Me.wfName.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfName.FontSize = WarpControl.FontSizes.Small2
    'Me.wfName.Format = ""
    'Me.wfName.Length = CType(20, Short)
    'Me.wfName.Location = New System.Drawing.Point(0, 216)
    'Me.wfName.MacroBcr = ""
    'Me.wfName.MacroIn = ""
    'Me.wfName.MacroKey = ""
    'Me.wfName.MacroOut = ""
    'Me.wfName.Name = "wfName"
    'Me.wfName.Size = New System.Drawing.Size(240, 24)
    'Me.wfName.TabIndex = CType(1, Short)
    '
    'WarpBox1
    '
    'Me.WarpBox1.BoxType = WarpControl.BoxTypes.Box
    'Me.WarpBox1.DrawMode = WarpControl.DrawModes.Line
    'Me.WarpBox1.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.WarpBox1.ForeColor = CType(15, Short)
    'Me.WarpBox1.Image = "C:\081-0030.jpg"
    'Me.WarpBox1.Location = New System.Drawing.Point(0, 192)
    'Me.WarpBox1.Name = "WarpBox1"
    'Me.WarpBox1.Size = New System.Drawing.Size(240, 24)
    'Me.WarpBox1.TabIndex = 0
    '
    'wfKey
    '
    'Me.wfKey.BcrFlag = True
    'Me.wfKey.DecimalPointPosition = CType(0, Short)
    'Me.wfKey.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfKey.ForeColor = CType(15, Short)
    'Me.wfKey.Format = ""
    'Me.wfKey.InputMode.Secret = True
    'Me.wfKey.Length = CType(1, Short)
    'Me.wfKey.Location = New System.Drawing.Point(204, 36)
    'Me.wfKey.MacroBcr = ""
    'Me.wfKey.MacroIn = ""
    'Me.wfKey.MacroKey = ""
    'Me.wfKey.MacroOut = ""
    'Me.wfKey.Name = "wfKey"
    'Me.wfKey.Size = New System.Drawing.Size(18, 36)
    'Me.wfKey.TabIndex = CType(45, Short)
    '
    'WarpHWBcr1
    '
    'Me.WarpHWBcr1.Decode.Code39 = True
    'Me.WarpHWBcr1.DiscreteFirstLen = CType(0, Short)
    'Me.WarpHWBcr1.DiscreteSecondLen = CType(0, Short)
    'Me.WarpHWBcr1.InterleavedFirstLen = CType(0, Short)
    'Me.WarpHWBcr1.InterleavedSecondLen = CType(0, Short)
    '
    'frm1E30
    '
    'Me.AutoScaleBaseSize = New System.Drawing.Size(5, 12)
    'Me.ClientSize = New System.Drawing.Size(240, 296)
    'Me.Controls.Add(Me.WarpFrame1)
    'Me.Font = New System.Drawing.Font("MS UI Gothic", 9.0!)
    'Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
    'Me.Name = "frm1E30"
    'Me.Text = "Form1"
    'Me.WarpFrame1.ResumeLayout(False)
    'Me.ResumeLayout(False)

    'End Sub

#End Region

    Public Enum M1E30_STATUS As Integer
        INIT = 0
        NOTCD = 1
        DONE = 2
    End Enum

    Public mint1E30status As Integer

    Private Sub frm1E30_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        Select Case e.KeyCode.ToString()
            Case "Return"
                Exit Sub
            Case "F1"
            Case "F2"
                gintStatus = PL_STATUS.QUIT
                Me.Close()
                Exit Sub
        End Select
    End Sub


    Private Sub frm1E30_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load

        '// Case QVGA -> resolution to 1/2
        If System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width = 240 Then
            Call resolution.VGAtoQVGA(Me)
        End If

        Dim rtn As Integer

        Try
            mint1E30status = M1E30_STATUS.INIT

            't[€ฬI[v“
            'rtn = WarpFrame1.Open
            'If (rtn <> 0) Then
            '    Err.Raise(vbObjectError + 1, gAppName, "WarpError")
            'End If

            '#If Not Debug Then
            '            sSetImgFName(G_CONST_MID_H1035, WarpBox1)
            '#End If

            sDisp1E30()
            ' tH[€EC“ ภs
            sMain()


            ' t[€ฬN[Y
            'rtn = WarpFrame1.Close()
            'If (rtn <> 0) Then
            '    Err.Raise(vbObjectError + 1, gAppName, "WarpError")
            'End If

            ' tH[€EN[Y
            'Me.Close()

            Exit Sub

        Catch ex As Exception
            sErrLog(gAppName, "", ex.ToString)
        End Try

    End Sub

    '/*
    '|| ึ”–ผFsDisp1E30
    '|| T—v  F1E30ๆ–ส•\ฆ
    '*/
    Private Sub sDisp1E30()
        With gstrctPLDispData
            'wfCheck.Puts(.intCheckCnt)
            'wfTotal.Puts(.intTotalCnt)

            wfCheck.Text = .intCheckCnt
            wfTotal.Text = .intTotalCnt

        End With
        With gstrctAicCase
            wfLine.Text = .Line
            wfMSC.Text = .Msc_Disp
            wfPNT.Text = .Pnt
            wfTrm.Text = .Trm
            wfCaseNo.Text = .CaseNo



        End With

        wfCrtnNo.Text = ""
        wfPartNo.Text = ""
        wfSerial.Text = ""
        With gstrctPLDispData
            If .strCartonNo = "" Then
                wfMSC2.Text = ""
                wfPNT2.Text = ""
                wfTrm2.Text = ""
                wfCaseNo2.Text = ""
                wfLine2.Text = ""
            Else
                If .strCartonNo = "00000" Then
                    wfMSC2.Text = ""
                    wfPNT2.Text = ""
                    wfTrm2.Text = ""
                    wfCaseNo2.Text = ""
                    wfCrtnNo.Text = ""
                    wfPartNo.Text = gstrctPLDispData.strItemCode
                    wfSerial.Text = gstrctPLDispData.strSerial
                    wfLine2.Text = ""
                Else
                    wfMSC2.Text = Mid(.strAicCaseNo, 1, 4) & "-" & Mid(.strAicCaseNo, 5, 3)
                    wfPNT2.Text = Mid(.strAicCaseNo, 8, 3)
                    wfTrm2.Text = Mid(.strAicCaseNo, 11, 3)
                    wfCaseNo2.Text = Mid(.strAicCaseNo, 14, 3) & "-" & Mid(.strAicCaseNo, 17, 2) & "-" & Mid(.strAicCaseNo, 19, 2)
                    wfCrtnNo.Text = gstrctPLDispData.strCartonNo
                    wfPartNo.Text = ""
                    wfSerial.Text = ""
                    wfLine2.Text = gstrctPLDispData.strLine
                End If
            End If
        End With

        wfName.Text = gstrctKDHT.strUserName
    End Sub

    Private Sub btScanLib_OnScan(ByVal result As String)
        Dim buf As String = result
        Dim rtn As Integer

        If (Not fCheckCode(buf)) Then
            sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
#If Not Debug Then
                                fFnc_WrpMsg("E", G_CONST_MID_E1E34)
#End If
        End If
        '“—อ—
        rtn = fProcInput(RTrim(buf))
        Select Case mint1E30status
            Case M1E30_STATUS.NOTCD              'ูศ้o[R[h
                sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
                sOutputLog(gstrctPicsIni.strOutput_KDPL, "KDPL1E30", G_CONST_BC_PART, buf)
#If Not Debug Then
                                    fFnc_WrpMsg("E", G_CONST_MID_E1E34)
#End If
                Exit Sub
            Case M1E30_STATUS.DONE

                RemoveHandler btScanLib.OnScan, AddressOf btScanLib_OnScan
                btScanLib.Disable()

                gintStatus = PL_STATUS.PCSCAN
                With gstrctPLDispData
                    .strCartonNo = ""
                    .strItemCode = ""
                    .strItemID = ""
                    .strSerial = ""
                End With
                fMakeCommandFile(G_CONST_PROCESS_HT_RTN, G_CONST_SPEECH_HTRESME)
                Me.Close()
                Exit Sub
        End Select



    End Sub

    ' t[€EC“
    Public Sub sMain()

        '        Dim WKey As Short
        '        Dim buf As String
        '        Dim rtn As Integer
        '        Dim stat As Integer

        '        Try

        '            ' t[€ฬ—๐ฑฑษLqตทB
        '            Do While (True)

        '                ' R[h“—อ
        '                WKey = WarpFrame1.Input(wfKey)

        '                If WKey = WKY_ENT Then

        '                ElseIf WKey = WKY_BCR Then
        '                    'สฐบฐฤ“—อฬๆ“พ
        '                    rtn = WarpHWBcr1.Get(buf)
        '                    sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.OK)
        '                    If (rtn <> 0) Then
        '                        Err.Raise(vbObjectError + 1, gAppName, "WarpError")
        '                    End If

        '                    'มชฏธรจผฏฤ
        '                    If (Not fCheckCode(buf)) Then
        '                        sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '#If Not Debug Then
        '                        fFnc_WrpMsg("E", G_CONST_MID_E1E34)
        '#End If
        '                        Exit Do
        '                    End If
        '                    '“—อ—
        '                    rtn = fProcInput(RTrim(buf))
        '                    Select Case mint1E30status
        '                        Case M1E30_STATUS.NOTCD              'ูศ้o[R[h
        '                            sBeepSound(modPublicHT.BEEP_TYPE.A, modPublicHT.BEEP_SELECTION.NG)
        '                            sOutputLog(gstrctPicsIni.strOutput_KDPL, "KDPL1E30", G_CONST_BC_PART, buf)
        '#If Not Debug Then
        '                            fFnc_WrpMsg("E", G_CONST_MID_E1E34)
        '#End If

        '                        Case M1E30_STATUS.DONE

        '                            gintStatus = PL_STATUS.PCSCAN
        '                            With gstrctPLDispData
        '                                .strCartonNo = ""
        '                                .strItemCode = ""
        '                                .strItemID = ""
        '                                .strSerial = ""
        '                            End With
        '                            fMakeCommandFile(G_CONST_PROCESS_HT_RTN, G_CONST_SPEECH_HTRESME)
        '                            Exit Do

        '                    End Select

        '                ElseIf WKey = WKY_ERROR Then

        '                    f0.WarpCtrl1.MessageBox(G_CONST_EMT_WARP, G_CONST_EM_WARP, MWA_DB_WARNING, MWA_DB_OK)

        '                ElseIf WKey = WKY_F2 Then
        '                    'gintStatus = PL_STATUS.ENTKEY
        '                    'Exit Do
        '                End If
        '            Loop

        '            Exit Sub

        '        Catch ex As Exception
        '            sErrLog(gAppName, "sMain", ex.ToString)
        '        End Try

    End Sub

    Private Function sDecodeScnData(ByVal pstrFlag As String, ByVal pstrScanData As String, ByRef pstrctData As KDPL_DISP_DATA)
        If pstrFlag = "C" Then
            With pstrctData
                .strItemID = Space(1)
                .strItemCode = Space(30)
                .strSerial = Space(6)
                .strCartonNo = RTrim(Mid(pstrScanData, 22, 5))
                .strAicCaseNo = RTrim(Mid(pstrScanData, 2, 20))
            End With
        ElseIf pstrFlag = "P" Then
            With pstrctData
                .strCartonNo = "00000"
                .strItemID = "P"
                .strItemCode = RTrim(Mid(pstrScanData, 2, 13))
                .strSerial = RTrim(Mid(pstrScanData, 20, 6))
                .strAicCaseNo = ""
            End With
        End If
    End Function

    '/*
    '|| ึ”–ผFfProcInput
    '|| T—v  F“—อ—
    '*/
    Private Function fProcInput(ByVal pstrInput As String) As Integer
        fProcInput = -1

        Try

            If pstrInput = "OCRESET" Then
                mint1E30status = M1E30_STATUS.DONE
                fProcInput = 0
                Exit Function
            Else
                mint1E30status = M1E30_STATUS.NOTCD
                fProcInput = 0
                Exit Function
            End If

        Catch ex As Exception
            sErrLog(gAppName, "fProcInput", ex.ToString)
        End Try
    End Function

    Private Sub frm1E30_Activated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Activated
        ' Enable BTScanLib
        If Not scanHandler Then
            btScanLib = btScanLib.getInstance()
            AddHandler btScanLib.OnScan, AddressOf btScanLib_OnScan
            scanHandler = True
            btScanLib.Debug = False
            btScanLib.Enable()
        End If
    End Sub
End Class


