private void ButtonStop_Click(object sender, EventArgs e)
 {
     BassClass.Stop();
     timer1.Enabled       = false;
     streamTrackBar.Value = 0;
     label1.Text          = "00:00:00";
 }
 private void ButtonPlay_Click(object sender, EventArgs e)
 {
     BassClass.Volume = 100;
     if (playlist.Items.Count != 0 && playlist.SelectedIndex != -1)
     {
         string current;
         TrackBase.CurrentTrackNumber = playlist.SelectedIndex;
         int index = playlist.SelectedIndex;
         if (VkAudioClass.ListOpened)
         {
             current = VkAudioClass.MyTracklist[index].url;
             BassClass.PlayURL(current, BassClass.Volume);
         }
         else if (SoundCloud.ListOpened)
         {
             current = (SoundCloud.MyTracklist[index].stream_url + "?client_id=" + SoundCloud.clientID);
             BassClass.PlayURL(current, BassClass.Volume);
         }
         else
         {
             current = TrackBase.Files[index];
             BassClass.Play(current, BassClass.Volume);
         }
         label1.Text            = TimeSpan.FromSeconds(BassClass.GetPosOfStream(BassClass.Stream)).ToString();
         label2.Text            = TimeSpan.FromSeconds(BassClass.GetTimeOfStream(BassClass.Stream)).ToString();
         streamTrackBar.Maximum = BassClass.GetTimeOfStream(BassClass.Stream);
         streamTrackBar.Value   = BassClass.GetPosOfStream(BassClass.Stream);
         timer1.Enabled         = true;
     }
 }
        private void timer1_Tick(object sender, EventArgs e)
        {
            label1.Text          = TimeSpan.FromSeconds(BassClass.GetPosOfStream(BassClass.Stream)).ToString();
            streamTrackBar.Value = BassClass.GetPosOfStream(BassClass.Stream);

            if (BassClass.ToNextTrack())
            {
                playlist.SelectedIndex = TrackBase.CurrentTrackNumber;
                label1.Text            = TimeSpan.FromSeconds(BassClass.GetPosOfStream(BassClass.Stream)).ToString();
                label2.Text            = TimeSpan.FromSeconds(BassClass.GetTimeOfStream(BassClass.Stream)).ToString();
                streamTrackBar.Maximum = BassClass.GetTimeOfStream(BassClass.Stream);
                streamTrackBar.Value   = BassClass.GetPosOfStream(BassClass.Stream);
            }

            if (BassClass.EndPlayList)
            {
                ButtonStop_Click(this, new EventArgs());
                playlist.SelectedIndex = TrackBase.CurrentTrackNumber = 0;
                BassClass.EndPlayList  = false;
            }
        }
 private void streamTrackBar_Scroll(object sender, ScrollEventArgs e)
 {
     BassClass.SetPosOfScroll(BassClass.Stream, streamTrackBar.Value);
 }
 private void volumeTrackBar_ValueChanged(object sender, EventArgs e)
 {
     BassClass.SetVolumeToStream(BassClass.Stream, volumeTrackBar.Value);
 }
 private void ButtonPause_Click(object sender, EventArgs e)
 {
     TrackBase.CurrentTrackNumber = playlist.SelectedIndex;
     BassClass.Pause();
 }
        public MainPageOfPlayer()
        {
            InitializeComponent();

            if (!InternetChecker.ConnectionAvailable("https://www.google.by/"))
            {
                ErrorForm erForm = new ErrorForm("Отсутствует соединение с интернетом. Часть функционала программы недоступна. Попробуйте позже.");
                erForm.ShowDialog();
                buttonVK.Visible               = false;
                vkCom.Visible                  = false;
                buttonLoginVk.Visible          = false;
                imageSoundCloud.Visible        = false;
                soundCloud.Visible             = false;
                buttonSearchSoundCloud.Visible = false;
            }

            if (Settings.Default.red == 0 && Settings.Default.green == 0 && Settings.Default.blue == 0)
            {
                CustomColor.maincolor = CustomColor.defaultcolor;
            }
            else
            {
                CustomColor.maincolor = Color.FromArgb(Settings.Default.red, Settings.Default.green, Settings.Default.blue);
            }

            BassClass.InitBass(BassClass.HZ);
            openFileDialog1.Filter            = TrackBase.GetInputFormats();
            ButtonAdd.Image                   = CustomColor.FillShape(Properties.Resources.add);
            buttonDelete.Image                = CustomColor.FillShape(Properties.Resources.delete);
            ButtonPlay.Image                  = CustomColor.FillShape(Properties.Resources.Circled_Play_100px);
            ButtonStop.Image                  = CustomColor.FillShape(Properties.Resources.stop1);
            ButtonPause.Image                 = CustomColor.FillShape(Properties.Resources.pause1);
            ButtonSkipLeft.Image              = CustomColor.FillShape(Properties.Resources.SkipLeft);
            ButtonSkipRight.Image             = CustomColor.FillShape(Properties.Resources.SkipRight);
            ButtonSettings.Image              = CustomColor.FillShape(Properties.Resources.settings);
            ButtonSettings.Image              = CustomColor.FillShape(Properties.Resources.settings);
            buttonVK.Image                    = CustomColor.ColoredObject(Properties.Resources.VK_com_100px, Color.FromArgb(80, 114, 153));
            buttonLogoutVk.Image              = CustomColor.ColoredObject(Properties.Resources.logout, Color.FromArgb(80, 114, 153));
            buttonMute.Image                  = CustomColor.FillShape(Properties.Resources.yes_audio);
            streamTrackBar.UseCustomBackColor = true;
            streamTrackBar.UseCustomForeColor = true;
            streamTrackBar.ForeColor          = CustomColor.defaultcolor;

            playlist.Size               = new Size(1088, 609);
            playlist.Location           = new Point(52, 47);
            searchTextBox.Visible       = false;
            buttonSearchStartVK.Visible = false;
            buttonDelete.Visible        = true;
            buttonDownload.Visible      = false;

            soundCloud.Location             = new Point(46, 224);
            imageSoundCloud.Location        = new Point(4, 226);
            buttonSearchSoundCloud.Location = new Point(0, 271);
            if (!VkAuthLog.GetAuth())
            {
                buttonLogoutVk.Visible = false;
            }

            vkCom.Font     = new Font("Phenomena", 16.25F);
            vkCom.Location = new Point(46, 133);

            buttonDownload.Image = CustomColor.FillShape(Properties.Resources.Download);

            if (Settings.Default.path == "" || Settings.Default.path == null)
            {
                Settings.Default.path = TrackBase.AppPath;
            }
        }