private void Button_Play(object sender, RoutedEventArgs e) { if ((Playlist.Items.Count != 0) && (Playlist.SelectedIndex != -1) && i == 2) { label3.Content = Playlist.SelectedItem.ToString(); timer.Tick += new EventHandler(timer_Tick); timer.Interval = new TimeSpan(500); string current = MAin.Files[Playlist.SelectedIndex]; BASSlike.Play(current, BASSlike.Volume); label2.Content = TimeSpan.FromSeconds(BASSlike.GetTimeOfStream(BASSlike.Stream)); Prog.Maximum = BASSlike.GetTimeOfStream(BASSlike.Stream); timer.IsEnabled = true; timer.Start(); PlayButton.Content = "Pause"; i = 1; } else { if ((i == 1) && (Playlist.SelectedIndex != -1)) { BASSlike.Pause(); timer.IsEnabled = false; PlayButton.Content = "Play"; i = 2; } else { MessageBox.Show("Выберите аудиодорожку"); } } }
private void Button_Next(object sender, RoutedEventArgs e) { int i = Playlist.SelectedIndex; if (i < MAin.Files.Count - 1 && i != -1 && Playlist.SelectedIndex != -1) { Playlist.SelectedIndex++; BASSlike.stop(); timer.Stop(); Prog.Value = 0; label1.Content = "00:00:00"; label3.Content = Playlist.SelectedItem.ToString(); timer.Tick += new EventHandler(timer_Tick); timer.Interval = new TimeSpan(1); string current = MAin.Files[Playlist.SelectedIndex]; BASSlike.Play(current, BASSlike.Volume); label2.Content = TimeSpan.FromSeconds(BASSlike.GetTimeOfStream(BASSlike.Stream)); Prog.Maximum = BASSlike.GetTimeOfStream(BASSlike.Stream); timer.IsEnabled = true; timer.Start(); p = 1; } else { MessageBox.Show("Аудиодорожка отсутствует"); } }