Exemple #1
0
        public override void Auth()
        {
            SetCredentials();
            bool isLoggedIn;

            try
            {
                Vk.Authorize(new ApiAuthParams
                {
                    ApplicationId = 6634517,
                    Login         = _login,
                    Password      = _password,
                    Settings      = SettingFilters
                });
                isLoggedIn = Vk.IsAuthorized;
            }
            catch (VkApiAuthorizationException)
            {
                isLoggedIn = false;
                Console.WriteLine("Authorization failed: Incorrect credentials");
                SetCredentials();
            }
            catch (VkApiException ex)
            {
                isLoggedIn = false;
                Console.WriteLine(ex.Message + "\n");
                SetCredentials();
            }
            if (isLoggedIn)
            {
                Console.Clear();
                Console.Write("Вход выполнен успешно!");
            }
        }
Exemple #2
0
 public override void Auth(string token, int expireTime, long userId)
 {
     Vk.Authorize(new ApiAuthParams
     {
         AccessToken     = token,
         TokenExpireTime = expireTime,
         UserId          = userId
     });
 }
 private void Click_Authorize(object sender, MouseButtonEventArgs e)
 {
     try
     {
         vk = vk.Authorize("wall,photos,groups,offline,messages");
         if (vk.isAuthorized)
         {
             this.AuthStatus.Text = "Статус: Авторизация пройдена";
         }
     }
     catch (Exception exc)
     {
         MessageBox.Show(exc.ToString());
     }
 }