/// <summary>
        /// This Method Will Check That User Is Authenticatde Or Not
        /// </summary>
        /// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        /// <returns>Return True If User Is Authenticated</returns>
        public bool Verify_Credentials(oAuthTwitter oAuth)
        {
            Twitter.Core.AccountMethods.Account account = new Twitter.Core.AccountMethods.Account();
            xmlResult = account.Verify_Credentials(oAuth);
            XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("user");

            foreach (XmlNode xmlNode in xmlNodeList)
            {
                //XmlElement idElement = (XmlElement)xmlNode;
                //twitterUser.UserID = idElement.GetElementsByTagName("id")[0].InnerText;
                return(true);
            }
            return(false);
        }
        /// <summary>
        /// This Method Will Check That User Is Authenticatde Or Not
        /// </summary>
        /// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        /// <returns>Return True If User Is Authenticated</returns>
        public string GetOAuthScreenName(oAuthTwitter oAuth)
        {
            string ScreenName = string.Empty;

            Twitter.Core.AccountMethods.Account account = new Twitter.Core.AccountMethods.Account();
            xmlResult = account.Verify_Credentials(oAuth);
            XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("user");

            foreach (XmlNode xmlNode in xmlNodeList)
            {
                XmlElement idElement = (XmlElement)xmlNode;
                ScreenName = idElement.GetElementsByTagName("screen_name")[0].InnerText;
                return(ScreenName);
            }
            return(ScreenName);
        }
Exemplo n.º 3
0
        /// <summary>
        /// This Method Will Check That User Is Authenticatde Or Not
        /// </summary>
        /// <param name="oAuth">OAuth Keys Token, TokenSecret, ConsumerKey, ConsumerSecret</param>
        /// <returns>Return True If User Is Authenticated</returns>
        public string GetOAuthScreenName(oAuthTwitter oAuth)
        {
            SortedDictionary <string, string> strdic = new SortedDictionary <string, string>();
            string ScreenName = string.Empty;

            Twitter.Core.AccountMethods.Account account = new Twitter.Core.AccountMethods.Account();
            JArray obj = account.Verify_Credentials(oAuth);

            // xmlResult = account.Verify_Credentials(oAuth);
            // XmlNodeList xmlNodeList = xmlResult.GetElementsByTagName("user");
            foreach (var item in obj)
            {
                ScreenName = item["screen_name"].ToString();
            }
            return(ScreenName);
        }