Project 1 VB

Signed-off-by: Amrit Panesar <apanesar@4195tech.com>
This commit is contained in:
Amrit Panesar committed 2015-04-08 21:16:35 -07:00
1 parent d5bfd3186e
commit edaeb72a9f
68 files changed
+57 -21

No files matched your search

Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
Whitespace-only changes.
+57 -21
View File
@@ -18,7 +18,7 @@
Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged
If ListBox1.SelectedIndex >= 0 Then If ListBox1.SelectedIndex >= 0 Then
Dim selectedFile As FileData = ListBox1.Items(ListBox1.SelectedIndex) Dim selectedFile As FileData = ListBox1.Items(ListBox1.SelectedIndex)
Dim holdTime = selectedFile.FileTime + Options.PlaylistTime Dim holdTime = selectedFile.FileTime + Options.PlaylistTime + Options.SongGap
If holdTime <= Options.PlaylistLength Then If holdTime <= Options.PlaylistLength Then
Button1.Enabled = True Button1.Enabled = True
@@ -37,38 +37,62 @@
End Sub End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Button1.Enabled = False
Button2.Enabled = False
Button3.Enabled = True
Button4.Enabled = False
If ListBox1.SelectedIndex >= 0 Then If ListBox1.SelectedIndex >= 0 Then
Dim file As FileData = ListBox1.Items(ListBox1.SelectedIndex) Dim file As FileData = ListBox1.Items(ListBox1.SelectedIndex)
ListBox1.Items.RemoveAt(ListBox1.SelectedIndex) ListBox1.Items.RemoveAt(ListBox1.SelectedIndex)
RemoveFileFromTotal(file) RemoveFileFromTotal(file)
ListBox2.Items.Add(file)
AddFileToPlaylist(file) AddFileToPlaylist(file)
ListBox2.Items.Add(file)
End If End If
ListBox1.SelectedIndex = -1 ListBox1.SelectedIndex = -1
Button1.Enabled = False
End Sub End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Button1.Enabled = False Button1.Enabled = False
Button2.Enabled = False Button2.Enabled = False
Button3.Enabled = True
Button4.Enabled = False
For index As Integer = ListBox1.Items.Count() - 1 To 0 Step -1 For index As Integer = ListBox1.Items.Count() - 1 To 0 Step -1
Dim file As FileData = ListBox1.Items(index) Dim file As FileData = ListBox1.Items(index)
If (file.FileTime + Options.PlaylistTime < Options.PlaylistLength) Then If (file.FileTime + Options.PlaylistTime + Options.SongGap < Options.PlaylistLength) Then
ListBox1.Items.RemoveAt(index) ListBox1.Items.RemoveAt(index)
RemoveFileFromTotal(file) RemoveFileFromTotal(file)
ListBox2.Items.Add(file)
AddFileToPlaylist(file) AddFileToPlaylist(file)
ListBox2.Items.Add(file)
End If End If
Next Next
End Sub End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
Button1.Enabled = False
Button2.Enabled = True
Button3.Enabled = False Button3.Enabled = False
Button4.Enabled = False Button4.Enabled = False
For index As Integer = ListBox2.Items.Count() - 1 To 0 Step -1
Dim file As FileData = ListBox2.Items(index)
ListBox2.Items.RemoveAt(index)
RemoveFileFromPlaylist(file)
ListBox1.Items.Add(file)
AddFileToTotal(file)
Next
End Sub End Sub
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
Button1.Enabled = False
Button2.Enabled = True
Button3.Enabled = False
Button4.Enabled = False
If ListBox2.SelectedIndex >= 0 Then If ListBox2.SelectedIndex >= 0 Then
Dim file As FileData = ListBox2.Items(ListBox2.SelectedIndex) Dim file As FileData = ListBox2.Items(ListBox2.SelectedIndex)
ListBox2.Items.RemoveAt(ListBox2.SelectedIndex) ListBox2.Items.RemoveAt(ListBox2.SelectedIndex)
@@ -76,8 +100,9 @@
ListBox1.Items.Add(file) ListBox1.Items.Add(file)
AddFileToTotal(file) AddFileToTotal(file)
End If End If
ListBox2.SelectedIndex = -1 ListBox2.SelectedIndex = -1
Button4.Enabled = False
End Sub End Sub
@@ -103,23 +128,26 @@
End If End If
Label6.Text = formattedTime Label6.Text = formattedTime
For Each foundFile As String In My.Computer.FileSystem.GetFiles(Options.Directory) If (String.Compare(Options.Directory, String.Empty) = 1) Then
foundFile = My.Computer.FileSystem.GetName(foundFile) For Each foundFile As String In My.Computer.FileSystem.GetFiles(Options.Directory)
Dim foundExt = System.IO.Path.GetExtension(foundFile) foundFile = My.Computer.FileSystem.GetName(foundFile)
For Each lext As String In Options.ExtensionsList Dim foundExt = System.IO.Path.GetExtension(foundFile)
If foundExt = lext Then For Each lext As String In Options.ExtensionsList
Dim randomTime As Integer = CInt(Int(((6 * 60) * Rnd()) + 60)) If foundExt = lext Then
Dim file As New FileData(foundFile, randomTime) Dim randomTime As Integer = CInt(Int(((6 * 60) * Rnd()) + 60))
ListBox1.Items.Add(file) Dim file As New FileData(foundFile, randomTime)
AddFileToTotal(file) ListBox1.Items.Add(file)
End If AddFileToTotal(file)
End If
Next
Next Next
Next If ListBox1.Items.Count > 0 Then
If ListBox1.Items.Count > 0 Then Button2.Enabled = True
Button2.Enabled = True Else
Else Button2.Enabled = False
Button2.Enabled = False End If
End If End If
End Sub End Sub
Private Sub AddFileToTotal(file As FileData) Private Sub AddFileToTotal(file As FileData)
@@ -155,6 +183,11 @@
Private Sub AddFileToPlaylist(file As FileData) Private Sub AddFileToPlaylist(file As FileData)
Options.PlaylistTime += file.FileTime Options.PlaylistTime += file.FileTime
If (ListBox2.Items.Count >= 1) Then
Options.PlaylistTime += Options.SongGap
End If
Dim formattedTime As String = String.Empty Dim formattedTime As String = String.Empty
Dim iSpan As TimeSpan = TimeSpan.FromSeconds(Options.PlaylistTime) Dim iSpan As TimeSpan = TimeSpan.FromSeconds(Options.PlaylistTime)
If iSpan.Hours > 0 Then If iSpan.Hours > 0 Then
@@ -170,6 +203,9 @@
Private Sub RemoveFileFromPlaylist(file As FileData) Private Sub RemoveFileFromPlaylist(file As FileData)
Options.PlaylistTime -= file.FileTime Options.PlaylistTime -= file.FileTime
If (ListBox2.Items.Count >= 1) Then
Options.PlaylistTime -= Options.SongGap
End If
Dim formattedTime As String = String.Empty Dim formattedTime As String = String.Empty
Dim iSpan As TimeSpan = TimeSpan.FromSeconds(Options.PlaylistTime) Dim iSpan As TimeSpan = TimeSpan.FromSeconds(Options.PlaylistTime)
If iSpan.Hours > 0 Then If iSpan.Hours > 0 Then