Imports System.Windows.Forms
Public Class NuovoSito
Public Cartella As String
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
If My.Computer.FileSystem.DirectoryExists(CartellaSito.Text) Then
Cartella = CartellaSito.Text & "\" & NomeSito.Text
If My.Computer.FileSystem.DirectoryExists(Cartella) = False Then
My.Computer.FileSystem.CreateDirectory(Cartella)
If PredefinitoIndexHtm.Checked = True Then
My.Computer.FileSystem.WriteAllText(Cartella & "\index.htm", My.Resources.HTMLVuoto, True)
End If
If PredefinitoStyleCss.Checked = True Then
My.Computer.FileSystem.WriteAllText(Cartella & "\style.css", "", True)
End If
If PredefinitoCartellaImages.Checked = True Then
My.Computer.FileSystem.CreateDirectory(Cartella & "\images")
End If
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
Else
MsgBox("La sottocartella con il nome del sito esiste già nella cartella selezionata. Modificare il nome del sito o la cartella di salvataggio.", MsgBoxStyle.Critical)
End If
Else
MsgBox("La cartella selezionata è inesistente", MsgBoxStyle.Critical)
End If
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
Private Sub NuovoSito_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CartellaSito.Text = My.Computer.FileSystem.SpecialDirectories.MyDocuments
End Sub
Private Sub btnSfogliaCartellaSito_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSfogliaCartellaSito.Click
If SelezioneCartellaSito.ShowDialog() = Windows.Forms.DialogResult.OK Then
CartellaSito.Text = SelezioneCartellaSito.SelectedPath
End If
End Sub
End Class