// Button play clicked // Hide play and show pause private void buttonPlay_Click(object sender, RoutedEventArgs e) { if (Play != null) { CancelRoutedEventArgs args = new CancelRoutedEventArgs("Toggle play"); Play(this, args); if (args.Cancel) return; } Playing = true; this.Paused = false; buttonPlay.Visibility = System.Windows.Visibility.Collapsed; buttonPause.Visibility = System.Windows.Visibility.Visible; }
/// <summary> /// PlayerControl play-handler /// </summary> /// <param name="sender">Sender</param> /// <param name="e">Event args</param> public void playerControl_Play(object sender, CancelRoutedEventArgs e) { if (Playlist.Count == 0) { MessageBox.Show("No songs in playlist"); e.Cancel = true; } else { if (listBoxPlaylist.SelectedIndex == -1) { listBoxPlaylist.SelectedIndex = 0; } if (this.paused) { Connection.SendCommand(MPDClient.PAUSE, "0"); this.paused = false; } else Connection.SendCommand(MPDClient.PLAY); PlayerStatus = "Playing"; } }