Imports ACC.ARINCLASS
Imports ACC

Public Class Config

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_c.Click
        Me.Dispose()
    End Sub

    Private Sub Config_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Me.tb_ur.Text = PICmanFile
        Select Case MakeState.ToUpper
            Case "MAX"
                Me.cmb_ml.Text = "최대화"
            Case "MIN"
                Me.cmb_ml.Text = "최소화"
            Case Else
                Me.cmb_ml.Text = "일반"
        End Select
        Select Case PoleState.ToUpper
            Case "MAX"
                Me.cmb_dl.Text = "최대화"
            Case "MIN"
                Me.cmb_dl.Text = "최소화"
            Case Else
                Me.cmb_dl.Text = "일반"
        End Select
        Select Case PoleEtcState.ToUpper
            Case "MAX"
                Me.cmb_sdt.Text = "최대화"
            Case "MIN"
                Me.cmb_sdt.Text = "최소화"
            Case Else
                Me.cmb_sdt.Text = "일반"
        End Select
        Select Case PicState.ToUpper
            Case "MAX"
                Me.cmb_pc.Text = "최대화"
            Case "MIN"
                Me.cmb_pc.Text = "최소화"
            Case Else
                Me.cmb_pc.Text = "일반"
        End Select
        Me.tbgdfgd.Text = FormFont.FontName & "," & FormFont.FontSize
        Me.tb_fds.Text = ViewFont.FontName & "," & ViewFont.FontSize
        Me.tb_mf.Text = MenuFont.FontName & "," & MenuFont.FontSize
        Me.SORTCHK.Checked = SORTNULL
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim A As New OpenFileDialog
        If A.ShowDialog <> Windows.Forms.DialogResult.OK Then Return
        Me.tb_ur.Text = A.FileName.Replace(My.Application.Info.DirectoryPath, "")
    End Sub

    Private Sub bt_확인_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_ok.Click
        Dim INI As New MyINI(My.Application.Info.DirectoryPath & "\epole.ini")
        Dim SpINI As New MyINI(My.Application.Info.DirectoryPath & "\spread.ini")
        INI.Write("main", "picman", Me.tb_ur.Text)
        PICmanFile = Me.tb_ur.Text
        Select Case Me.cmb_ml.Text
            Case "최대화"
                INI.Write("main", "MakeState", "max")
                MakeState = "max"
            Case "최소화"
                INI.Write("main", "MakeState", "min")
                MakeState = "min"
            Case Else
                MakeState = "normal"
                INI.Write("nor", "MakeState", "nor")
        End Select

        Select Case Me.cmb_dl.Text
            Case "최대화"
                INI.Write("main", "PoleState", "max")
                PoleState = "max"
            Case "최소화"
                INI.Write("main", "PoleState", "min")
                PoleState = "min"
            Case Else
                INI.Write("main", "PoleState", "nor")
                PoleState = "nor"
        End Select

        Select Case Me.cmb_sdt.Text
            Case "최대화"
                INI.Write("main", "PoleEtcState", "max")
                PoleState = "max"
            Case "최소화"
                INI.Write("main", "PoleEtcState", "min")
                PoleState = "min"
            Case Else
                INI.Write("main", "PoleEtcState", "nor")
                PoleState = "nor"
        End Select

        Select Case Me.cmb_pc.Text
            Case "최대화"
                INI.Write("main", "PicState", "max")
                PicState = "max"
            Case "최소화"
                INI.Write("main", "PicState", "min")
                PicState = "min"
            Case Else
                INI.Write("main", "PicState", "nor")
                PicState = "nor"
        End Select

        SORTNULL = Me.SORTCHK.Checked
        NUMCOLOR = Me.chb_numcolor.Checked

        INI.Write("MAIN", "SortNull", Me.SORTCHK.Checked)
        INI.Write("main", "formfont", Me.tbgdfgd.Text)
        INI.Write("main", "viewfont", Me.tb_fds.Text)
        INI.Write("main", "menufont", Me.tb_mf.Text)
        INI.Write("main", "NUMCOLOR", Me.chb_numcolor.Checked)

        FormFont.FontName = Me.tbgdfgd.Text.Split(",")(0)
        FormFont.FontSize = Me.tbgdfgd.Text.Split(",")(1)

        ViewFont.FontName = Me.tb_fds.Text.Split(",")(0)
        ViewFont.FontSize = Me.tb_fds.Text.Split(",")(1)

        MenuFont.FontName = Me.tb_mf.Text.Split(",")(0)
        MenuFont.FontSize = Me.tb_mf.Text.Split(",")(1)

        MSG("저장이완료되었습니다\n\n일부데이터는 프로그램이 재시작되면 반영됩니다.", MsgBoxStyle.Information, "저장완료")
        Me.Dispose()
    End Sub

    Private Sub bt_폼윈도버튼_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_fw.Click
        Dim A As New FontDialog
        Dim OFont As New Font(FormFont.FontName, FormFont.FontSize, Me.Font.Style)
        A.Font = OFont
        If A.ShowDialog <> Windows.Forms.DialogResult.OK Then Return
        Me.tbgdfgd.Text = A.Font.Name & "," & A.Font.Size
    End Sub

    Private Sub bt_데이터뷰버튼_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_dv.Click
        Dim A As New FontDialog
        Dim OFont As New Font(ViewFont.FontName, ViewFont.FontSize, Me.Font.Style)
        A.Font = OFont
        If A.ShowDialog <> Windows.Forms.DialogResult.OK Then Return
        Me.tb_fds.Text = A.Font.Name & "," & A.Font.Size
    End Sub

    Private Sub bt_메뉴버튼_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_mm.Click
        Dim A As New FontDialog
        Dim OFont As New Font(MenuFont.FontName, MenuFont.FontSize, Me.Font.Style)
        A.Font = OFont
        If A.ShowDialog <> Windows.Forms.DialogResult.OK Then Return
        Me.tb_mf.Text = A.Font.Name & "," & A.Font.Size
    End Sub


End Class