Imports System.IO
Public Class Form2
    Dim theme As Integer = 0
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        Form3.opensetting = 1
        Form3.ShowDialog()
    End Sub

    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim lines1() As String = File.ReadAllLines(dosparasetting & "/lang.txt")
        If lines1(0) = 0 Then
            ComboBox1.SelectedItem = "Français"
        End If
        Dim lines2() As String = File.ReadAllLines(dosparasetting & "/theme.txt")
        If lines2(0) = 0 Then
            ComboBox2.SelectedItem = "Claire"
            theme = 0
        Else
            ComboBox2.SelectedItem = "Sombre"
            theme = 1
        End If
        Dim lines3() As String = File.ReadAllLines(dosparaupdate & "/autoupdate.txt")
        If lines3(0) = 0 Then
            CheckBox1.Checked = False
        Else
            CheckBox1.Checked = True
        End If
        Dim lines4() As String = File.ReadAllLines(dosparasetting & "/stopauto.txt")
        If lines4(0) = 0 Then
            CheckBox2.Checked = False
        Else
            CheckBox2.Checked = True
        End If
        ListBox1.Items.Clear()
        For Each fichier As String In IO.Directory.GetDirectories(profil)
            Dim info As New IO.FileInfo(fichier)
            ListBox1.Items.Add(info.Name)
        Next
        If ListBox1.Items.Count = 0 Then
            Button4.Hide()
        End If
        themeload()
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        If ComboBox1.SelectedItem = "Français" Then
            Dim sw1 As New StreamWriter(dosparasetting.ToString & "/lang.txt")
            sw1.WriteLine(0)
            sw1.Close()
            Dim sw2 As New StreamWriter(dosparasetting.ToString & "/langselect.txt")
            sw2.WriteLine(0)
            sw2.Close()
        End If
        If ComboBox2.SelectedItem = "Claire" Then
            Dim sw1 As New StreamWriter(dosparasetting.ToString & "/theme.txt")
            sw1.WriteLine(0)
            sw1.Close()
            If theme = 1 Then
                Form1.themeclaire()
                theme = 0
            End If
        Else
            Dim sw1 As New StreamWriter(dosparasetting.ToString & "/theme.txt")
            sw1.WriteLine(1)
            sw1.Close()
            If theme = 0 Then
                Form1.themesombre()
                theme = 1
            End If
        End If
        If CheckBox1.Checked = True Then
            Dim sw1 As New StreamWriter(dosparaupdate.ToString & "/autoupdate.txt")
            sw1.WriteLine(1)
            sw1.Close()
        Else
            Dim sw1 As New StreamWriter(dosparaupdate.ToString & "/autoupdate.txt")
            sw1.WriteLine(0)
            sw1.Close()
        End If
        If CheckBox2.Checked = True Then
            Dim sw4 As New StreamWriter(dosparasetting.ToString & "/stopauto.txt")
            sw4.WriteLine(1)
            sw4.Close()
        Else
            Dim sw4 As New StreamWriter(dosparasetting.ToString & "/stopauto.txt")
            sw4.WriteLine(0)
            sw4.Close()
        End If
        MsgBox("La paramètre ont bien êtê enregisterer", MsgBoxStyle.Information)
        themeload()
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        ComboBox1.SelectedItem = "français"
        ComboBox2.SelectedItem = "Claire"
        CheckBox1.Checked = True
        CheckBox2.Checked = False
        MsgBox("Le paramètre ont êtê remis par defaut merci de les enregisterer", MsgBoxStyle.Information)
    End Sub

    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Form11.ShowDialog()
    End Sub
    Sub themeload()
        BackColor = Form1.BackColor
        ForeColor = Form1.ForeColor
        Panel1.BackColor = BackColor
        Button1.BackColor = BackColor
        Button2.BackColor = BackColor
        ComboBox1.BackColor = BackColor
        ComboBox2.BackColor = BackColor
        Panel2.BackColor = BackColor
        ListBox1.BackColor = BackColor
        Button3.BackColor = BackColor
        Button4.BackColor = BackColor
        ListBox1.ForeColor = ForeColor
        ComboBox1.ForeColor = ForeColor
        ComboBox2.ForeColor = ForeColor
    End Sub
End Class