Public NotInheritable Class DemoDlg

    Private Sub DemoDlg_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        'If UserInfo.Type = E_AuthType.Demo AndAlso UserInfo.Cnt > 10 Then
        '    End
        'Else
        '    Me.DialogResult = Windows.Forms.DialogResult.OK
        '    Me.Dispose()
        'End If
    End Sub

    Private Sub DemoDlg_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' 폼의 제목을 설정합니다
        Dim ApplicationTitle As String
        If My.Application.Info.Title <> "" Then
            ApplicationTitle = My.Application.Info.Title
        Else
            ApplicationTitle = System.IO.Path.GetFileNameWithoutExtension(My.Application.Info.AssemblyName)
        End If
        Me.Text = String.Format("{0} 정보", ApplicationTitle)
        ' 정보 상자에 표시되는 모든 텍스트를 초기화합니다.
        ' TODO: "프로젝트" 메뉴에서 선택하여 표시되는 프로젝트 속성 대화 상자의 "응용 프로그램" 창에서 응용 프로그램의 
        '    어셈블리 정보를 사용자 지정합니다.
        Me.LabelProductName.Text = My.Application.Info.ProductName
        Me.LabelVersion.Text = String.Format("버전 {0}", My.Application.Info.Version.ToString)
        Me.LabelCopyright.Text = My.Application.Info.Copyright
        Me.LabelCompanyName.Text = My.Application.Info.CompanyName

        Display_info()
        'If UserInfo.Type = E_AuthType.Demo AndAlso UserInfo.Cnt > 10 Then    '//사용불가다
        '    Me.Button1.Text = "끝내기(&O)"
        'End If
        'Me.TextBoxDescription.Text = My.Application.Info.Description

    End Sub
    Private Sub Display_info()
        Me.lb_expiredate.Text = "인증만료일 : " & RunDate.ToShortDateString()
        'Select Case UserInfo.Type
        '    Case E_AuthType.Admin
        '        Me.lb_usertype.Text = "사용자형태 : 관리자"
        '    Case E_AuthType.Demo
        '        Me.lb_usertype.Text = "사용자형태 : 임시(일부기능만 사용가능)"
        '        Me.lb_remaincnt.Text = "사용 횟수 : " & UserInfo.Cnt & "/10" & IIf(UserInfo.Cnt > 10, "[사용횟수초과]", "")
        '    Case E_AuthType.Normal
        '        Me.lb_usertype.Text = "사용자형태 : 정상"
        'End Select
        'Me.lb_ip.Text = "아이피 : " & GetFirstIP()
    End Sub

    Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Process.Start(HomePage)
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim auth As New CEpole.Auth
        Dim NewKey As String = InputBox("인증번호1을 입력하세요")
        If NewKey <> "" AndAlso auth.check_key1(NewKey) Then  '//뭔가있고 정상이라면
            ini.Write("main", "key1", NewKey)
            Me.DialogResult = Windows.Forms.DialogResult.OK
            MsgBox("인증번호1을 정상적으로 등록했습니다" & vbCrLf & "프로그램을 재실행하세요")
        Else
            MsgBox("취소되었거나 정상적인 키가 아닙니다", MsgBoxStyle.Critical, "오류")
            Me.Close()
        End If

    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Dim auth As New CEpole.Auth
        Dim NewKey As String = InputBox("인증번호2를 입력하세요")
        If NewKey <> "" AndAlso auth.Check_key2(NewKey) Then  '//뭔가있고 정상이라면
            ini.Write("main", "key2", NewKey)
            Me.DialogResult = Windows.Forms.DialogResult.OK
            MsgBox("인증번호2를 정상적으로 등록했습니다" & vbCrLf & "프로그램을 재실행하세요")
        Else
            MsgBox("취소되었거나 정상적인 키가 아닙니다", MsgBoxStyle.Critical, "오류")
            Me.Close()
        End If
    End Sub

    Private Sub Button3_Click_1(sender As Object, e As EventArgs) Handles Button3.Click
        Dim f As New fAuth()
        f.ShowDialog()
    End Sub
End Class
