예제 #1
0
        private void timer1_Tick(object sender, EventArgs e)
        {
            label1.Text  = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
            slTime.Value = BassLike.GetPosOfStream(BassLike.Stream);

            if (BassLike.AutoNextTrack())
            {
                playlist.SelectedIndex = Vars.CurrentTrackNumber;
                label1.Text            = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
                label2.Text            = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString("mm':'ss");
                TagModel TM = new TagModel(Vars.Files[Vars.CurrentTrackNumber]);
                label3.Text    = (TM.Artist + " - " + TM.Title + "   ");
                slTime.Maximum = BassLike.GetTimeOfStream(BassLike.Stream);
                slTime.Value   = BassLike.GetPosOfStream(BassLike.Stream);
            }


            if (BassLike.EndPlayList)
            {
                btnStop_Click(this, new EventArgs());
                playlist.SelectedIndex = Vars.CurrentTrackNumber = 0;
                BassLike.EndPlayList   = false;
                label2.Text            = "00:00";
                label3.Text            = "";
            }


            if (label3.Text != "")
            {
                string symb;
                string tmp = label3.Text;
                symb        = tmp.Substring(0, 1);
                label3.Text = (tmp.Remove(0, 1) + symb);
            }
        }
예제 #2
0
 private void btnPlay_Click(object sender, EventArgs e)
 {
     if ((playlist.Items.Count != 0) && (playlist.SelectedIndex != -1))
     {
         if (!Vars.play)
         {
             string current = Vars.Files[playlist.SelectedIndex];
             Vars.CurrentTrackNumber = playlist.SelectedIndex;
             BassLike.Play(current, BassLike.Volume);
             label1.Text = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
             label2.Text = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString("mm':'ss");
             if ((Vars.startedNew))
             {
                 TagModel TM = new TagModel(current);
                 label3.Text = (TM.Artist + " - " + TM.Title + "   ");
             }
             Vars.startedNew         = false;
             slTime.Maximum          = BassLike.GetTimeOfStream(BassLike.Stream);
             slTime.Value            = BassLike.GetPosOfStream(BassLike.Stream);
             timer1.Enabled          = true;
             btnPlay.BackgroundImage = Properties.Resources.player_pause_5536;
             Vars.play = true;
         }
         else
         {
             BassLike.Pause();
             Vars.play = false;
             btnPlay.BackgroundImage = Properties.Resources.player_play_1976;
         }
     }
 }
예제 #3
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            if (Vars.mixed)
            {
                BassLike.Stop();
                playlist.SelectedIndex = Vars.CurrentTrackNumber = 0;
                BassLike.Play(Vars.Files[0], BassLike.Volume);
                btnPlay.BackgroundImage = Properties.Resources.player_pause_5536;
                Vars.play      = true;
                timer1.Enabled = true;
                label1.Text    = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
                label2.Text    = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString("mm':'ss");
                TagModel TM = new TagModel(Vars.Files[Vars.CurrentTrackNumber]);
                label3.Text = (TM.Artist + " - " + TM.Title + "   ");
                Vars.mixed  = false;
            }
            else
            {
                BassLike.Stop();
                btnPlay.BackgroundImage = Properties.Resources.player_pause_5536;
                Vars.play      = true;
                timer1.Enabled = true;
                if (BassLike.ToNextTrack())
                {
                    playlist.SelectedIndex = Vars.CurrentTrackNumber;
                    label1.Text            = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
                    label2.Text            = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString("mm':'ss");
                    TagModel TM = new TagModel(Vars.Files[Vars.CurrentTrackNumber]);
                    label3.Text    = (TM.Artist + " - " + TM.Title + "   ");
                    slTime.Maximum = BassLike.GetTimeOfStream(BassLike.Stream);
                    slTime.Value   = BassLike.GetPosOfStream(BassLike.Stream);
                }

                if (BassLike.EndPlayList)
                {
                    btnStop_Click(this, new EventArgs());
                    if (playlist.Items.Count != 0)
                    {
                        playlist.SelectedIndex = Vars.CurrentTrackNumber = 0;
                    }
                    BassLike.EndPlayList = false;
                    label2.Text          = "00:00";
                    label3.Text          = "";
                }
            }
            Vars.startedNew = false;
        }
 //таймер
 private void timer1_Tick(object sender, EventArgs e)
 {
     label1.Text  = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString();
     slTime.Value = BassLike.GetPosOfStream(BassLike.Stream);
     if (mode == 2)
     {
         if (BassLike.AutoPlay())
         {
             playlist.SelectedIndex = Vars.trackNum;
             label1.Text            = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString();
             label2.Text            = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString();
             slTime.Maximum         = BassLike.GetTimeOfStream(BassLike.Stream);
             slTime.Value           = BassLike.GetPosOfStream(BassLike.Stream);
         }
         if (BassLike.EndPlaylist)
         {
             button2_Click(this, new EventArgs());
             playlist.SelectedIndex = Vars.trackNum = 0;
             BassLike.EndPlaylist   = false;
         }
     }
     if (mode == 1)
     {
         if (BassLike.RandPlay())
         {
             playlist.SelectedIndex = Vars.trackNum;
             label1.Text            = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString();
             label2.Text            = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString();
             slTime.Maximum         = BassLike.GetTimeOfStream(BassLike.Stream);
             slTime.Value           = BassLike.GetPosOfStream(BassLike.Stream);
         }
     }
     if (mode == 3)
     {
         if (BassLike.Repeat())
         {
             playlist.SelectedIndex = Vars.trackNum;
             label1.Text            = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString();
             label2.Text            = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString();
             slTime.Maximum         = BassLike.GetTimeOfStream(BassLike.Stream);
             slTime.Value           = BassLike.GetPosOfStream(BassLike.Stream);
         }
     }
 }
예제 #5
0
 private void btnPrev_Click(object sender, EventArgs e)
 {
     if ((Vars.CurrentTrackNumber > 0) && (!Vars.mixed) && (playlist.Items.Count > 0))
     {
         BassLike.Stop();
         btnPlay.BackgroundImage = Properties.Resources.player_pause_5536;
         Vars.play      = true;
         timer1.Enabled = true;
         BassLike.ToPrevTrack();
         playlist.SelectedIndex = Vars.CurrentTrackNumber;
         label1.Text            = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
         label2.Text            = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString("mm':'ss");
         TagModel TM = new TagModel(Vars.Files[Vars.CurrentTrackNumber]);
         label3.Text     = (TM.Artist + " - " + TM.Title + "   ");
         slTime.Maximum  = BassLike.GetTimeOfStream(BassLike.Stream);
         slTime.Value    = BassLike.GetPosOfStream(BassLike.Stream);
         Vars.startedNew = false;
     }
 }
예제 #6
0
 private void playlist_DoubleClick(object sender, EventArgs e)
 {
     if (playlist.Items.Count > 0)
     {
         BassLike.Stop();
         string current = Vars.Files[playlist.SelectedIndex];
         Vars.CurrentTrackNumber = playlist.SelectedIndex;
         BassLike.Play(current, BassLike.Volume);
         label1.Text = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString("mm':'ss");
         label2.Text = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString("mm':'ss");
         TagModel TM = new TagModel(current);
         label3.Text             = (TM.Artist + " - " + TM.Title + "   ");
         slTime.Maximum          = BassLike.GetTimeOfStream(BassLike.Stream);
         slTime.Value            = BassLike.GetPosOfStream(BassLike.Stream);
         timer1.Enabled          = true;
         btnPlay.BackgroundImage = Properties.Resources.player_pause_5536;
         Vars.play  = true;
         Vars.mixed = false;
     }
 }
 //воспроизведение трека
 private void btnPlay_Click(object sender, EventArgs e)
 {
     //если в плейлисте есть файлы и если трек выделен
     if ((playlist.Items.Count != 0) && (playlist.SelectedIndex != -1))
     {
         //создаем переменную текущего трека, записываем туда путь к треку
         string current = Vars.Files[playlist.SelectedIndex];
         Vars.trackNum = playlist.SelectedIndex;
         //воспроизводим трек (громкость указанная по умолчанию - 100)
         BassLike.Play(current, BassLike.Volume);
         //получаем позицию и время трека с помощью методов класса BassLike
         //переводим их в формат hh:mm:ss с помощью timespan
         label1.Text = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString();
         label2.Text = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString();
         //максимальному значению слайдера воспроизведения присваиваем длительность трека
         slTime.Maximum = BassLike.GetTimeOfStream(BassLike.Stream);
         //текущее положение слайдера определяется этим методом
         slTime.Value = BassLike.GetPosOfStream(BassLike.Stream);
         //включаем таймер
         timer1.Enabled = true;
     }
 }
        //переход к следующему треку
        private void btnNext_Click(object sender, EventArgs e)
        {
            string current;

            if (playlist.Items.Count != 0 && playlist.SelectedIndex < Vars.Files.Count - 1)
            {
                current = Vars.Files[playlist.SelectedIndex + 1];
                playlist.SelectedIndex = playlist.SelectedIndex + 1;
                Vars.trackNum          = playlist.SelectedIndex;
            }
            else
            {
                current = Vars.Files[0];
                playlist.SelectedIndex = Vars.trackNum = 0;
            }
            BassLike.Play(current, BassLike.Volume);
            label1.Text    = TimeSpan.FromSeconds(BassLike.GetPosOfStream(BassLike.Stream)).ToString();
            label2.Text    = TimeSpan.FromSeconds(BassLike.GetTimeOfStream(BassLike.Stream)).ToString();
            slTime.Maximum = BassLike.GetTimeOfStream(BassLike.Stream);
            slTime.Value   = BassLike.GetPosOfStream(BassLike.Stream);
            timer1.Enabled = true;
        }