当前位置: 首页>>代码示例>>C#>>正文


C# TwitterService.SendTweet方法代码示例

本文整理汇总了C#中TweetSharp.TwitterService.SendTweet方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterService.SendTweet方法的具体用法?C# TwitterService.SendTweet怎么用?C# TwitterService.SendTweet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TweetSharp.TwitterService的用法示例。


在下文中一共展示了TwitterService.SendTweet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendTextMessage

        private static List<TwitterStatus> SendTextMessage(TwitterService service, MessageEntity message)
        {
            List<TwitterStatus> statuses = new List<TwitterStatus>();

            String hashTag = String.Format("{0}{1}", "#LiveSkypeChat", Environment.NewLine); //TODO: module - defining current top hashtag

            List<string> splittedTwitterMessage = SplitMessage(message.TwitterMessage, hashTag);

            int messgaeIndex = 0;

            foreach (string messagePart in splittedTwitterMessage)
            {
                String twitterMessage = String.Empty;
                messgaeIndex++;

                if (splittedTwitterMessage.Count > 1)
                {
                    String counter = String.Format("{0}/{1}{2}", messgaeIndex, splittedTwitterMessage.Count, Environment.NewLine);
                    twitterMessage = String.Format("{0}{1}{2}: {3}", hashTag, counter, message.TwitterNick, messagePart);
                }
                else
                {
                    twitterMessage = String.Format("{0}{1}: {2}", hashTag, message.TwitterNick, messagePart);
                }

                TwitterStatus status = service.SendTweet(new SendTweetOptions { Status = twitterMessage });
                statuses.Add(status);
            }

            return statuses;
        }
开发者ID:skpSlave,项目名称:skpSlaveBot,代码行数:31,代码来源:TwitterTools.cs

示例2: ApplicationBarIconButton_Click

        private void ApplicationBarIconButton_Click(object sender, EventArgs e)
        {
            if (img_bool == true && twit_pic == "")
            {
                MessageBox.Show("Image upload in progress. please wait.", "Sorry", MessageBoxButton.OK);
                return;
            }

            if (WatermarkTB.Text == emptystr)
            {
                MessageBox.Show("Please input your mind :)", "Sorry", MessageBoxButton.OK);
                return;
            }

            TwitterService service = new TwitterService("g8F2KdKH40gGp9BXemw13Q", "OyFRFsI05agcJtURtLv8lpYbYRwZAIL5gr5xQNPW0Q");
            service.AuthenticateWith((string)settings["twitter_token"], (string)settings["twitter_tokensecret"]);
            string tweet = WatermarkTB.Text;
            if (img_bool == true)
                tweet += " " + twit_pic;

            service.SendTweet(tweet,
                (tweets, response) =>
                {

                });
            MessageBox.Show("Share successfully.", "Thanks", MessageBoxButton.OK);
            this.NavigationService.GoBack();
        }
开发者ID:vapps,项目名称:HDStream,代码行数:28,代码来源:TwitterWrite.xaml.cs

示例3: CanUpdateStatus

        public void CanUpdateStatus()
        {
            var service = new TwitterService(consumerKey, consumerSecret);
            service.AuthenticateWith(accessToken, accessTokenSecret);

            var tweet = service.SendTweet("@SocSnapTest " + DateTime.Now.ToLongTimeString() + " @SocSnapTest");
            Console.WriteLine(tweet.Text);
        }
开发者ID:mikehadlow,项目名称:socsnap,代码行数:8,代码来源:TweetSharpSpike.cs

示例4: NotifyUserOnTwitter

        private void NotifyUserOnTwitter(ChatMessage message, User user, TwitterUser u)
        {
            TweetSharp.TwitterService svc = new TwitterService(GetClientInfo());
            svc.AuthenticateWith(ConfigurationManager.AppSettings["User.Token"],
                ConfigurationManager.AppSettings["User.TokenSecret"]);
            svc.SendTweet(String.Format(_tweetFormat,
                u.ScreenName,
                String.IsNullOrEmpty(user.TwitterUserName) ? user.JabbrUserName : user.TwitterUserName, message.Room));

        }
开发者ID:sethwebster,项目名称:Jabbot.TwitterNotifierSprocket,代码行数:10,代码来源:TwitterNotifierSprocket.cs

示例5: SendTweet

        public TwitterStatus SendTweet(string message)
        {
            TwitterService service = new TwitterService(ConsumerKey, ConsumerSecret);
            service.AuthenticateWith(Token, Secret);

            return service.SendTweet(new SendTweetOptions()
                {
                    Status = message
                });
            //return null;
        }
开发者ID:sreverdy,项目名称:JobPF,代码行数:11,代码来源:TweetManager.cs

示例6: Tweet

        public static void Tweet(string message)
        {
            string consumerKey = ConfigurationManager.AppSettings["twiiterConsumerKey"];
            string consumerSecret = ConfigurationManager.AppSettings["twitterConsumerSecret"];
            string accessToken = ConfigurationManager.AppSettings["twitterAccessToken"];
            string accessTokenSecret = ConfigurationManager.AppSettings["twitterAccessTokenSecret"];

            var service = new TwitterService(consumerKey, consumerSecret);
            service.AuthenticateWith(accessToken, accessTokenSecret);
            service.SendTweet(new SendTweetOptions { Status = message});
        }
开发者ID:richard-kong,项目名称:sabnzbd-kdrama-processing,代码行数:11,代码来源:Program.cs

示例7: SendTweet

        public static void SendTweet(   string sMessage, 
                                        string consumerKey, 
                                        string consumerSecret, 
                                        string token, 
                                        string tokenSecret)
        {
            TwitterService service = new TwitterService(consumerKey, consumerSecret);
            service.AuthenticateWith(token, tokenSecret);

            TwitterStatus status = service.SendTweet(sMessage);
        }
开发者ID:alpascual,项目名称:Unfollower,代码行数:11,代码来源:TwitterUtils.cs

示例8: SendTweet

 public static bool SendTweet(TwitterService service, string status, long inReplyToStatusId)
 {
     var sendoptions = new SendTweetOptions ();
     sendoptions.Status = status;
     sendoptions.InReplyToStatusId = inReplyToStatusId;
     var response = service.SendTweet (sendoptions);
     if (response == null) {
         Console.WriteLine ("ERROR SENDING TWEET! Possible duplicate!");
         return false;
     }
     return true;
 }
开发者ID:MadeInSpengergasse,项目名称:ReplyBot,代码行数:12,代码来源:TwitterHelper.cs

示例9: SendTweet

        public void SendTweet(string message)
        {
            if (string.IsNullOrEmpty(message))
                throw new ArgumentNullException("message");

            if (message.Length > TweetLength)
                throw new ArgumentException("Message is too long. MaxLength is 120", "message");

            var service = new TwitterService(ConsumerKey, ConsumerSecret);
            service.AuthenticateWith(AccessToken, AccessTokenSecret);
            service.SendTweet(new SendTweetOptions {
                Status = message
            });
        }
开发者ID:geekhubdk,项目名称:geekhub,代码行数:14,代码来源:LiveTwitterAdapter.cs

示例10: TryPerformTwitterPost

        /// <summary>
        /// Workerthread: Performs the TwitterFeed Post
        /// </summary>
        /// <param name="BasicProgramData"></param>
        void TryPerformTwitterPost()
        {
            if (CalibrationSettings.Default.EnableTwitterFeed == true)
            {
                string _consumerKey = ConfigurationManager.AppSettings["ConsumerKey"];
                string _consumerSecret = ConfigurationManager.AppSettings["ConsumerSecret"];
                string _accessToken = ConfigurationManager.AppSettings["AccessToken"];
                string _accessTokenSecret = ConfigurationManager.AppSettings["AccessTokenSecret"];

                var service = new TwitterService(_consumerKey, _consumerSecret);
                service.AuthenticateWith(_accessToken, _accessTokenSecret);
                TwitterStatus status = service.SendTweet(twitterMessage);
            }
        }
开发者ID:antonesterhuyse,项目名称:GrucoxScrumView,代码行数:18,代码来源:DataComms.cs

示例11: SendTweet

        protected void SendTweet(object tweetMessage)
        {

            var tweet = (string)tweetMessage;
            try
            {
                var twitterApp = new TwitterService(settings.ConsumerKey, settings.ConsumerSecret);
                twitterApp.AuthenticateWith(settings.Token, settings.TokenSecret);
                twitterApp.SendTweet(new SendTweetOptions {Status = tweet});
                logger.Trace("'{0}' was tweeted",tweet);
            }
            catch (Exception ex)
            {
                logger.Warn("The tweet '{0}' failed with the exception: {1}", tweet,ex.Message);
            }
        }
开发者ID:Jc54,项目名称:PlayMe,代码行数:16,代码来源:TwitterBroadcaster.cs

示例12: UnsafeExecute

 private void UnsafeExecute()
 {
     PendingCalls = 0;
     foreach (var user in Task.Accounts)
     {
     #if BACKGROUND_AGENT
         ITwitterService service = new TwitterService(SensitiveData.ConsumerToken, SensitiveData.ConsumerSecret,
             user.Key, user.Secret);
     #else
         ITwitterService service = ServiceDispatcher.GetService(user);
     #endif
         service.SendTweet(Task.Text, Task.InReplyTo, ReceiveResponse);
         PendingCalls++;
     }
     if (PendingCalls == 0 && Completed != null)
         Completed(this, new EventArgs());
 }
开发者ID:Quertz,项目名称:Ocell,代码行数:17,代码来源:TaskExecutor.cs

示例13: PostMessage

        public ActionResult PostMessage(string code, string oauth_token, string oauth_verifier)
        {
            if (string.IsNullOrEmpty(code))
            {
                var requestToken = new OAuthRequestToken {Token = oauth_token};
                var service = new TwitterService(ConfigurationManager.AppSettings["TwitterConsumerKey"],
                                                 ConfigurationManager.AppSettings["TwitterConsumerSecret"]);

                OAuthAccessToken accessToken = service.GetAccessToken(requestToken, oauth_verifier);

                service.AuthenticateWith(accessToken.Token, accessToken.TokenSecret);
                service.SendTweet(string.Format("{0} {1}{2}", CurrentPost.Message,
                                                ConfigurationManager.AppSettings["SiteUrl"], CurrentPost.Link));
            }
            else
            {
                var tokens = new Dictionary<string, string>();

                string url = string.Format("https://graph.facebook.com/oauth/access_token?client_id={0}&redirect_uri={1}&scope={2}&code={3}&client_secret={4}",
                    ConfigurationManager.AppSettings["FbAppId"], Request.Url.AbsoluteUri,
                    ConfigurationManager.AppSettings["FbScope"],
                    code,
                    ConfigurationManager.AppSettings["FbAppSecret"]);

                var request = WebRequest.Create(url) as HttpWebRequest;

                using (var response = request.GetResponse() as HttpWebResponse)
                {
                    var reader = new StreamReader(response.GetResponseStream());

                    string vals = reader.ReadToEnd();

                    foreach (string token in vals.Split('&'))
                    {
                        tokens.Add(token.Substring(0, token.IndexOf("=")),
                            token.Substring(token.IndexOf("=") + 1, token.Length - token.IndexOf("=") - 1));
                    }
                }

                var client = new FacebookClient(tokens.FirstOrDefault().Value);

                client.Post("/me/feed", new { message = string.Format("{0} {1}{2}", CurrentPost.Message, ConfigurationManager.AppSettings["SiteUrl"], CurrentPost.Link) });

            }
            return RedirectToAction("Index", "Home");
        }
开发者ID:Vnuuk,项目名称:VStagram,代码行数:46,代码来源:SocialController.cs

示例14: Execute

        public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull((object) context, "context");
            if (context.Items.Length != 1)
                return;
            Item item = context.Items[0];

            var scService = new SitecoreService(item.Database);
            var settings = scService.GetItem<TwitterSettings>(SettingsPath);

            TwitterService twitterService = new TwitterService(settings.ConsumerKey, settings.ConsumerSecret);
            twitterService.AuthenticateWith(settings.AccessToken, settings.AccessTokenSecret);

            TwitterUser user = twitterService.VerifyCredentials(new VerifyCredentialsOptions());

            var tweet = scService.CreateType<SendTweetOptions>(item);
            twitterService.SendTweet(tweet);
        }
开发者ID:simonproctor,项目名称:VirtualSummit,代码行数:18,代码来源:TweetCommand.cs

示例15: Tweet

        public static void Tweet(this Beer beer, string message)
        {
            if (message.Length > 140)
                throw new ArgumentOutOfRangeException("Tweet must have at maximum 140 characters.");

            TwitterService tw = new TwitterService(
                ConfigurationManager.AppSettings["TwitterConsumerKey"],
                ConfigurationManager.AppSettings["TwitterConsumerSecret"]);

            var requestToken = tw.GetRequestToken();

            //tw.AuthenticateWith(requestToken.Token, requestToken.TokenSecret);

            tw.AuthenticateWith(
                ConfigurationManager.AppSettings["TwitterToken"],
                ConfigurationManager.AppSettings["TwitterTokenSecret"]);

            TwitterStatus ts = tw.SendTweet(message);
        }
开发者ID:bernardobrezende,项目名称:IntroDotNetCSharp,代码行数:19,代码来源:BeerExtensions.cs


注:本文中的TweetSharp.TwitterService.SendTweet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。