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("Аудиодорожка отсутствует");
            }
        }
 private void Button_STOP(object sender, RoutedEventArgs e)
 {
     BASSlike.stop();
     timer.Stop();
     Prog.Value         = 0;
     label1.Content     = "00:00:00";
     PlayButton.Content = "Play";
     i = 2;
 }
        private void Prog_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            string current = MAin.Files[Playlist.SelectedIndex];

            System.Windows.Point mousepnt = e.GetPosition(this);
            double value = ((mousepnt.X - Prog.Margin.Left) / Prog.Width) * Prog.Maximum;

            Prog.Value = value;
            BASSlike.SetPosition(BASSlike.Stream, (int)Prog.Value);
            timer.Start();
        }
 private void Slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs <double> e)
 {
     BASSlike.SetVolumeToStream(BASSlike.Stream, Vol.Value);
 }
 private void timer_Tick(object sender, EventArgs e)
 {
     label1.Content = TimeSpan.FromSeconds(BASSlike.GetPosition(BASSlike.Stream)).ToString();
     Prog.Value     = BASSlike.GetPosition(BASSlike.Stream);
     Prog.Maximum   = BASSlike.GetTimeOfStream(BASSlike.Stream);
 }