public void OnSendSongName(SongNameEventArgs e) { if (SendSongName != null) { SendSongName(this, e); } }
public void SendName(String songName) //for automatically playing playlist { var messageToSend = new SongNameEventArgs(songName, false); OnSendSongName(messageToSend); _currentActiveSongIndex = songListBox.SelectedIndex = NextSongIndex(_currentActiveSongIndex); }
//event handlers subscriber public void SendSongNameHandler(object sender, SongNameEventArgs e) { if (song != null) { StopSong(); } _songName = e.message; song = new Song(_songName); textBox1.Text = Path.GetFileName(e.message); _tikerIterator = 0; songTrackBar.Value = 0; durationTextBox.Text = TimeSpan.FromSeconds(CountSeconds(GetVideoDuration(e.message))).ToString(); songTrackBar.Maximum = CountSeconds(GetVideoDuration(e.message)); if (e.fromChooseButton)//sended from ChooseButton { song.Stop(); songTimer.Stop(); PlayPauseButtonActive(); } else //sended by playing automatically { PlaySong(_songName); } }
public void SendName(String songName, Boolean fromChooseButton) //for choose button { songName = songListUrl[songListBox.SelectedIndex]; var messageToSend = new SongNameEventArgs(songName, fromChooseButton); OnSendSongName(messageToSend); _currentActiveSongIndex = songListBox.SelectedIndex; }