Example #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 buttonLogoutVk_Click(object sender, EventArgs e)
        {
            WebBrowser webBrowser1 = new WebBrowser();

            webBrowser1.Navigate("m.vk.com");
            Thread.Sleep(1000);
            webBrowser1.Navigate("https://login.vk.com/?act=logout_mobile&hash=4640faef262489f22b&_origin=https%3A%2F%2Fm.vk.com");
            buttonListVk.Visible      = false;
            buttonFavoritesVk.Visible = false;
            buttonLoginVk.Visible     = true;
            buttonLogoutVk.Visible    = false;
            buttonSearchVK.Visible    = false;
            vkCom.Text     = "VK.COM";
            vkCom.Font     = new Font("Phenomena", 16.25F);
            vkCom.Location = new Point(46, 133);

            soundCloud.Location             = new Point(46, 224);
            imageSoundCloud.Location        = new Point(4, 226);
            buttonSearchSoundCloud.Location = new Point(0, 271);

            VkAuthLog.SetAuth(false);
            VkAuthLog.SetId("");
            VkAuthLog.SetToken("");
            VkAuthLog.SetSave(false);
        }