Imports System.IO
Imports System.IO.IsolatedStorage
Imports System.Windows.Forms

Public Class FileChain
  Inherits Chain
  Private flist As ListBox
  '-----
  Public Sub New(ByVal lbox As ListBox)
    MyBase.new()
    flist = lbox
  End Sub
  '-----
  Public Overrides Sub sendToChain( _
          ByVal mesg As String)
    Dim fname As String
    Dim files As String()
    fname = mesg & "*.*"
    files = Directory.GetFiles(Directory.GetCurrentDirectory, fname)
    'Dodaj je do listy
    If files.Length > 0 Then
      Dim i As Integer
      For i = 0 To files.Length - 1
        Dim vbf As New vbFile(files(i))
        flist.Items.Add(vbf.getRootName)
      Next
    Else
      If hasChain() Then
        chn.sendToChain(mesg)
      End If
    End If
  End Sub
End Class
