private void btnPlay_Click(object sender, EventArgs e) { if (songListView1.SelectedItems.Count == 0) { return; } this.Player.PlayFile(songListView1.SelectedItems[0].SongInfo.FileName); SongPlayed?.Invoke(this, EventArgs.Empty); }
private void SongListView_DoubleClick(object sender, EventArgs e) { if (!_autoDoubleClick) { base.OnDoubleClick(e); } if (this.SelectedItems.Count > 0) { this.Player.PlayFile(this.SelectedItems[0].SongInfo.FileName); SongPlayed?.Invoke(this, EventArgs.Empty); } }
public void PlaySong(Song song) { if (song == null) { Messenger.Log("PlaySong called with null"); return; } if (NowPlaying == null) { NowPlaying = song; engine.Play(song); Messenger.Log("Playing " + song); } else if (!song.Equals(NowPlaying)) { Queue.Enqueue(song); Messenger.Log("Enqueued " + song); } SongPlayed?.Invoke(this, song); }
private void SongListView_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Q) { this.Player.Playlist.EventsEnabled = false; this.SelectedItems.ForEach(delegate(SongListViewItem item) { if (this.Player.Playlist.Contains(item.SongInfo.FileName)) { this.Player.Playlist.Remove(item.SongInfo.FileName); } else { this.Player.Playlist.AddToEnd(item.SongInfo); } }); this.Player.Playlist.EventsEnabled = true; SongQueued?.Invoke(this, EventArgs.Empty); } else if (e.KeyCode == Keys.F) { if (this.SelectedItems.Count > 0) { this.Player.ForceSong(this.SelectedItems[0].SongInfo.FileName); list.InvalidateItem(this.SelectedItems[0]); } } else if (e.KeyCode == Keys.Delete) { this.SelectedItems.ForEach(delegate(SongListViewItem item) { this.Library.Delete(item.SongInfo.FileName); list.Items.Remove(item); }); list.MeasureItems(); } else if (e.KeyCode == Keys.I) { this.SelectedItems.ForEach(delegate(SongListViewItem item) { if (item.SongInfo.Ignored) { this.Library.UnIgnore(item.SongInfo.FileName); } else { this.Library.Ignore(item.SongInfo.FileName); } }); } else if (e.KeyCode == Keys.Enter) { if (this.SelectedItems.Count > 0) { this.Player.PlayFile(this.SelectedItems[0].SongInfo.FileName); SongPlayed?.Invoke(this, EventArgs.Empty); } } else if (Control.ModifierKeys == Keys.Control && e.KeyCode == Keys.A) { list.SelectedItems.Clear(); list.SelectedItems.AddRange(list.Items); list.Invalidate(); } }
private void songListView1_SongPlayed(object sender, EventArgs e) { SongPlayed?.Invoke(this, EventArgs.Empty); }