Exemplo n.º 1
0
        /// <summary>
        /// Authenticate the current user for use in Twitter
        /// </summary>
        /// <param name="AuthType"></param>
        /// <returns></returns>
        private async Task <bool> AuthenticateTwitterUser(int AuthType)
        {
            bool          AuthenticationStatus = false;
            TweetAuthType _selectedAuth        = Convert.ToInt32(TweetAuthType.AppAuth) == AuthType ? TweetAuthType.AppAuth : TweetAuthType.OAuth;

            oauthTwitter = new TweetOAuth(_consumerKey, _consumerSecret, _selectedAuth);

            try
            {
                if (oauthTwitter.AuthenticationType == TweetAuthType.AppAuth)
                {
                    await oauthTwitter.AuthenticateTwitterbyAppAuth();
                }
                else
                {
                    await oauthTwitter.AuthenticateTwitterByOAuth();
                }
                //else await oauthTwitter.AuthenticateTwitterByOAuth();
                AuthenticationStatus = true;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }

            return(AuthenticationStatus);
        }
Exemplo n.º 2
0
 public TweetAPICall()
 {
     _tweetAuthObj = new TweetOAuth();
     _tweetReturn  = new ObservableCollection <Tweet>();
 }