|
Public Class PowerHour
Dim startTime As DateTime
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
' If the button is clicked then start the timer. Oncer the timer is started and the button is clicked again
' the timer is stopped and the player fails
If (Timer1.Enabled) Then
Timer1.Stop()
MessageBox.Show("You did not complete power hour", "Failed")
Label3.Text = String.Empty
Label4.Text = String.Empty
Else
startTime = DateTime.Now()
Timer1.Start()
Button1.Text = "Stop!"
End If
End Sub
Private Sub PowerHour_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim span As TimeSpan = DateTime.Now.Subtract(startTime)
Label4.Text = span.Seconds.ToString
ProgressBar1.Value += 1
If ProgressBar1.Value = 60 Then
ProgressBar1.Value = 0
ProgressBar2.Value += 1
Dim span2 As TimeSpan = DateTime.Now.Subtract(startTime)
Label3.Text = span2.Minutes.ToString
wmp.Ctlcontrols.next()
If ProgressBar2.Value = 60 Then
MessageBox.Show("You've completed power hours", "Congratulations!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
ProgressBar2.Value = 0
End If
End If
End Sub
Private Sub AddMusicToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AddMusicToolStripMenuItem.Click
Dim dlg As New OpenFileDialog()
dlg.InitialDirectory = "C:\"
dlg.CheckFileExists = True
dlg.Title = "Import a Playlist from WMP"
dlg.Filter = "Windows Media Playlists|*.wpl"
dlg.Multiselect = False
dlg.ShowDialog()
wmp.URL = dlg.FileName
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.