Public Class BrowserForm




    Private Sub ListBox1_DragDrop(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles filelistbox.DragDrop
        filelistbox.Items.Clear()
        Dim s() As String = e.Data.GetData("FileDrop", False)
        Dim i As Integer
        For i = 0 To s.Length - 1
            filelistbox.Items.Add(s(i))
        Next i
    End Sub

    Private Sub ListBox1_DragEnter(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles filelistbox.DragEnter
        If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then
            e.Effect = DragDropEffects.All
        Else
            e.Effect = DragDropEffects.None
        End If
    End Sub

    Private Sub ListBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles filelistbox.Click, filelistbox.SelectedIndexChanged
        webpagebox.ImageLocation = filelistbox.SelectedItem + webpagecombo.Text
        posterbox.ImageLocation = filelistbox.SelectedItem + postercombo.Text
        status1.Text = filelistbox.SelectedItem
        Me.Text = filelistbox.SelectedItem
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim returnValue As String() = Environment.GetCommandLineArgs
        postercombo.SelectedIndex = 0
        webpagecombo.SelectedIndex = 0
        status1.Text = "Drag and drop movies on the list, and browse them. Click left to expand. Click or double click right to open item or directory."
        If returnValue.Length = 2 Then
            status1.Text = returnValue(1)

            Dim fileReader As New System.IO.StreamReader(returnValue(1))
            Do While fileReader.Peek() <> -1
                filelistbox.Items.Add(fileReader.ReadLine())
            Loop
            fileReader.Close()

        End If

    End Sub

    Private Sub webpagebox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles webpagebox.Click
        System.Diagnostics.Process.Start(filelistbox.SelectedItem)

    End Sub

    Private Sub posterbox_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles posterbox.Click
        If webpagebox.ImageLocation = filelistbox.SelectedItem + webpagecombo.Text Then
            webpagebox.ImageLocation = filelistbox.SelectedItem + postercombo.Text
        ElseIf webpagebox.ImageLocation = filelistbox.SelectedItem + postercombo.Text Then
            webpagebox.ImageLocation = filelistbox.SelectedItem + webpagecombo.Text
        End If

    End Sub

    Private Sub webpagebox_DoubleClick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        webpagebox.ImageLocation = filelistbox.SelectedItem + webpagecombo.Text
    End Sub


    Private Sub webpagebox_DoubleClick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles webpagebox.DoubleClick
        System.Diagnostics.Process.Start(IO.Path.GetDirectoryName(filelistbox.SelectedItem))
    End Sub
End Class
