Files
2026-06-18 14:15:48 +02:00

87 lines
4.4 KiB
VB.net

Imports System.ComponentModel
Imports System.IO
Public Class Form36
Private Sub Form36_Load(sender As Object, e As EventArgs) Handles MyBase.Load
For Each fichier As String In IO.Directory.GetDirectories(dostheme)
Dim info As New IO.FileInfo(fichier)
ListBox1.Items.Add(info.Name)
Next
Dim lines1a() As String = File.ReadAllLines(théme)
If lines1a(0) = 2 Then
Me.BackColor = Color.FromArgb(64, 64, 64)
ForeColor = Color.White
ListBox1.BackColor = BackColor
ListBox1.ForeColor = ForeColor
ContextMenuStrip1.BackColor = BackColor
ContextMenuStrip1.ForeColor = ForeColor
ElseIf lines1a(0) = 3 Then
Me.BackColor = Color.FromArgb(Form1.colorbackA, Form1.colorbackR, Form1.colorbackG, Form1.colorbackB)
Me.ForeColor = Color.FromArgb(Form1.themeforecoloA, Form1.themeforecoloR, Form1.themeforecoloG, Form1.themeforecoloB)
ListBox1.BackColor = BackColor
ListBox1.ForeColor = ForeColor
ContextMenuStrip1.BackColor = BackColor
ContextMenuStrip1.ForeColor = ForeColor
End If
End Sub
Private Sub ContextMenuStrip1_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles ContextMenuStrip1.Opening
If ListBox1.SelectedItem = "" Then
e.Cancel = True
Else
ExporterLeThémeToolStripMenuItem.Text = "Exporter le Thème: " & ListBox1.SelectedItem
ModifierLeThémeToolStripMenuItem.Text = "Modifier le Thème: " & ListBox1.SelectedItem
SupprimerLeThémeToolStripMenuItem.Text = "Supprimer le Thème: " & ListBox1.SelectedItem
End If
End Sub
Private Sub ExporterLeThémeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExporterLeThémeToolStripMenuItem.Click
If FolderBrowserDialog1.ShowDialog = 1 Then
If File.Exists(FolderBrowserDialog1.SelectedPath & "\Théme - " & ListBox1.SelectedItem & ".TLM") = True Then
MsgBox("Le thème: " & ListBox1.SelectedItem & " existe déjà", MsgBoxStyle.Exclamation)
Else
IO.Compression.ZipFile.CreateFromDirectory(dostheme & "\" & ListBox1.SelectedItem & "\", FolderBrowserDialog1.SelectedPath & "\Théme - " & ListBox1.SelectedItem & ".TLM")
MsgBox("Le thème: " & ListBox1.SelectedItem & " a bien été exporter", MsgBoxStyle.Information)
End If
End If
End Sub
Private Sub SupprimerLeThémeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SupprimerLeThémeToolStripMenuItem.Click
Dim lines1() As String = File.ReadAllLines(themeselect)
If lines1(0) = ListBox1.SelectedItem Then
MsgBox("Vous ne pouvez pas supprimer le thème en cours d'utilisation", MsgBoxStyle.Critical)
Else
Dim msg = MsgBox("Voulez-vous vraiment supprimer le Thème: " & ListBox1.SelectedItem & " ?", MsgBoxStyle.YesNo)
If msg = MsgBoxResult.Yes Then
For Each fichier As String In IO.Directory.GetFiles(dostheme & "\" & ListBox1.SelectedItem & "\")
Dim info As New IO.FileInfo(fichier)
File.Delete(dostheme & "\" & ListBox1.SelectedItem & "\" & info.Name)
Next
Directory.Delete(dostheme & "\" & ListBox1.SelectedItem & "\")
Form3.ComboBox3.Items.Remove(ListBox1.SelectedItem)
MsgBox("Le thème: " & ListBox1.SelectedItem & " a bien été supprimer", MsgBoxStyle.Information)
ListBox1.Items.Remove(ListBox1.SelectedItem)
Else
MsgBox("Action annuler", MsgBoxStyle.Information)
End If
End If
End Sub
Private Sub Form36_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
ListBox1.Items.Clear()
End Sub
Private Sub ModifierLeThémeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ModifierLeThémeToolStripMenuItem.Click
Dim lines1() As String = File.ReadAllLines(themeselect)
If lines1(0) = ListBox1.SelectedItem Then
MsgBox("Vous ne pouvez pas modifier le thème en cours d'utilisation", MsgBoxStyle.Critical)
Else
Form37.Text = "Modifier: " & ListBox1.SelectedItem
Form37.TextBox1.Text = ListBox1.SelectedItem
Form37.ShowDialog()
End If
End Sub
End Class