﻿Option Strict Off
Option Explicit On 
Friend Class ErcAlmClrSet
	Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

	Public Sub New()
		MyBase.New()

		'This call is required by the Windows Form Designer.
		InitializeComponent()

		'Add any initialization after the InitializeComponent() call

	End Sub

	'Form overrides dispose to clean up the component list.
	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

	'Required by the Windows Form Designer
	Private components As System.ComponentModel.IContainer

	'NOTE: The following procedure is required by the Windows Form Designer
	'It can be modified using the Windows Form Designer.  
	'Do not modify it using the code editor.
	Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
	Friend WithEvents chkErc1 As System.Windows.Forms.CheckBox
	Friend WithEvents chkErc2 As System.Windows.Forms.CheckBox
	Friend WithEvents Label2 As System.Windows.Forms.Label
	Friend WithEvents Label3 As System.Windows.Forms.Label
	Friend WithEvents Label4 As System.Windows.Forms.Label
	Friend WithEvents cboErcTime As System.Windows.Forms.ComboBox
	Friend WithEvents cboErcOffTimer As System.Windows.Forms.ComboBox
	Friend WithEvents cboAlmClrTime As System.Windows.Forms.ComboBox
    Friend WithEvents btnComReturn As System.Windows.Forms.Button
    Friend WithEvents txtErc2 As System.Windows.Forms.TextBox
	Friend WithEvents txtErc1 As System.Windows.Forms.TextBox
	<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.txtErc1 = New System.Windows.Forms.TextBox()
        Me.txtErc2 = New System.Windows.Forms.TextBox()
        Me.chkErc2 = New System.Windows.Forms.CheckBox()
        Me.chkErc1 = New System.Windows.Forms.CheckBox()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.cboErcTime = New System.Windows.Forms.ComboBox()
        Me.cboErcOffTimer = New System.Windows.Forms.ComboBox()
        Me.cboAlmClrTime = New System.Windows.Forms.ComboBox()
        Me.btnComReturn = New System.Windows.Forms.Button()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'GroupBox1
        '
        Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.txtErc1, Me.txtErc2, Me.chkErc2, Me.chkErc1})
        Me.GroupBox1.Location = New System.Drawing.Point(16, 16)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(336, 88)
        Me.GroupBox1.TabIndex = 0
        Me.GroupBox1.TabStop = False
        Me.GroupBox1.Text = "Counter Clear (ERC)"
        '
        'txtErc1
        '
        Me.txtErc1.Enabled = False
        Me.txtErc1.Location = New System.Drawing.Point(216, 24)
        Me.txtErc1.Name = "txtErc1"
        Me.txtErc1.ReadOnly = True
        Me.txtErc1.Size = New System.Drawing.Size(104, 21)
        Me.txtErc1.TabIndex = 6
        Me.txtErc1.Text = "Not Use"
        '
        'txtErc2
        '
        Me.txtErc2.Enabled = False
        Me.txtErc2.Location = New System.Drawing.Point(216, 56)
        Me.txtErc2.Name = "txtErc2"
        Me.txtErc2.ReadOnly = True
        Me.txtErc2.Size = New System.Drawing.Size(104, 21)
        Me.txtErc2.TabIndex = 5
        Me.txtErc2.Text = "Not Use"
        '
        'chkErc2
        '
        Me.chkErc2.Location = New System.Drawing.Point(16, 54)
        Me.chkErc2.Name = "chkErc2"
        Me.chkErc2.Size = New System.Drawing.Size(184, 24)
        Me.chkErc2.TabIndex = 1
        Me.chkErc2.Text = "ORG motion end :"
        '
        'chkErc1
        '
        Me.chkErc1.Location = New System.Drawing.Point(16, 24)
        Me.chkErc1.Name = "chkErc1"
        Me.chkErc1.Size = New System.Drawing.Size(192, 22)
        Me.chkErc1.TabIndex = 0
        Me.chkErc1.Text = "Stop by EL and ALM input :"
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(24, 128)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(119, 14)
        Me.Label2.TabIndex = 1
        Me.Label2.Text = "Counter Clear Time :"
        '
        'Label3
        '
        Me.Label3.AutoSize = True
        Me.Label3.Location = New System.Drawing.Point(24, 160)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(143, 14)
        Me.Label3.TabIndex = 2
        Me.Label3.Text = "Counter Clear Off Timer :"
        '
        'Label4
        '
        Me.Label4.AutoSize = True
        Me.Label4.Location = New System.Drawing.Point(24, 192)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(107, 14)
        Me.Label4.TabIndex = 3
        Me.Label4.Text = "Alarm Clear Time :"
        '
        'cboErcTime
        '
        Me.cboErcTime.Location = New System.Drawing.Point(216, 128)
        Me.cboErcTime.Name = "cboErcTime"
        Me.cboErcTime.Size = New System.Drawing.Size(136, 23)
        Me.cboErcTime.TabIndex = 4
        '
        'cboErcOffTimer
        '
        Me.cboErcOffTimer.Location = New System.Drawing.Point(216, 160)
        Me.cboErcOffTimer.Name = "cboErcOffTimer"
        Me.cboErcOffTimer.Size = New System.Drawing.Size(136, 23)
        Me.cboErcOffTimer.TabIndex = 5
        '
        'cboAlmClrTime
        '
        Me.cboAlmClrTime.Location = New System.Drawing.Point(216, 192)
        Me.cboAlmClrTime.Name = "cboAlmClrTime"
        Me.cboAlmClrTime.Size = New System.Drawing.Size(136, 23)
        Me.cboAlmClrTime.TabIndex = 6
        '
        'btnComReturn
        '
        Me.btnComReturn.Location = New System.Drawing.Point(232, 224)
        Me.btnComReturn.Name = "btnComReturn"
        Me.btnComReturn.Size = New System.Drawing.Size(104, 24)
        Me.btnComReturn.TabIndex = 8
        Me.btnComReturn.Text = "&Return"
        '
        'ErcAlmClrSet
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(368, 262)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnComReturn, Me.cboAlmClrTime, Me.cboErcOffTimer, Me.cboErcTime, Me.Label4, Me.Label3, Me.Label2, Me.GroupBox1})
        Me.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "ErcAlmClrSet"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "ERC/ALM Clear Setting"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub chkErc1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkErc1.Click

        Select Case chkErc1.CheckState
            Case 0
                txtErc1.Text = "Not Use"
                ErcMode = ErcMode Xor &H1
            Case 1
                txtErc1.Text = "Auto Out"
                ErcMode = ErcMode Or &H1
        End Select

        '	If chkErc1.Value = 1 Then
        '		txtErc1.Text = "Auto Out"
        '		ErcMode = ErcMode Or &H1
        '	ElseIf chkErc1.Value = 0 Then
        '		txtErc1.Text = "Not Use"
        '		ErcMode = ErcMode Xor &H1
        '	End If

    End Sub

    Private Sub chkErc2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles chkErc2.Click

        If chkErc2.CheckState = 1 Then
            txtErc2.Text = "Auto Out"
            ErcMode = ErcMode Or &H2
        ElseIf chkErc2.CheckState = 0 Then
            txtErc2.Text = "Not Use"
            ErcMode = ErcMode Xor &H2
        End If

    End Sub

    Private Sub cboAlmClrTime_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboAlmClrTime.SelectedIndexChanged

        AlmTime = cboAlmClrTime.SelectedIndex

    End Sub

    Private Sub cboErcOffTimer_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboErcOffTimer.SelectedIndexChanged

        ErcOffTimer = cboErcOffTimer.SelectedIndex

    End Sub

    Private Sub cboErcTime_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboErcTime.SelectedIndexChanged

        ErcTime = cboErcTime.SelectedIndex

    End Sub



    Private Sub btnComReturn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnComReturn.Click

        Me.Close()

    End Sub

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

        cboErcTime.Enabled = False
        cboErcOffTimer.Enabled = False
        cboAlmClrTime.Enabled = False
        '
        If CtrlOut1 = 2 Or CtrlOut2 = 2 Or CtrlOut3 = 2 Then
            cboErcTime.Enabled = True
            cboErcOffTimer.Enabled = True
        End If
        If CtrlOut1 = 1 Or CtrlOut2 = 1 Or CtrlOut3 = 1 Then
            cboAlmClrTime.Enabled = True
        End If

        ' OUT1 ComboBox
        cboErcTime.Items.Clear()
        cboErcTime.Items.Add("12 [usec]")
        cboErcTime.Items.Add("102 [usec]")
        cboErcTime.Items.Add("408 [usec]")
        cboErcTime.Items.Add("1.6 [msec]")
        cboErcTime.Items.Add("13 [msec]")
        cboErcTime.Items.Add("52 [msec]")
        cboErcTime.Items.Add("104 [msec]")
        cboErcTime.Items.Add("Level")

        ' OUT2 ComboBox
        cboErcOffTimer.Items.Clear()
        cboErcOffTimer.Items.Add("0 [usec]")
        cboErcOffTimer.Items.Add("12 [usec]")
        cboErcOffTimer.Items.Add("1.6 [msec]")
        cboErcOffTimer.Items.Add("104 [msec]")

        ' OUT3 ComboBox
        cboAlmClrTime.Items.Clear()
        cboAlmClrTime.Items.Add("12 [usec]")
        cboAlmClrTime.Items.Add("102 [usec]")
        cboAlmClrTime.Items.Add("408 [msec]")
        cboAlmClrTime.Items.Add("1.6 [msec]")
        cboAlmClrTime.Items.Add("13 [msec]")
        cboAlmClrTime.Items.Add("52 [msec]")
        cboAlmClrTime.Items.Add("104 [msec]")

        ' ComboBox Initialise
        cboErcTime.SelectedIndex = ErcTime
        cboErcOffTimer.SelectedIndex = ErcOffTimer
        cboAlmClrTime.SelectedIndex = AlmTime

        ' CheckBox Initialise
        If (ErcMode And &H1) Then
            chkErc1.CheckState = 1
        End If

        If (ErcMode And &H2) Then
            chkErc2.CheckState = 1
        End If

    End Sub

End Class
