Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            var    vk    = new VkApi();
            int    appID = 4829177;                                                  // ID приложения
            string email = "*****@*****.**";                                    // email или телефон
            string pass  = "******";                                               // пароль для авторизации

            VkNet.Enums.Filters.Settings scope = VkNet.Enums.Filters.Settings.Audio; // Права доступа приложения
        }
Exemple #2
0
        public static void login()
        {
            ulong  appId    = 6236745;
            string email    = "79166054162";
            string password = "******";

            VkNet.Enums.Filters.Settings settings = VkNet.Enums.Filters.Settings.All;
            api = new VkNet.VkApi();
            api.Authorize(new VkNet.ApiAuthParams
            {
                ApplicationId = appId,
                Login         = email,
                Password      = password,
                Settings      = settings
            });
        }
Exemple #3
0
        private void authorizationToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AuthorizationForm AuthForm = new AuthorizationForm();

            AuthForm.ShowDialog();
            if (AuthForm.ShowDialog() == DialogResult.OK)
            {
                Email = AuthForm.Email;
                Pass  = AuthForm.Pass;
            }

            VkNet.Enums.Filters.Settings scope = VkNet.Enums.Filters.Settings.All;      // Приложение имеет доступ к друзьям
            var vkApi = new VkApi();

            var user = new ApiAuthParams()
            {
                ApplicationId = (ulong)appID,
                Login         = Email,
                Password      = Pass,
                Settings      = scope
            };

            try
            {
                vkApi.Authorize(user);
                tsStatusInfo.Text = "Connected";
                InitializeMenu(true);
            }
            catch (CaptchaNeededException ex)
            {
                CaptchaForm captchForm = new CaptchaForm(ex.Img.AbsoluteUri);
                captchForm.Text = "Capthca error";
                if (DialogResult.OK == captchForm.ShowDialog())
                {
                    user.CaptchaKey = captchForm.UserInfo.CaptchaKey;
                    user.CaptchaSid = ex.Sid;
                    vkApi.Authorize(user);

                    tsStatusInfo.Text = "Подключено...";
                    //InitializeMenu(true);
                }
            }
        }