예제 #1
0
        private void PlaylistChanged(object sender, MouseButtonEventArgs e)
        {
            PlaylistInfo p = (PlaylistInfo)Selection.SelectedItem;

            if (p != null)
            {
                curPlaylist        = PlaylistCollection.IndexOf(p);
                titre.Text         = PlaylistCollection.ElementAt(curPlaylist).Name;
                liste.ItemsSource  = SoundCollection;
                labelTotal.Content = Total();
                if ((PlaylistCollection.ElementAt(curPlaylist)).SoundCollection.Count > 0)
                {
                    if ((PlaylistCollection.ElementAt(curPlay)).SoundCollection.Count > 0)
                    {
                        SoundInfo s = (PlaylistCollection.ElementAt(curPlay)).SoundCollection.ElementAt((PlaylistCollection.ElementAt(curPlay)).cur);
                        s.Icone = "";
                        (PlaylistCollection.ElementAt(curPlay)).SoundCollection.RemoveAt((PlaylistCollection.ElementAt(curPlay)).cur);
                        (PlaylistCollection.ElementAt(curPlay)).SoundCollection.Insert((PlaylistCollection.ElementAt(curPlay)).cur, s);
                        (PlaylistCollection.ElementAt(curPlaylist)).cur = 0;
                    }
                    curPlay = curPlaylist;
                    SoundInfo curS = (PlaylistCollection.ElementAt(curPlaylist)).SoundCollection.ElementAt(0);
                    if (play)
                    {
                        curS.Icone = "/MediaPlayer;component/Images/playing.png";
                    }
                    SoundCollection.RemoveAt((PlaylistCollection.ElementAt(curPlaylist)).cur);
                    SoundCollection.Insert((PlaylistCollection.ElementAt(curPlaylist)).cur, curS);
                    liste.SelectedItem = curS;
                    RoutedEventArgs newEventArgs = new RoutedEventArgs(SelectedEvent);
                    RaiseEvent(newEventArgs);
                }
            }
        }
예제 #2
0
        public void SearchPlaylist(string sPath)
        {
            PlaylistInfo p = null;

            foreach (PlaylistInfo tmp in PlaylistCollection)
            {
                if (tmp.path == sPath)
                {
                    p = tmp;
                    break;
                }
            }

            if (p != null)
            {
                curPlaylist        = PlaylistCollection.IndexOf(p);
                titre.Text         = p.Name;
                liste.ItemsSource  = SoundCollection;
                labelTotal.Content = Total();
            }
            else
            {
                PlaylistCollection.Insert(idPlaylist, new PlaylistInfo {
                    Name = System.IO.Path.GetFileNameWithoutExtension(sPath), path = sPath, id = 0, cur = 0
                });
                p           = PlaylistCollection.ElementAt(idPlaylist);
                curPlaylist = idPlaylist;
                idPlaylist++;
                string[] lines = System.IO.File.ReadAllLines(System.IO.Path.GetFullPath(sPath));
                foreach (string line in lines)
                {
                    AddSound(line);
                }
                titre.Text         = PlaylistCollection.ElementAt(curPlaylist).Name;
                liste.ItemsSource  = SoundCollection;
                labelTotal.Content = Total();
            }
        }