SHARE
TWEET

Untitled

a guest Jan 15th, 2020 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Threading
  2. Imports System.Timers
  3.  
  4. Public Class Form1
  5.     Dim currentplay As Integer
  6.  
  7.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles play.Click
  8.         If (playlist.SelectedIndex >= 0) Then
  9.             'Si quelque chose est selectionné dans playlist
  10.             AxWindowsMediaPlayer1.URL = playlist.SelectedItem
  11.             AxWindowsMediaPlayer1.Ctlcontrols.play()
  12.             file_attente.Items.Clear()
  13.             file_attente.Items.Add(playlist.SelectedItem)
  14.             playlist.SetSelected(0, False)
  15.             Currentplaying()
  16.             file_attente.SetSelected(currentplay, True)
  17.  
  18.             'merde affichage
  19.             Label1.Text = "Nom du fichier : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Name") + "
  20. Auteur : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("author") + "
  21. Titre : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Title") + "
  22. Album : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Album") + "
  23. Copyright : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("copyright") + "
  24. Artiste : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Artist") + "
  25. Genre : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Genre") + "
  26. Abstract : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("Abstract") + "
  27. Bitrate : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("bitRate") + "
  28. Durée : " + AxWindowsMediaPlayer1.currentMedia.getItemInfo("duration")
  29.  
  30.         Else
  31.             'Si quelque chose est pas selectionné dans playlist (reprise de la pause)
  32.             AxWindowsMediaPlayer1.Ctlcontrols.play()
  33.         End If
  34.     End Sub
  35.  
  36.     Private Sub Button3_Click(sender As Object, e As EventArgs) Handles import.Click
  37.         importdiag.ShowDialog()
  38.     End Sub
  39.     Private Sub importdiag_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles importdiag.FileOk
  40.         For Each track As String In importdiag.FileNames
  41.             playlist.Items.Add(track)
  42.         Next
  43.     End Sub
  44.     Private Sub pause_Click(sender As Object, e As EventArgs) Handles pause.Click
  45.         AxWindowsMediaPlayer1.Ctlcontrols.pause()
  46.     End Sub
  47.     Private Sub ajouter_Click(sender As Object, e As EventArgs) Handles ajouter.Click
  48.         If (playlist.SelectedIndex <> -1) Then
  49.             ajouter_file_attente(playlist.SelectedItem)
  50.         End If
  51.     End Sub
  52.  
  53.     Private Sub file_attente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles file_attente.Click
  54.         ClearSelect()
  55.     End Sub
  56.  
  57.     Protected Sub ajouter_file_attente(ByVal url As Object)
  58.         AxWindowsMediaPlayer1.currentPlaylist.insertItem(AxWindowsMediaPlayer1.currentPlaylist.count, AxWindowsMediaPlayer1.newMedia(url))
  59.         file_attente.Items.Add(url)
  60.     End Sub
  61.     Protected Sub ClearSelect()
  62.         playlist.ClearSelected()
  63.     End Sub
  64.  
  65.     Private Sub ButtonNext_Click(sender As Object, e As EventArgs) Handles ButtonNext.Click
  66.         AxWindowsMediaPlayer1.Ctlcontrols.next()
  67.         If (file_attente.SelectedIndex <> -1) Then
  68.             currentplay += 1
  69.             file_attente.SetSelected(currentplay, True)
  70.         End If
  71.     End Sub
  72.  
  73.     Private Sub precedent_Click(sender As Object, e As EventArgs) Handles precedent.Click
  74.         AxWindowsMediaPlayer1.Ctlcontrols.previous()
  75.         If (file_attente.SelectedIndex <> -1) Then
  76.             currentplay -= 1
  77.             file_attente.SetSelected(currentplay, True)
  78.         End If
  79.     End Sub
  80.  
  81.     Private Sub Nettoyer_Click(sender As Object, e As EventArgs) Handles Nettoyer.Click
  82.         Currentplaying()
  83.         Clear_file_attente()
  84.     End Sub
  85.  
  86.     Protected Sub Clear_file_attente()
  87.         Currentplaying()
  88.         Dim indiceDelete As Integer
  89.         indiceDelete = 0
  90.         For i = 0 To AxWindowsMediaPlayer1.currentPlaylist.count - 1
  91.             If (i = currentplay) Then
  92.                 indiceDelete += 1
  93.             Else
  94.                 AxWindowsMediaPlayer1.currentPlaylist.removeItem((AxWindowsMediaPlayer1.currentPlaylist.Item(indiceDelete)))
  95.                 file_attente.Items.RemoveAt(indiceDelete)
  96.             End If
  97.         Next
  98.     End Sub
  99.     Protected Sub Currentplaying()
  100.         For i = 0 To AxWindowsMediaPlayer1.currentPlaylist.count - 1
  101.             If AxWindowsMediaPlayer1.currentMedia.isIdentical(AxWindowsMediaPlayer1.currentPlaylist.Item(i)) Then
  102.                 currentplay = i
  103.             End If
  104.         Next i
  105.     End Sub
  106.  
  107.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  108.         Timer1.Interval = 1000
  109.         Timer1.Start()
  110.         TrackBar1.Value = TrackBar1.Maximum
  111.     End Sub
  112.  
  113.     Private Sub Timer1_Tick(sender As System.Object, e As System.EventArgs) Handles Timer1.Tick
  114.         If (AxWindowsMediaPlayer1.playState = 3) Then
  115.             TrackBar2.Maximum = AxWindowsMediaPlayer1.currentMedia.duration
  116.             TrackBar2.Value = AxWindowsMediaPlayer1.Ctlcontrols.currentPosition
  117.             tempstotal.Text = AxWindowsMediaPlayer1.currentMedia.durationString
  118.             tempsecoule.Text = AxWindowsMediaPlayer1.Ctlcontrols.currentPositionString
  119.         ElseIf (AxWindowsMediaPlayer1.playState = 8 Or AxWindowsMediaPlayer1.playState = 10) Then
  120.             tempstotal.Text = ""
  121.             tempsecoule.Text = ""
  122.         End If
  123.     End Sub
  124.  
  125.     Private Sub Volume_Click(sender As Object, e As EventArgs) Handles Volume.Click
  126.  
  127.     End Sub
  128.  
  129.     Private Sub playlist_SelectedIndexChanged(sender As Object, e As EventArgs) Handles playlist.SelectedIndexChanged
  130.  
  131.     End Sub
  132.  
  133.     Private Sub TrackBar2_Scroll(sender As Object, e As EventArgs) Handles TrackBar2.Scroll
  134.         AxWindowsMediaPlayer1.Ctlcontrols.currentPosition = TrackBar2.Value
  135.     End Sub
  136.  
  137.     Private Sub TrackBar1_Scroll(sender As Object, e As EventArgs) Handles TrackBar1.Scroll
  138.         AxWindowsMediaPlayer1.settings.volume = TrackBar1.Value
  139.     End Sub
  140. End Class
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top