Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » VB.NET » General » Downloads
 
Add your own
alternative version

WMP Power Hour APP

, 31 Jul 2007
Using the Windows Media Player Component
cp_power_hour.zip
CP Power Hour
Power Hour
bin
Debug
Power Hour.vshost.exe
Release
My Project
Application.myapp
Settings.settings
Resources
powerhour.jpg
Power Hour.suo

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Froz3n
Web Developer
United States United States
Still in school, program for fun...

| Advertise | Privacy | Mobile
Web02 | 2.8.140902.1 | Last Updated 31 Jul 2007
Article Copyright 2007 by Froz3n
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid