Beispiel #1
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            try
            {
                webBrowser1.Document.GetElementById("email").SetAttribute("value", textBoxLogin.text);
                webBrowser1.Document.GetElementById("pass").SetAttribute("value", textBoxPassword.text);
                webBrowser1.Document.GetElementById("install_allow").InvokeMember("click");

                if (bunifuCheckbox1.Checked)
                {
                    VkAuthLog.SetSave(true);
                }

                Thread.Sleep(2000);
                if (!VkAuthLog.GetAuth())
                {
                    webBrowser1.Visible = true;
                }
            }
            catch (NullReferenceException)
            {
                if (webBrowser1.Url.ToString().Contains("oauth.vk.com/error?err=2"))
                {
                    buttonLogout_Click(this, new EventArgs());
                }
                webBrowser1.Visible = false;
            }
            catch
            {
                ErrorForm erForm = new ErrorForm("Ошибка авторизации, попробуйте позже");
                buttonLogout_Click(this, new EventArgs());
            }
        }
 private void MainPageOfPlayer_FormClosed(object sender, FormClosedEventArgs e)
 {
     Settings.Default.red   = CustomColor.maincolor.R;
     Settings.Default.green = CustomColor.maincolor.G;
     Settings.Default.blue  = CustomColor.maincolor.B;
     Settings.Default.Save();
     if (!VkAuthLog.GetSave() && VkAuthLog.GetAuth())
     {
         buttonLogoutVk_Click(this, new EventArgs());
     }
     else
     {
         VkAuthLog.Save();
     }
 }
        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;
            }
        }