Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
GN WebStudio - SelettoreURL.vb

SelettoreURL.vb

Caricato da: GN
Scarica il programma completo

  1. Public Class SelettoreURL
  2.     Public URL As String
  3.     Public ModalitàImmagine As Boolean = False
  4.     Sub ApriCartella(ByVal Cartella As String, ByVal Nodo As TreeNode)
  5.         For Each CartellaCorr As String In My.Computer.FileSystem.GetDirectories(Cartella)
  6.             If Object.Equals(Nodo, Nothing) Then
  7.                 GestioneFiles.Nodes.Add(CartellaCorr, New IO.DirectoryInfo(CartellaCorr).Name, 0)
  8.                 Me.ApriCartella(CartellaCorr, GestioneFiles.Nodes(GestioneFiles.Nodes.Count - 1))
  9.             Else
  10.                 Nodo.Nodes.Add(CartellaCorr, New IO.DirectoryInfo(CartellaCorr).Name, 0)
  11.                 Me.ApriCartella(CartellaCorr, Nodo.LastNode)
  12.             End If
  13.         Next
  14.         Dim Lista As ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(Cartella, FileIO.SearchOption.SearchTopLevelOnly)
  15.         If ModalitàImmagine = True Then
  16.             Dim Estensioni() As String = {"*.bmp", "*.gif", "*.jpg", "*.jpeg", "*.jpe", "*.wmf", "*.emf", "*.ico"}
  17.             Lista = My.Computer.FileSystem.GetFiles(Cartella, FileIO.SearchOption.SearchTopLevelOnly, Estensioni)
  18.         End If
  19.         For Each FileCorr As String In Lista
  20.             Dim imgId As Integer = 1
  21.             Select Case New IO.FileInfo(FileCorr).Extension.ToLower()
  22.                 Case ".htm", ".html"
  23.                     imgId = 2
  24.                 Case ".css", ".txt", ".js"
  25.                     imgId = 3
  26.                 Case ".bmp", ".gif", ".jpg", ".jpeg", ".jpe", ".wmf", ".emf", ".ico"
  27.                     imgId = 4
  28.             End Select
  29.             If Object.Equals(Nodo, Nothing) Then
  30.                 GestioneFiles.Nodes.Add(FileCorr, New IO.FileInfo(FileCorr).Name, imgId)
  31.             Else
  32.                 Nodo.Nodes.Add(FileCorr, New IO.FileInfo(FileCorr).Name, imgId)
  33.             End If
  34.         Next
  35.     End Sub
  36.  
  37.     Private Sub SelettoreURL_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  38.         Me.ApriCartella(My.Computer.FileSystem.GetParentPath(MainForm.FileCorr), Nothing)
  39.     End Sub
  40.  
  41.     Private Sub Tipo_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FileSito.CheckedChanged, AltroURL.CheckedChanged
  42.         GestioneFiles.Enabled = FileSito.Checked
  43.         txtAltroURL.Enabled = AltroURL.Checked
  44.     End Sub
  45.  
  46.     Private Sub GestioneFiles_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles GestioneFiles.AfterSelect
  47.         GestioneFiles.SelectedImageIndex = GestioneFiles.SelectedNode.ImageIndex
  48.         URL = GestioneFiles.SelectedNode.FullPath
  49.     End Sub
  50.  
  51.     Private Sub txtAltroURL_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtAltroURL.TextChanged
  52.         URL = txtAltroURL.Text
  53.     End Sub
  54. End Class