Пример #1
0
 private void playOrPause()
 {
     if (this._songPlayer.Status == PlayStatus.Playing)
     {
         this._songPlayer.Pause();
         pbPlay.Image = WYZPlayer.Properties.Resources.control_play;
     }
     else
     {
         if (PlaylistItemBindingSource.Count > 0)
         {
             if (PlaylistItemBindingSource.Current == null)
             {
                 PlaylistItemBindingSource.MoveFirst();
             }
             pbPlay.Image = WYZPlayer.Properties.Resources.control_pause;
             this._songPlayer.PlayMode = PlayMode.FullSong;
             if (this._songPlayer.CurrentSong == null)
             {
                 PlaylistItem item = (PlaylistItem)PlaylistItemBindingSource.Current;
                 if (item != null)
                 {
                     this._songPlayer.CurrentSong = item.Song;
                 }
             }
             if (this._songPlayer.CurrentSong != null)
             {
                 this._songPlayer.Play();
             }
         }
     }
 }
Пример #2
0
        private void pbRemove_Click(object sender, EventArgs e)
        {
            PlaylistItem item = (PlaylistItem)PlaylistItemBindingSource.Current;

            if (item != null)
            {
                PlaylistItemBindingSource.Remove(item);
                this.lstSongs.Invalidate();
            }
            saveLastPlayedSongs();
        }
Пример #3
0
 private void loadSongs()
 {
     System.Collections.Specialized.StringCollection lastSongs = WYZPlayer.Properties.Settings.Default.LastPlayedSongs;
     if (lastSongs != null)
     {
         foreach (string songPath in lastSongs)
         {
             loadSong(songPath);
         }
     }
     PlaylistItemBindingSource.CurrentChanged += new EventHandler(PlaylistItemBindingSource_CurrentChanged);
     PlaylistItemBindingSource.MoveFirst();
 }
Пример #4
0
        private void loadSong(string songPath)
        {
            try
            {
                PlaylistItem item = new PlaylistItem();
                item.FilePath = songPath;
                item.Song     = SongManager.LoadSong(songPath);
                PlaylistItemBindingSource.Add(item);

                if (PlaylistItemBindingSource.Current == null)
                {
                    PlaylistItemBindingSource.MoveFirst();
                }
            }
            catch (Exception ex)
            {
                Logger.Log(ex.ToString());
            }
        }