﻿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 frm1E70
    Inherits System.Windows.Forms.Form
    Private btScanLib As BtScanLib
    Private scanHandler As Boolean = False
    Private mintChkFlag As Integer
    '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 wfPallete As WarpControl.WarpField
    'Friend WithEvents wfCase As WarpControl.WarpField
    'Friend WithEvents wfPC As WarpControl.WarpField
    'Friend WithEvents wfChk1 As WarpControl.WarpField
    'Friend WithEvents wfChk2 As WarpControl.WarpField
    'Friend WithEvents wfChk3 As WarpControl.WarpField
    'Friend WithEvents wfKey As WarpControl.WarpField
    'Friend WithEvents wfLine As WarpControl.WarpField
    'Friend WithEvents wfSeq 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.wfSeq = New WarpControl.WarpField()
    '    Me.wfLine = New WarpControl.WarpField()
    '    Me.wfChk3 = New WarpControl.WarpField()
    '    Me.wfChk2 = New WarpControl.WarpField()
    '    Me.wfChk1 = New WarpControl.WarpField()
    '    Me.wfPC = New WarpControl.WarpField()
    '    Me.wfCase = New WarpControl.WarpField()
    '    Me.wfPallete = 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.wfSeq)
    'Me.WarpFrame1.Controls.Add(Me.wfLine)
    'Me.WarpFrame1.Controls.Add(Me.wfChk3)
    'Me.WarpFrame1.Controls.Add(Me.wfChk2)
    'Me.WarpFrame1.Controls.Add(Me.wfChk1)
    'Me.WarpFrame1.Controls.Add(Me.wfPC)
    'Me.WarpFrame1.Controls.Add(Me.wfCase)
    'Me.WarpFrame1.Controls.Add(Me.wfPallete)
    '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", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.WarpField1.Format = ""
    'Me.WarpField1.Length = CType(1, Short)
    'Me.WarpField1.Location = New System.Drawing.Point(42, 1)
    'Me.WarpField1.MacroBcr = ""
    'Me.WarpField1.MacroIn = ""
    'Me.WarpField1.MacroKey = ""
    'Me.WarpField1.MacroOut = ""
    'Me.WarpField1.Name = "WarpField1"
    'Me.WarpField1.Size = New System.Drawing.Size(18, 36)
    'Me.WarpField1.TabIndex = CType(12, 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(63, 1)
    '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(11, Short)
    'Me.wfLine2.Text = "XX"
    '
    'wfSeq
    '
    'Me.wfSeq.DecimalPointPosition = CType(0, Short)
    'Me.wfSeq.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfSeq.Format = ""
    'Me.wfSeq.Length = CType(3, Short)
    'Me.wfSeq.Location = New System.Drawing.Point(121, 1)
    'Me.wfSeq.MacroBcr = ""
    'Me.wfSeq.MacroIn = ""
    'Me.wfSeq.MacroKey = ""
    'Me.wfSeq.MacroOut = ""
    'Me.wfSeq.Name = "wfSeq"
    'Me.wfSeq.Size = New System.Drawing.Size(54, 36)
    'Me.wfSeq.TabIndex = CType(10, Short)
    'Me.wfSeq.Text = "999"
    '
    '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(1, 1)
    '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(9, Short)
    'Me.wfLine.Text = "XX"
    '
    'wfChk3
    '
    'Me.wfChk3.DecimalPointPosition = CType(0, Short)
    'Me.wfChk3.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfChk3.Format = ""
    'Me.wfChk3.Length = CType(2, Short)
    'Me.wfChk3.Location = New System.Drawing.Point(1, 144)
    'Me.wfChk3.MacroBcr = ""
    'Me.wfChk3.MacroIn = ""
    'Me.wfChk3.MacroKey = ""
    'Me.wfChk3.MacroOut = ""
    'Me.wfChk3.Name = "wfChk3"
    'Me.wfChk3.Size = New System.Drawing.Size(36, 36)
    'Me.wfChk3.TabIndex = CType(7, Short)
    '
    'wfChk2
    '
    'Me.wfChk2.DecimalPointPosition = CType(0, Short)
    'Me.wfChk2.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfChk2.Format = ""
    'Me.wfChk2.Length = CType(2, Short)
    'Me.wfChk2.Location = New System.Drawing.Point(0, 99)
    'Me.wfChk2.MacroBcr = ""
    'Me.wfChk2.MacroIn = ""
    'Me.wfChk2.MacroKey = ""
    'Me.wfChk2.MacroOut = ""
    'Me.wfChk2.Name = "wfChk2"
    'Me.wfChk2.Size = New System.Drawing.Size(36, 36)
    'Me.wfChk2.TabIndex = CType(6, Short)
    '
    'wfChk1
    '
    'Me.wfChk1.DecimalPointPosition = CType(0, Short)
    'Me.wfChk1.Font = New System.Drawing.Font("lr SVbN", 33.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfChk1.Format = ""
    'Me.wfChk1.Length = CType(2, Short)
    'Me.wfChk1.Location = New System.Drawing.Point(0, 52)
    'Me.wfChk1.MacroBcr = ""
    'Me.wfChk1.MacroIn = ""
    'Me.wfChk1.MacroKey = ""
    'Me.wfChk1.MacroOut = ""
    'Me.wfChk1.Name = "wfChk1"
    'Me.wfChk1.Size = New System.Drawing.Size(36, 36)
    'Me.wfChk1.TabIndex = CType(5, Short)
    '
    'wfPC
    '
    'Me.wfPC.DecimalPointPosition = CType(0, Short)
    'Me.wfPC.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfPC.FontSize = WarpControl.FontSizes.Small
    'Me.wfPC.Format = ""
    'Me.wfPC.Length = CType(11, Short)
    'Me.wfPC.Location = New System.Drawing.Point(42, 148)
    'Me.wfPC.MacroBcr = ""
    'Me.wfPC.MacroIn = ""
    'Me.wfPC.MacroKey = ""
    'Me.wfPC.MacroOut = ""
    'Me.wfPC.Name = "wfPC"
    'Me.wfPC.Size = New System.Drawing.Size(165, 30)
    'Me.wfPC.TabIndex = CType(4, Short)
    'Me.wfPC.Text = "Part/Carton"
    '
    'wfCase
    '
    'Me.wfCase.DecimalPointPosition = CType(0, Short)
    'Me.wfCase.Font = New System.Drawing.Font("lr SVbN", 22.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfCase.FontSize = WarpControl.FontSizes.Small2
    'Me.wfCase.Format = ""
    'Me.wfCase.Length = CType(16, Short)
    'Me.wfCase.Location = New System.Drawing.Point(40, 102)
    'Me.wfCase.MacroBcr = ""
    'Me.wfCase.MacroIn = ""
    'Me.wfCase.MacroKey = ""
    'Me.wfCase.MacroOut = ""
    'Me.wfCase.Name = "wfCase"
    'Me.wfCase.Size = New System.Drawing.Size(192, 24)
    'Me.wfCase.TabIndex = CType(3, Short)
    'Me.wfCase.Text = "KD Card/Case Lbl"
    '
    'wfPallete
    '
    'Me.wfPallete.DecimalPointPosition = CType(0, Short)
    'Me.wfPallete.Font = New System.Drawing.Font("lr SVbN", 28.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfPallete.FontSize = WarpControl.FontSizes.Small
    'Me.wfPallete.Format = ""
    'Me.wfPallete.Length = CType(7, Short)
    'Me.wfPallete.Location = New System.Drawing.Point(43, 55)
    'Me.wfPallete.MacroBcr = ""
    'Me.wfPallete.MacroIn = ""
    'Me.wfPallete.MacroKey = ""
    'Me.wfPallete.MacroOut = ""
    'Me.wfPallete.Name = "wfPallete"
    'Me.wfPallete.Size = New System.Drawing.Size(105, 30)
    'Me.wfPallete.TabIndex = CType(2, Short)
    'Me.wfPallete.Text = "Pallete"
    '
    '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.Paint
    '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:\H081-0005.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
    'Me.WarpBox1.Text = "Echo System"
    '
    'wfKey
    '
    'Me.wfKey.BcrFlag = True
    'Me.wfKey.DecimalPointPosition = CType(0, Short)
    'Me.wfKey.Font = New System.Drawing.Font("Lucida Console", 8.5!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel)
    'Me.wfKey.FontSize = WarpControl.FontSizes.Small4
    'Me.wfKey.Format = ""
    'Me.wfKey.Length = CType(1, Short)
    'Me.wfKey.Location = New System.Drawing.Point(216, 192)
    'Me.wfKey.MacroBcr = ""
    'Me.wfKey.MacroIn = ""
    'Me.wfKey.MacroKey = ""
    'Me.wfKey.MacroOut = ""
    'Me.wfKey.Name = "wfKey"
    'Me.wfKey.Size = New System.Drawing.Size(6, 12)
    'Me.wfKey.TabIndex = CType(8, Short)
    '
    'WarpHWBcr1
    '
    'Me.WarpHWBcr1.CheckCode.Code39 = True
    'Me.WarpHWBcr1.CheckCode.PostalCode = True
    '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)
    '
    'frm1E70
    '
    '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 = "frm1E70"
    'Me.Text = "Form1"
    'Me.WarpFrame1.ResumeLayout(False)
    'Me.ResumeLayout(False)

    'End Sub

#End Region
    Public Enum M1E70_STATUS As Integer
        INIT = 0
        NOTCD = 1
        DONE = 2
    End Enum

    Public mint1E70status As Integer

    Private Sub frm1E70_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 frm1E70_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 wstrImage As String
        Dim rtn As Integer

        Try
            mint1E70status = M1E70_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
            sDisp1E70()
            ' 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, "frm1E70_Load", ex.ToString)
        End Try

    End Sub

    '/*
    '|| ึ”–ผFsDisp1E70
    '|| T—v  F1E70ๆ–ส•\ฆ
    '*/
    Private Sub sDisp1E70()
        With gstrctAicCase
            wfLine.Text = .Line
            wfLine2.Text = .KasoLine
            wfSeq.Text = CInt(.PackSeq)
        End With
        'ๆ–ส•\ฆ•ถ—๑อ’่”’่`๐CommonษฤsมฤขทB
        sReversCheckedLBL(gstrctKDPL.intCheckFlag)
        Select Case gstrctKDPL.intCheckLbl
            Case 1
                wfChk1.Text = G_CONST_CHKARRW
            Case 2
                wfChk2.Text = G_CONST_CHKARRW
            Case 3
                wfChk3.Text = G_CONST_CHKARRW
            Case Else
                wfChk1.Text = ""
                wfChk2.Text = ""
                wfChk3.Text = ""
        End Select

        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
            Exit Sub
        End If

        '“—อ—
        rtn = fProcInput(RTrim(buf))

        If rtn = 0 Then
            Select Case mint1E70status

                Case M1E70_STATUS.DONE              'ณํษQฦลซฝ

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

                    gintStatus = PL_STATUS.FINALCHK
                    Me.Close()
                    Exit Sub
                Case M1E70_STATUS.NOTCD
#If Not Debug Then
                                        fFnc_WrpMsg("E", G_CONST_MID_E1E34)
#End If
            End Select

        Else

            'f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, fEditErrorInfo(gclsDB.BtriveStatus, gclsDB.ErrFile), MWA_DB_WARNING, MWA_DB_OK)
            MessageBox.Show(G_CONST_EM_DB, G_CONST_EMT_DB, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)


        End If


    End Sub

    ' t[€EC“
    Public Sub sMain()

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

        '        Try

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

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

        '                If WKey = WKY_ENT Then

        '                    'fSakusei2()

        '                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))

        '                    If rtn = 0 Then
        '                        Select Case mint1E70status

        '                            Case M1E70_STATUS.DONE              'ณํษQฦลซฝ
        '                                gintStatus = PL_STATUS.FINALCHK
        '                                Exit Do
        '                            Case M1E70_STATUS.NOTCD
        '#If Not Debug Then
        '                                fFnc_WrpMsg("E", G_CONST_MID_E1E34)
        '#End If
        '                        End Select

        '                    Else

        '                        f0.WarpCtrl1.MessageBox(G_CONST_EMT_DB, fEditErrorInfo(gclsDB.BtriveStatus, gclsDB.ErrFile), MWA_DB_WARNING, MWA_DB_OK)
        '                        Exit Do
        '                    End If

        '                ElseIf WKey = WKY_F1 Then


        '                ElseIf WKey = WKY_F2 Then


        '                ElseIf WKey = WKY_ERROR Then

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

        '                End If

        '            Loop

        '            Exit Sub

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

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

        Try
            If pstrInput = "OCRESET" Then
                mint1E70status = M1E70_STATUS.DONE
                fProcInput = 0
                Exit Function
            Else
                mint1E70status = M1E70_STATUS.NOTCD
                fProcInput = 0
                Exit Function
            End If

        Catch ex As Exception
            sErrLog(gAppName, "fProcInput", ex.ToString)
        End Try
    End Function
    '
    '*******************************************************************************
    '* @”\     : ฝทฌฯือูฬ”ฝ“]•\ฆ
    '* ๘”     : ฝทฌณ๊ฝือู
    '* –฿่’l   : ศต
    '* ”๕l     : ศต
    '*******************************************************************************
    Private Sub sReversCheckedLBL(ByVal intChkFlg As Integer)
        Dim arryAtrb() As Integer = {G_CONST_PLTLBL, G_CONST_CASELBL, G_CONST_CPLBL}
        Dim i As Integer
        Dim wintMaxCnt As Integer
        'ๆ–ส•\ฆ•ถ—๑อ’่”’่`๐CommonษฤsมฤขทB
        If intChkFlg = G_CONST_INIT Then
            'wfPallete.SetAtr(MWA_ATR_NOM, MWA_ATR_NOM)
            'wfPallete.Puts(G_CONST_PALETTE)
            'wfCase.SetAtr(MWA_ATR_NOM, MWA_ATR_NOM)
            'wfCase.Puts(G_CONST_CASE)
            'wfPC.SetAtr(MWA_ATR_NOM, MWA_ATR_NOM)
            'wfPC.Puts(G_CONST_PCLBL)
            wfPallete.Text = G_CONST_PALETTE
            wfCase.Text = G_CONST_CASE
            wfPC.Text = G_CONST_PCLBL
            Exit Sub
        End If
        wintMaxCnt = arryAtrb.Length - 1
        For i = 0 To wintMaxCnt
            Select Case (intChkFlg And arryAtrb(i))
                Case G_CONST_PLTLBL
                    'wfPallete.SetAtr(MWA_ATR_REV, MWA_ATR_REV)
                    'wfPallete.Puts(G_CONST_PALETTE)
                    wfPallete.Text = G_CONST_PALETTE
                Case G_CONST_CASELBL
                    'wfCase.SetAtr(MWA_ATR_REV, MWA_ATR_REV)
                    'wfCase.Puts(G_CONST_CASE)
                    wfCase.Text = G_CONST_CASE
                Case G_CONST_CPLBL
                    'wfPC.SetAtr(MWA_ATR_REV, MWA_ATR_REV)
                    'wfPC.Puts(G_CONST_PCLBL)
                    wfPC.Text = G_CONST_PCLBL
            End Select
        Next
    End Sub

    Private Sub frm1E70_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
