//Воспроизведение
        private void butPlay_Click(object sender, EventArgs e)
        {
            if ((PlayList.Items.Count != 0) && (PlayList.SelectedIndex != -1))
            {
                string current = Vars.Files[PlayList.SelectedIndex];
                Vars.CurrentTrackNumber = PlayList.SelectedIndex;
                BassPlayer.Play(current, BassPlayer.Volume);
                Song SongNow = new Song(current);
                SongName.Text = SongNow.Title;
                Album.Text    = SongNow.AlbumName;
                Band.Text     = SongNow.ArtistName;
                Year.Text     = SongNow.Year;

                try
                {
                    TagLib.File file_TAG = TagLib.File.Create(current);
                    var         bin      = (byte[])(file_TAG.Tag.Pictures[0].Data.Data);

                    var img = GetArt.ImgFromBytes(bin);
                    Art.Source = img;
                }
                catch
                {
                    BitmapImage bi3 = new BitmapImage();
                    bi3.UriSource = new Uri("vinil.png", UriKind.Relative);
                    Art.Source    = bi3;
                }

                SongTimeNow.Text   = TimeSpan.FromSeconds(BassPlayer.GetPos(BassPlayer.Stream)).ToString();
                SongLenght.Text    = TimeSpan.FromSeconds(BassPlayer.GetSongLenght(BassPlayer.Stream)).ToString();
                TimeSlider.Maximum = BassPlayer.GetSongLenght(BassPlayer.Stream);
                TimeSlider.Value   = BassPlayer.GetPos(BassPlayer.Stream);
                timerStart();
            }
        }
        //Перемотка
        private void TimeSlider_Scroll(object sender, EventArgs Handlere)
        {
            Slider slider = sender as Slider;

            //Классный костыль, т.к. метод смены времени запускался тогда, когда слайдер сам двигался,
            //то теперь он будет двигаться, если разница во времени больше секунды или отрицательная
            if (slider.Value - BassPlayer.GetPos(BassPlayer.Stream) > 1 || slider.Value - BassPlayer.GetPos(BassPlayer.Stream) < 0)
            {
                BassPlayer.PosScroll(BassPlayer.Stream, slider.Value);
            }
        }
 //Стоп
 private void butStop_Click(object sender, EventArgs e)
 {
     try
     { if (timer != null)
       {
           BassPlayer.Stop();
           timer.Stop();
           TimeSlider.Value = 0;
           SongTimeNow.Text = "00:00:00";
       }
     }
     catch { }
 }
        //Изменение громкости
        private void VolumeSlider_Scroll(object sender, EventArgs e)
        {
            Slider slider = sender as Slider;

            BassPlayer.SetVolume(BassPlayer.Stream, (int)slider.Value);
        }
        //Следующий трэк
        private void butForvard_Click(object sender, EventArgs e)
        {
            string current = "";

            if ((PlayList.Items.Count != 0) && (PlayList.SelectedIndex != -1))
            {
                if (Vars.Shuffle == true)
                {
                    Random rand = new Random();
                    int    r    = rand.Next(0, Vars.Files.Count);

                    current = Vars.Files[r];
                    Vars.CurrentTrackNumber = r;
                    PlayList.SelectedIndex  = r;

                    BassPlayer.Play(current, BassPlayer.Volume);
                    Song SongNow = new Song(current);
                    SongName.Text = SongNow.Title;
                    Album.Text    = SongNow.AlbumName;
                    Band.Text     = SongNow.ArtistName;
                    Year.Text     = SongNow.Year;

                    try
                    {
                        TagLib.File file_TAG = TagLib.File.Create(current);
                        var         bin      = (byte[])(file_TAG.Tag.Pictures[0].Data.Data);

                        var img = GetArt.ImgFromBytes(bin);
                        Art.Source = img;
                    }
                    catch
                    {
                        BitmapImage bi3 = new BitmapImage();
                        bi3.UriSource = new Uri("vinil.png", UriKind.Relative);
                        Art.Source    = bi3;
                    }

                    SongTimeNow.Text   = TimeSpan.FromSeconds(BassPlayer.GetPos(BassPlayer.Stream)).ToString();
                    SongLenght.Text    = TimeSpan.FromSeconds(BassPlayer.GetSongLenght(BassPlayer.Stream)).ToString();
                    TimeSlider.Maximum = BassPlayer.GetSongLenght(BassPlayer.Stream);
                    TimeSlider.Value   = BassPlayer.GetPos(BassPlayer.Stream);
                }
                else if (Vars.Repeat == true)
                {
                    BassPlayer.Play(Vars.Files[Vars.CurrentTrackNumber], BassPlayer.Volume);
                }
                else
                {
                    if (Vars.Files.Count > Vars.CurrentTrackNumber + 1)
                    {
                        current = Vars.Files[PlayList.SelectedIndex + 1];
                        Vars.CurrentTrackNumber++;
                        PlayList.SelectedIndex = PlayList.SelectedIndex + 1;
                    }

                    else
                    {
                        current = Vars.Files[0];
                        Vars.CurrentTrackNumber = 0;
                        PlayList.SelectedIndex  = 0;
                    }

                    BassPlayer.Play(current, BassPlayer.Volume);
                    Song SongNow = new Song(current);
                    SongName.Text = SongNow.Title;
                    Album.Text    = SongNow.AlbumName;
                    Band.Text     = SongNow.ArtistName;
                    Year.Text     = SongNow.Year;

                    try
                    {
                        TagLib.File file_TAG = TagLib.File.Create(current);
                        var         bin      = (byte[])(file_TAG.Tag.Pictures[0].Data.Data);

                        var img = GetArt.ImgFromBytes(bin);
                        Art.Source = img;
                    }
                    catch
                    {
                        BitmapImage bi3 = new BitmapImage();
                        bi3.UriSource = new Uri("vinil.png", UriKind.Relative);
                        Art.Source    = bi3;
                    }

                    SongTimeNow.Text   = TimeSpan.FromSeconds(BassPlayer.GetPos(BassPlayer.Stream)).ToString();
                    SongLenght.Text    = TimeSpan.FromSeconds(BassPlayer.GetSongLenght(BassPlayer.Stream)).ToString();
                    TimeSlider.Maximum = BassPlayer.GetSongLenght(BassPlayer.Stream);
                    TimeSlider.Value   = BassPlayer.GetPos(BassPlayer.Stream);
                    timerStart();
                }
            }
        }
 public MainWindow()
 {
     InitializeComponent();
     BassPlayer.InitBass(BassPlayer.Hz);
     GetPlaylists();
 }
 //Пауза
 private void butPause_Click(object sender, EventArgs e)
 {
     BassPlayer.Pause();
 }
        private void timerTick(object sender, EventArgs e)
        {
            SongTimeNow.Text = TimeSpan.FromSeconds(BassPlayer.GetPos(BassPlayer.Stream)).ToString();
            TimeSlider.Value = BassPlayer.GetPos(BassPlayer.Stream);

            if (BassPlayer.ToNextTrack())
            {
                TimeSlider.Value = 0;
                if (Vars.Shuffle == true)
                {
                    Random rand = new Random();
                    int    r    = rand.Next(0, Vars.Files.Count);

                    string current = Vars.Files[r];
                    Vars.CurrentTrackNumber = r;
                    PlayList.SelectedIndex  = r;

                    BassPlayer.Play(current, BassPlayer.Volume);
                    Song SongNow = new Song(current);
                    SongName.Text = SongNow.Title;
                    Album.Text    = SongNow.AlbumName;
                    Band.Text     = SongNow.ArtistName;
                    Year.Text     = SongNow.Year;

                    try
                    {
                        TagLib.File file_TAG = TagLib.File.Create(current);
                        var         bin      = (byte[])(file_TAG.Tag.Pictures[0].Data.Data);

                        var img = GetArt.ImgFromBytes(bin);
                        Art.Source = img;
                    }
                    catch
                    {
                        BitmapImage bi3 = new BitmapImage();
                        bi3.UriSource = new Uri("vinil.png", UriKind.Relative);
                        Art.Source    = bi3;
                    }

                    SongTimeNow.Text   = TimeSpan.FromSeconds(BassPlayer.GetPos(BassPlayer.Stream)).ToString();
                    SongLenght.Text    = TimeSpan.FromSeconds(BassPlayer.GetSongLenght(BassPlayer.Stream)).ToString();
                    TimeSlider.Maximum = BassPlayer.GetSongLenght(BassPlayer.Stream);
                    TimeSlider.Value   = BassPlayer.GetPos(BassPlayer.Stream);
                }
                else
                {
                    string current = Vars.Files[PlayList.SelectedIndex + 1];
                    PlayList.SelectedIndex = Vars.CurrentTrackNumber;

                    Song SongNow = new Song(current);
                    SongName.Text = SongNow.Title;
                    Album.Text    = SongNow.AlbumName;
                    Band.Text     = SongNow.ArtistName;
                    Year.Text     = SongNow.Year;

                    try
                    {
                        TagLib.File file_TAG = TagLib.File.Create(current);
                        var         bin      = (byte[])(file_TAG.Tag.Pictures[0].Data.Data);

                        var img = GetArt.ImgFromBytes(bin);
                        Art.Source = img;
                    }
                    catch
                    {
                        BitmapImage bi3 = new BitmapImage();
                        bi3.UriSource = new Uri("vinil.png", UriKind.Relative);
                        Art.Source    = bi3;
                    }

                    SongTimeNow.Text   = TimeSpan.FromSeconds(BassPlayer.GetPos(BassPlayer.Stream)).ToString();
                    SongLenght.Text    = TimeSpan.FromSeconds(BassPlayer.GetSongLenght(BassPlayer.Stream)).ToString();
                    TimeSlider.Maximum = BassPlayer.GetSongLenght(BassPlayer.Stream);
                    TimeSlider.Value   = BassPlayer.GetPos(BassPlayer.Stream);
                }
            }

            if (BassPlayer.EndPlayList)
            {
                butStop_Click(this, new EventArgs());
                PlayList.SelectedItem  = Vars.CurrentTrackNumber = 0;
                BassPlayer.EndPlayList = false;
            }
        }