Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Threading
- Imports System.Timers
- Public Class Form1
- Dim currentplay As Integer
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles play.Click
- If (playlist.SelectedIndex >= 0) Then
- 'Si quelque chose est selectionné dans playlist
- AxWindowsMediaPlayer1.URL = playlist.SelectedItem
- AxWindowsMediaPlayer1.Ctlcontrols.play()
- file_attente.Items.Clear()
- file_attente.Items.Add(playlist.SelectedItem)
- playlist.SetSelected(0, False)
- Currentplaying()
- file_attente.SetSelected(currentplay, True)
- 'merde affichage
- Label1.Text = "Nom du fichier : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Name") + "
- Auteur : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("author") + "
- Titre : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Title") + "
- Album : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Album") + "
- Copyright : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("copyright") + "
- Artiste : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Artist") + "
- Genre : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Genre") + "
- Abstract : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Abstract") + "
- Bitrate : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("bitRate") + "
- Durée : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("duration")
- Else
- 'Si quelque chose est pas selectionné dans playlist (reprise de la pause)
- AxWindowsMediaPlayer1.Ctlcontrols.play()
- End If
- End Sub
- Private Sub Button3_Click(sender As Object, e As EventArgs) Handles import.Click
- importdiag.ShowDialog()
- End Sub
- Private Sub importdiag_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles importdiag.FileOk
- For Each track As String In importdiag.FileNames
- playlist.Items.Add(track)
- Next
- End Sub
- Private Sub pause_Click(sender As Object, e As EventArgs) Handles pause.Click
- AxWindowsMediaPlayer1.Ctlcontrols.pause()
- End Sub
- Private Sub ajouter_Click(sender As Object, e As EventArgs) Handles ajouter.Click
- If (playlist.SelectedIndex <> -1) Then
- ajouter_file_attente(playlist.SelectedItem)
- End If
- End Sub
- Private Sub file_attente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles file_attente.Click
- ClearSelect()
- End Sub
- Protected Sub ajouter_file_attente(ByVal url As Object)
- AxWindowsMediaPlayer1.currentPlaylist.insertItem(AxWindowsMediaPlayer1.currentPlaylist.count, AxWindowsMediaPlayer1.newMedia(url))
- file_attente.Items.Add(url)
- End Sub
- Protected Sub ClearSelect()
- playlist.ClearSelected()
- End Sub
- Private Sub ButtonNext_Click(sender As Object, e As EventArgs) Handles ButtonNext.Click
- AxWindowsMediaPlayer1.Ctlcontrols.next()
- If (file_attente.SelectedIndex <> -1) Then
- currentplay += 1
- file_attente.SetSelected(currentplay, True)
- End If
- End Sub
- Private Sub precedent_Click(sender As Object, e As EventArgs) Handles precedent.Click
- AxWindowsMediaPlayer1.Ctlcontrols.previous()
- If (file_attente.SelectedIndex <> -1) Then
- currentplay -= 1
- file_attente.SetSelected(currentplay, True)
- End If
- End Sub
- Private Sub Nettoyer_Click(sender As Object, e As EventArgs) Handles Nettoyer.Click
- Currentplaying()
- Clear_file_attente()
- End Sub
- Protected Sub Clear_file_attente()
- Currentplaying()
- Dim indiceDelete As Integer
- indiceDelete = 0
- For i = 0 To AxWindowsMediaPlayer1.currentPlaylist.count - 1
- If (i = currentplay) Then
- indiceDelete += 1
- Else
- AxWindowsMediaPlayer1.currentPlaylist.removeItem((AxWindowsMediaPlayer1.currentPlaylist.Item(indiceDelete)))
- file_attente.Items.RemoveAt(indiceDelete)
- End If
- Next
- End Sub
- Protected Sub Currentplaying()
- For i = 0 To AxWindowsMediaPlayer1.currentPlaylist.count - 1
- If AxWindowsMediaPlayer1.currentMedia.isIdentical(AxWindowsMediaPlayer1.currentPlaylist.Item(i)) Then
- currentplay = i
- End If
- Next i
- End Sub
- Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
- Timer1.Interval = 1000
- Timer1.Start()
- TrackBar1.Value = TrackBar1.Maximum
- End Sub
- Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
- If (AxWindowsMediaPlayer1.playState = 3) Then
- TrackBar2.Maximum = AxWindowsMediaPlayer1.currentMedia.duration
- TrackBar2.Value = AxWindowsMediaPlayer1.Ctlcontrols.currentPosition
- tempstotal.Text = AxWindowsMediaPlayer1.currentMedia.durationString
- tempsecoule.Text = AxWindowsMediaPlayer1.Ctlcontrols.currentPositionString
- ElseIf (AxWindowsMediaPlayer1.playState = 8 Or AxWindowsMediaPlayer1.playState = 10) Then
- tempstotal.Text = ""
- tempsecoule.Text = ""
- End If
- End Sub
- Private Sub Volume_Click(sender As Object, e As EventArgs) Handles Volume.Click
- End Sub
- Private Sub playlist_SelectedIndexChanged(sender As Object, e As EventArgs) Handles playlist.SelectedIndexChanged
- End Sub
- Private Sub TrackBar2_Scroll(sender As Object, e As EventArgs) Handles TrackBar2.Scroll
- AxWindowsMediaPlayer1.Ctlcontrols.currentPosition = TrackBar2.Value
- End Sub
- Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
- AxWindowsMediaPlayer1.settings.volume = TrackBar1.Value
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement