Exemple #1
0
        public static bool checkToken()
        {
            if (tokens.HasBothTokens)
            {
                VerifyCredentialsOptions VCoption = new VerifyCredentialsOptions();
                VCoption.Proxy = proxy;

                TwitterResponse<TwitterUser> userResponse = TwitterAccount.VerifyCredentials(tokens, VCoption);
                if (userResponse.Result == RequestResult.Success)
                {
                    return true;
                }
            }
            return false;
        }
        /// <summary>
        /// Attempts to verify the supplied credentials.
        /// </summary>
        /// <param name="tokens">The tokens.</param>  
        /// <param name="options">The options.</param>
        /// <param name="timeout">The timeout.</param>
        /// <param name="function">The callback or anonymous funtion.</param>
        /// <returns>
        /// The user, as a <see cref="TwitterUser"/>
        /// </returns>       
        public static IAsyncResult VerifyCredentials(OAuthTokens tokens, VerifyCredentialsOptions options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
        {
            Func<OAuthTokens, VerifyCredentialsOptions, TwitterResponse<TwitterUser>> methodToCall = TwitterAccount.VerifyCredentials;

            return methodToCall.BeginInvoke(
                tokens,
                options,
                result =>
                {
                    result.AsyncWaitHandle.WaitOne(timeout);
                    try
                    {
                        function(methodToCall.EndInvoke(result).ToAsyncResponse());
                    }
                    catch (Exception ex)
                    {
                        function(new TwitterAsyncResponse<TwitterUser>() { Result = RequestResult.Unknown, ExceptionThrown = ex });
                    }
                },
                null);
        }
 /// <summary>
 /// Attempts to verify the supplied credentials.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The callback or anonymous funtion.</param>
 /// <returns>
 /// The user, as a <see cref="TwitterUser"/>
 /// </returns>
 public static IAsyncResult VerifyCredentials(OAuthTokens tokens, VerifyCredentialsOptions options, TimeSpan timeout, Action <TwitterAsyncResponse <TwitterUser> > function)
 {
     return(AsyncUtility.ExecuteAsyncMethod(tokens, options, timeout, TwitterAccount.VerifyCredentials, function));
 }
 /// <summary>
 /// Attempts to verify the supplied credentials.
 /// </summary>
 /// <param name="tokens">The tokens.</param>  
 /// <param name="options">The options.</param>
 /// <param name="timeout">The timeout.</param>
 /// <param name="function">The callback or anonymous funtion.</param>
 /// <returns>
 /// The user, as a <see cref="TwitterUser"/>
 /// </returns>       
 public static IAsyncResult VerifyCredentials(OAuthTokens tokens, VerifyCredentialsOptions options, TimeSpan timeout, Action<TwitterAsyncResponse<TwitterUser>> function)
 {
     return AsyncUtility.ExecuteAsyncMethod(tokens, options, timeout, TwitterAccount.VerifyCredentials, function);
 }
        /// <summary>
        /// Verifies the user's credentials.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="options">The options.</param>
        /// <returns></returns>
        public static TwitterResponse <TwitterUser> VerifyCredentials(OAuthTokens tokens, VerifyCredentialsOptions options)
        {
            Commands.VerifyCredentialsCommand command = new Commands.VerifyCredentialsCommand(tokens, options);

            return(Core.CommandPerformer.PerformAction(command));
        }
        /// <summary>
        /// Verifies the user's credentials.
        /// </summary>
        /// <param name="tokens">The tokens.</param>
        /// <param name="options">The options.</param>
        /// <returns></returns>
        public static TwitterResponse<TwitterUser> VerifyCredentials(OAuthTokens tokens, VerifyCredentialsOptions options)
        {
            Commands.VerifyCredentialsCommand command = new Commands.VerifyCredentialsCommand(tokens, options);

            return Core.CommandPerformer.PerformAction(command);
        }
 /// <summary>
 /// Verifies the user's credentials.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="options">The options. Leave null for defaults.</param>
 /// <returns></returns>
 public static async Task <TwitterResponse <User> > VerifyCredentialsAsync(OAuthTokens tokens, VerifyCredentialsOptions options = null)
 {
     return(await Core.CommandPerformer.PerformAction(new Commands.VerifyCredentialsCommand(tokens, options)));
 }
 /// <summary>
 /// Verifies the user's credentials.
 /// </summary>
 /// <param name="tokens">The tokens.</param>
 /// <param name="options">The options. Leave null for defaults.</param>
 /// <returns></returns>
 public static async Task<TwitterResponse<TwitterUser>> VerifyCredentialsAsync(OAuthTokens tokens, VerifyCredentialsOptions options = null)
 {
     return await Core.CommandPerformer.PerformAction(new Commands.VerifyCredentialsCommand(tokens, options));
 }