Imports System.ComponentModel

Public Class frmModelSelect
    Private CloseTIme As Integer
    Private Sub frmModelSelect_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ModelSelectTimer.Enabled = True
    End Sub
    Private Sub frmModelSelect_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
        'e.Cancel = True
        ModelSelectTimer.Enabled = False
        'Me.Hide()
    End Sub
    Private Sub frmModelSelect_Activated(sender As Object, e As EventArgs) Handles Me.Activated
        'ModelSelectTimer.Enabled = True
    End Sub
    Private Sub frmModelSelect_Shown(sender As Object, e As EventArgs) Handles Me.Shown
        If frmTD_JIG.ckbUseGradeChange.Checked Then
            lblModelSelectTitle.Text = "카트리지 사양을 선택해주세요!"
        Else
            lblModelSelectTitle.Text = "카트리지 모델을 선택해주세요!"
        End If

        lblModelSelectTitle.Refresh()
        txbModelSelectWindow.BackColor = Color.White
        txbModelSelectWindow.Text = "입력 대기"
        txbModelSelectWindow.Refresh()

        frmTD_JIG.CartType = frmTD_JIG.CART_TYPE.CART_NONE
        rdbModelProWindow.Checked = False
        rdbModelLuxWindow.Checked = False
        rdbTypeFaceWindow.Checked = False
        rdbTypeEyeWindow.Checked = False
        rdbModelProWindow.Enabled = True
        rdbModelLuxWindow.Enabled = True
        rdbTypeFaceWindow.Enabled = True
        rdbTypeEyeWindow.Enabled = True
        rdbModelProWindow.Refresh()
        rdbModelLuxWindow.Refresh()
        rdbTypeFaceWindow.Refresh()
        rdbTypeEyeWindow.Refresh()

        ModelSelectTimer.Enabled = True

        If frmTD_JIG.ckbUseGradeChange.Checked Then
            If RegMeasure.MeasureGrade = "PRO" Then
                ' 사용 가능
            ElseIf RegMeasure.MeasureGrade = "LUX" Then
                ' PRO Face 사용 불가(PRO 찍으면 FACE 못찍게 하고, FACE 찍으면 PRO 못 찍게)
            ElseIf RegMeasure.MeasureGrade = "EYE" Then
                ' PRO / LUX Face 사용 불가(FACE 선택 불가)
                rdbTypeFaceWindow.Enabled = False
            End If
        End If

    End Sub
    Private Sub ModelSelectTimer_Tick(sender As Object, e As EventArgs) Handles ModelSelectTimer.Tick
        If lblModelSelectTitle.ForeColor = Color.Blue Then
            lblModelSelectTitle.ForeColor = Color.Red
        Else
            lblModelSelectTitle.ForeColor = Color.Blue
        End If

        If frmTD_JIG.CartType Then
            CloseTIme += 1
            If CloseTIme = 2 Then
                Me.Close()
            End If
        Else
            CloseTIme = 0
        End If

    End Sub

    Private Sub rdbModelProWindow_CheckedChanged(sender As Object, e As EventArgs) Handles rdbModelProWindow.CheckedChanged
        If rdbModelProWindow.Checked Then
            rdbModelProWindow.ForeColor = Color.Red
            txbModelSelectWindow.BackColor = Color.Gold
            If RegMeasure.MeasureGrade = "LUX" Then
                rdbTypeFaceWindow.Enabled = False
            End If
        Else
            rdbModelProWindow.ForeColor = Color.Black
            If RegMeasure.MeasureGrade = "LUX" Then
                rdbTypeFaceWindow.Enabled = True
            End If
        End If
        rdbModelProWindow.Refresh()
        frmTD_JIG.UpdateCartTypeWindow()
    End Sub

    Private Sub rdbModelLuxWindow_CheckedChanged(sender As Object, e As EventArgs) Handles rdbModelLuxWindow.CheckedChanged
        If rdbModelLuxWindow.Checked Then
            rdbModelLuxWindow.ForeColor = Color.Red
            txbModelSelectWindow.BackColor = Color.Silver
        Else
            rdbModelLuxWindow.ForeColor = Color.Black
        End If
        rdbModelLuxWindow.Refresh()
        frmTD_JIG.UpdateCartTypeWindow()
    End Sub

    Private Sub rdbTypeFaceWindow_CheckedChanged(sender As Object, e As EventArgs) Handles rdbTypeFaceWindow.CheckedChanged
        If rdbTypeFaceWindow.Checked Then
            rdbTypeFaceWindow.ForeColor = Color.Red
            If RegMeasure.MeasureGrade = "LUX" Then
                rdbModelProWindow.Enabled = False
            End If
        Else
            rdbTypeFaceWindow.ForeColor = Color.Black
            If RegMeasure.MeasureGrade = "LUX" Then
                rdbModelProWindow.Enabled = True
            End If
        End If
        rdbTypeFaceWindow.Refresh()
        frmTD_JIG.UpdateCartTypeWindow()
    End Sub

    Private Sub rdbTypeEyeWindow_CheckedChanged(sender As Object, e As EventArgs) Handles rdbTypeEyeWindow.CheckedChanged
        If rdbTypeEyeWindow.Checked Then
            rdbTypeEyeWindow.ForeColor = Color.Red
        Else
            rdbTypeEyeWindow.ForeColor = Color.Black
        End If
        rdbTypeEyeWindow.Refresh()
        frmTD_JIG.UpdateCartTypeWindow()
    End Sub
End Class
