' Developer: Juyoung Lee
' Program Name: JuyoungLee_StockWar
' Version: 1.0

Option Strict On
Option Explicit On

Public Class frmLogin
    Public lang As String = "ENG" 'Set start language and value for Language setting
    Public strName As String

    Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
        If txtName.Text = "" Or txtName.Text = " " Or txtName.Text = "  " Or txtName.Text = "   " Or txtName.Text = "    " Or txtName.Text = "     " Or txtName.Text = "      " Or txtName.Text = "       " Or txtName.Text = "        " Or txtName.Text = "         " Or txtName.Text = "          " Or txtName.Text = "           " Or txtName.Text = "            " Then
            If lang = "ENG" Then
                lblNotice.Text = "Please enter your name."
            ElseIf lang = "KOR" Then
                lblNotice.Text = "이름을 입력해주세요."
            End If

            txtName.Focus()
        Else
            Beep()
            strName = txtName.Text
            frmMain.Show()
            Me.Hide()
        End If
    End Sub

    Private Sub mmenuFileExit(sender As Object, e As EventArgs) Handles menuFileExit.Click
        Me.Close()
    End Sub

    Private Sub menuHelpAbout_Click(sender As Object, e As EventArgs) Handles menuHelpAbout.Click
        If lang = "ENG" Then
            MsgBox("Developer: Juyoung Lee", vbInformation, "Stock War Developer")
        ElseIf lang = "KOR" Then
            MsgBox("개발자: 이주영", vbInformation, "주식 전쟁 개발자")
        End If

    End Sub

    Sub UncheckAllLang()
        menuSettingsLanguageEnglish.Checked = False
        menuSettingsLanguageKorean.Checked = False

        'Reset labels for showing clear translations
        lblNotice.Text = ""
    End Sub
    'Translations
    Private Sub mnuSettingsLanguageEnglish_Click(sender As Object, e As EventArgs) Handles menuSettingsLanguageEnglish.Click
        'Uncheck all Languages
        UncheckAllLang()

        'Check this language
        menuSettingsLanguageEnglish.Checked = True

        'Translate
        Me.Text = "Stock War Login"
        menuFile.Text = "&File"
        'menuFileLoad.Text = "&Load"
        menuFileExit.Text = "E&xit"
        menuSettings.Text = "&Settings"
        menuSettingsLanguage.Text = "&Language"
        menuHelp.Text = "&Help"
        mnuHelpRules.Text = "&Rules"
        menuHelpAbout.Text = "&About"
        lblTitle.Text = "Stock War"
        lblName.Text = "Name:"
        btnLogin.Text = "&Log in"

        'Set Global and Public value to affect language setting to other forms
        lang = "ENG"
    End Sub

    Private Sub mnuSettingsLanguageKorean_Click(sender As Object, e As EventArgs) Handles menuSettingsLanguageKorean.Click
        UncheckAllLang()

        menuSettingsLanguageKorean.Checked = True

        Me.Text = "주식 전쟁 로그인"
        menuFile.Text = "파일"
        'menuFileLoad.Text = "불러오기"
        menuFileExit.Text = "나가기"
        menuSettings.Text = "설정"
        menuSettingsLanguage.Text = "언어"
        menuHelp.Text = "도움말"
        mnuHelpRules.Text = "게임 규칙"
        menuHelpAbout.Text = "소개"
        lblTitle.Text = "주식 전쟁"
        lblName.Text = "이름:"
        btnLogin.Text = "로그인"

        lang = "KOR"
    End Sub

    Private Sub mnuHelpRules_Click(sender As Object, e As EventArgs) Handles mnuHelpRules.Click
        frmRule.Show()
    End Sub
End Class
