public static TwitterItem replyToItem(AccountTwitter account, decimal inReplyToId, string text, string upload_image_path = null) { try { SendTweetOptions options = new TweetSharp.SendTweetOptions(); options.Status = text; options.InReplyToStatusId = Convert.ToInt64(inReplyToId); TwitterStatus status = account.twitterService.SendTweet(options); if (status != null) { return(API.TweetSharpConverter.getItemFromStatus(status, account)); } else { System.Windows.MessageBox.Show("Failed", "Sending of tweet failed"); return(null); } } catch (Exception exp) { System.Windows.MessageBox.Show(exp.Message, "Sending of tweet failed"); return(null); } }
public TwitterFactory SendMessage(string message) { var options = new SendTweetOptions(); options.Status = ScoresMessage + message; Status = Service.SendTweet(options); return this; }
public void ShareOnTwitter(LeaderboardInfo leaderboardInfo) { if (!_authenticated) return; var tweetOptions = new SendTweetOptions { Status = _tweetMessageService.GetTwitterMessage(leaderboardInfo.Score) }; _twitterService.SendTweet(tweetOptions); }
public void SendTweet(String status) { var tweetoptions = new SendTweetOptions(); tweetoptions.Status = status; MessageBox.Show(status); service.SendTweet(tweetoptions); //service.SendTweet(tweetoptions); }
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; }
public static SendTweetOptions GetTweetID(string identifier) { SendTweetOptions found = new SendTweetOptions(); List<InteractiveTweet> tweetList = GetUpdates.localTweetList; for (int index = 0; index < tweetList.Count; index++) { if (tweetList[index].TweetIdentification.CompareTo(identifier) == 0) { found.InReplyToStatusId = tweetList[index].ID; string atName = tweetList[index].AuthorScreenName; found.Status = atName; /* @name */ } } return found; }
public void Tweet() { //ステータスリスト List<TwitterService> ResponseList = new List<TwitterService>(); //各アカウントでつぶやく foreach (Core.ApplicationSetting.AccountClass account in AccountList) { TwitterService service = new TwitterService(Core.Twitter.CONSUMERKEY, Core.Twitter.CONSUMERSECRET); service.AuthenticateWith(account.Token, account.TokenSecret); SendTweetOptions opt = new SendTweetOptions(); opt.Status = Core.Replace.ReplaceText(TweetText, Song); // ツイートする内容 //テキストを自動的に削るやつ if (AutoDeleteText == true && opt.Status.Length > 140) { opt.Status = opt.Status.Remove(137);//...の三文字分含めて削除 opt.Status += "..."; } //Luaの関数を走らせる try { bool luaRet = (bool)luaFunc.Call(Song, opt, isCustomTweet)[0]; if (luaRet == true) { service.SendTweet(opt); ResponseList.Add(service); } } catch (Exception ex2) { //Luaが失敗しても死なないようにする Trace.WriteLine("Lua error."); Trace.WriteLine(ex2.ToString()); service.SendTweet(opt); ResponseList.Add(service); } } //完了イベントを投げる onProcessFinished(ResponseList); }
static public TwitterItem writeNewTweet(AccountTwitter account, string text, string upload_image_path = null) { try { TwitterStatus status = null; if (string.IsNullOrEmpty(upload_image_path)) { SendTweetOptions options = new TweetSharp.SendTweetOptions(); options.Status = text; status = account.twitterService.SendTweet(options); } else { SendTweetWithMediaOptions media_options = new SendTweetWithMediaOptions(); media_options.Status = text; FileStream file_stream = System.IO.File.OpenRead(upload_image_path); Dictionary <string, Stream> image_dictionary = new Dictionary <string, Stream>(); image_dictionary.Add(upload_image_path, file_stream); media_options.Images = image_dictionary; status = account.twitterService.SendTweetWithMedia(media_options); } if (status != null) { return(API.TweetSharpConverter.getItemFromStatus(status, account)); } else { System.Windows.MessageBox.Show("Failed", "Sending of tweet failed"); return(null); } } catch (Exception exp) { System.Windows.MessageBox.Show(exp.Message, "Sending of tweet failed"); return(null); } }
public virtual Task<TwitterResponse<TwitterStatus>> SendTweetAsync(SendTweetOptions options) { var status = options.Status; var in_reply_to_status_id = options.InReplyToStatusId; var lat = options.Lat; var @long = options.@Long; var place_id = options.PlaceId; var display_coordinates = options.DisplayCoordinates; var trim_user = options.TrimUser; return ExecuteRequest<TwitterStatus>(HttpMethod.Post, "statuses/update", FormatAsString, "?status=", status, "&in_reply_to_status_id=", in_reply_to_status_id, "&lat=", lat, "&long=", @long, "&place_id=", place_id, "&display_coordinates=", display_coordinates, "&trim_user=", trim_user); }
private static void SendTweet(string tweet) { if (DEBUG == false) { TwitterClientInfo twitterClientInfo = new TwitterClientInfo(); twitterClientInfo.ConsumerKey = ConsumerKey; //Read ConsumerKey out of the app.config twitterClientInfo.ConsumerSecret = ConsumerSecret; //Read the ConsumerSecret out the app.config TwitterService twitterService = new TwitterService(twitterClientInfo); SendTweetOptions tweetOps = new SendTweetOptions() { Status = tweet }; twitterService.AuthenticateWith(AccessToken, AccessTokenSecret); twitterService.SendTweet(tweetOps); var responseText = twitterService.Response.Response; Console.WriteLine("Tweet has been sent: " + tweet); } else { Console.WriteLine(tweet); } }
private void btnPost_Click(object sender, RoutedEventArgs e) { //MainUtil.SetKeyValue<string>("AccessToken", string.Empty); //MainUtil.SetKeyValue<string>("AccessTokenSecret", string.Empty); //Dispatcher.BeginInvoke(() => //{ // var SignInMenuItem = (Microsoft.Phone.Shell.ApplicationBarMenuItem)this.ApplicationBar.MenuItems[0]; // SignInMenuItem.IsEnabled = true; // var SignOutMenuItem = (Microsoft.Phone.Shell.ApplicationBarMenuItem)this.ApplicationBar.MenuItems[1]; // SignOutMenuItem.IsEnabled = false; // //TweetPanel.Visibility = System.Windows.Visibility.Collapsed; // MessageBox.Show("You have been signed out successfully."); //}); var service = new TwitterService(consumerKey, consumerKeySecret); SendTweetOptions tweetOptions = new SendTweetOptions(); tweetOptions.Status = TxtPost.Text + " " + Txtlink.Text; try { service.AuthenticateWith(accessToken, accessTokenSecret); service.SendTweet(new SendTweetOptions { Status = TxtPost.Text + " " + Txtlink.Text }, (tweet, response) => { if (response.StatusCode == HttpStatusCode.OK) { Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("You have successfully tweeted the message!"); StrCommonObject = JsonConvert.SerializeObject(ObjCommon); NavigationService.Navigate(new Uri("/Pages/FrmProgress.xaml?common=" + StrCommonObject, UriKind.Relative)); }); } else { Dispatcher.BeginInvoke(() => { MessageBox.Show(response.Error.Message.ToString()); StrCommonObject = JsonConvert.SerializeObject(ObjCommon); NavigationService.Navigate(new Uri("/Pages/FrmProgress.xaml?common=" + StrCommonObject, UriKind.Relative)); }); } }); } catch(Exception ex) { MessageBox.Show(ex.Message); } }
private void btnPost_Click(object sender, RoutedEventArgs e) { var service = new TwitterService(consumerKey, consumerKeySecret); SendTweetOptions tweetOptions = new SendTweetOptions(); tweetOptions.Status = TxtPost.Text + " " + Txtlink.Text; try { service.AuthenticateWith(ObjCommon.Twittertoken.ToString(), ObjCommon.TwitterAccessTokenSecret); service.SendTweet(new SendTweetOptions { Status = TxtPost.Text + " " + Txtlink.Text }, (tweet, response) => { if (response.StatusCode == HttpStatusCode.OK) { Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("You have successfully tweeted the message!"); StrCommonObject = JsonConvert.SerializeObject(ObjCommon); NavigationService.Navigate(new Uri("/Pages/FrmProgress.xaml?common=" + StrCommonObject, UriKind.Relative)); }); } else { Dispatcher.BeginInvoke(() => { MessageBox.Show(response.Error.Message.ToString()); StrCommonObject = JsonConvert.SerializeObject(ObjCommon); NavigationService.Navigate(new Uri("/Pages/FrmProgress.xaml?common=" + StrCommonObject, UriKind.Relative)); }); } }); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static void UpdateStatus(TextBox tb, ref TwitterModelClass tmc) { SendTweetOptions options = new SendTweetOptions(); tmc.service.SendTweet(options); if (tb.Tag != null) { // Mentionなら TwitterStatus mentionedStatus = (TwitterStatus)((ListViewItem)tb.Tag).Tag; options.InReplyToStatusId = mentionedStatus.Id; } options.Status = tb.Text; tmc.service.SendTweet(options); tb.Clear(); }
void CallBackVerifiedResponse(OAuthAccessToken at, TwitterResponse response) { if (at != null) { IsolatedSettingsHelper.SetValue<string>("ttoken", at.Token); IsolatedSettingsHelper.SetValue<string>("ttokensec", at.TokenSecret); try { Dispatcher.BeginInvoke(() => { ////////////////////////// OAuthCredentials credentials = new OAuthCredentials(); credentials.Type = OAuthType.ProtectedResource; credentials.SignatureMethod = OAuthSignatureMethod.HmacSha1; credentials.ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader; credentials.ConsumerKey = TwitterSettings.ConsumerKey; credentials.ConsumerSecret = TwitterSettings.ConsumerKeySecret; credentials.Token = at.Token; credentials.TokenSecret = at.TokenSecret; credentials.Version = "1.1"; //credentials.ClientUsername = ""; credentials.CallbackUrl = "none"; var service = new TwitterService(TwitterSettings.ConsumerKey, TwitterSettings.ConsumerKeySecret); service.AuthenticateWith(at.Token, at.TokenSecret); SendTweetOptions st = new SendTweetOptions(); st.Status = "post"; service.SendTweet(new SendTweetOptions { Status = post }, CallBackVerifiedResponse1); /////////////////////////////// }); } catch { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("An error occurred,please try again."); return; }); } } else { System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show("Wrong pin please try again", "Error", MessageBoxButton.OK); GetTwitterToken(); }); } }
public virtual void SendTweet(SendTweetOptions options, Action<TwitterStatus, TwitterResponse> action) { var status = options.Status; var in_reply_to_status_id = options.InReplyToStatusId; var lat = options.Lat; var @long = options.@Long; var place_id = options.PlaceId; var display_coordinates = options.DisplayCoordinates; var trim_user = options.TrimUser; WithHammock(WebMethod.Post, action, "statuses/update", FormatAsString, "?status=", status, "&in_reply_to_status_id=", in_reply_to_status_id, "&lat=", lat, "&long=", @long, "&place_id=", place_id, "&display_coordinates=", display_coordinates, "&trim_user=", trim_user); }
/// <summary> /// Posts a status update on Facebook and/or twitter /// </summary> /// <param name="option"></param> /// <param name="previousTweetId"></param> /// <param name="previousFacebookId"></param> /// <param name="previousTweeterName"></param> /// <param name="previousFacebookName"></param> public void PostOnline(PostOption postOption, long previousTweetId = 0, long previousFacebookId = 0, string previousTweeterName = null, string previousFacebookName = null) { if (postOption == PostOption.Twitter || postOption == PostOption.Both) { TwitterService service = new TwitterService(Helper.GetPublicKey(), Helper.GetSecretKey()); service.AuthenticateWith(Helper.GetPublicToken(), Helper.GetSecretToken()); SendTweetOptions options = new SendTweetOptions() { Status = GetTweetText(previousTweeterName) }; if (previousTweetId != 0 && previousTweeterName != null) { options.InReplyToStatusId = previousTweetId; } service.SendTweet(options); if (service.Response.StatusCode != System.Net.HttpStatusCode.OK) { //probably hit a rate limit, chill out! Thread.Sleep(600000); } } if (postOption == PostOption.Facebook || postOption == PostOption.Both) { //TODO: implement facebook here } }
public void Tweet(string message, string hashTag, string picture) { if (CalcurateTweetLength(message, hashTag, picture) > 140) { throw new ArgumentException("文字数が多すぎます。"); } if (twitterService_ == null) { twitterService_ = new TwitterService(consumerKey_, consumerSecret_); twitterService_.AuthenticateWith(accessToken_, accessTokenSecret_); } var str = CreateTweetText(message, hashTag); if (picture != null) { SendTweetWithMediaOptions opt = new SendTweetWithMediaOptions(); using (var fs = new FileStream(picture, FileMode.Open, FileAccess.Read, FileShare.Read)) { opt.Images = new Dictionary<string, Stream> { { "image", fs } }; opt.Status = str; twitterService_.SendTweetWithMedia(opt); } } else { var opt = new SendTweetOptions(); opt.Status = str; twitterService_.SendTweet(opt); } }
private static SendTweetOptions GetTweetFromDrive() { DriveService drvService = new DriveService(); string keyFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"PepitoTW-a35a54d97c0c.p12"); drvService = AuthenticateServiceAccount(ConfigurationManager.AppSettings["ServiceAccountEmail"], keyFilePath); Google.Apis.Drive.v2.Data.File pepitoTweets = GetFile(drvService); if (!String.IsNullOrEmpty(pepitoTweets.EmbedLink)) { var stream = drvService.HttpClient.GetStreamAsync(pepitoTweets.EmbedLink); var result = stream.Result; using ( var fileStream = System.IO.File.Create(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/prueba.txt")) { result.CopyTo(fileStream); } } else { if (!String.IsNullOrEmpty(pepitoTweets.DownloadUrl)) { var stream = drvService.HttpClient.GetStreamAsync(pepitoTweets.DownloadUrl); var result = stream.Result; using ( var fileStream = System.IO.File.Create(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/prueba.txt")) { result.CopyTo(fileStream); } } } SendTweetOptions twtOptions = new SendTweetOptions(); twtOptions.Status = GetStatus(); return twtOptions; }
/// <summary> /// Posts a new status to Twitter /// </summary> /// <param name="command"></param> private void NewTweet(string command) { SendTweetOptions opts = new SendTweetOptions(); opts.Status = command; User.Account.SendTweet(opts); }
/// <summary> /// Replies only to the tweet author, not mentioning everyone else the author mentioned /// </summary> private void ReplyClean(string command) { if (User.IsMissingArgs(command) == false) /* It's just an exception catching method, don't mind it */ { if (command.Split(' ')[1].Length != 2) { ScreenDraw.ShowMessage("Wrong syntax. Use /r [id] [reply]"); } else { char[] splitter = { ' ' }; /* Because why not? */ string message = ""; try { message = command.Split(splitter, 3)[2]; } catch (Exception) { ScreenDraw.ShowMessage("Wrong syntax. Use /r [id] [reply]"); return; } SendTweetOptions replyOpts = new SendTweetOptions(); Int64 tweetID = (Int64)TweetIdentification.GetTweetID(command.Split(' ')[1]).InReplyToStatusId; InteractiveTweet twit = TweetIdentification.FindTweet(tweetID); if (twit.IsDirectMessage) { SendDirectMessageOptions dmOpts = new SendDirectMessageOptions(); dmOpts.Text = message; dmOpts.ScreenName = twit.AuthorScreenName; User.Account.SendDirectMessage(dmOpts); if (User.Account.Response.Error != null) { TwitterError error = User.Account.Response.Error; ScreenDraw.ShowMessage(error.Code + ": " + error.Message); } } else { replyOpts.InReplyToStatusId = tweetID; replyOpts.Status = replyOpts.Status + " "; replyOpts.Status = replyOpts.Status + message; User.Account.BeginSendTweet(replyOpts); if (User.Account.Response.Error != null) { TwitterError error = User.Account.Response.Error; ScreenDraw.ShowMessage(error.Code + ": " + error.Message); } } } } }
public void ShareOnTwitter() { string post = ""; post = update_text.Text; if (post.Length > 140) post = post.Substring(0, 137) + "…"; twitter_post = post; if (tokenx == " " && tokensecx == " " || tokenx == null && tokensecx == null) { NavigationService.Navigate(new Uri(string.Format("/TwitterLoginPage.xaml?vpost={0}", post), UriKind.Relative)); } else { ////////////////////////// OAuthCredentials credentials = new OAuthCredentials(); credentials.Type = OAuthType.ProtectedResource; credentials.SignatureMethod = OAuthSignatureMethod.HmacSha1; credentials.ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader; credentials.ConsumerKey = TwitterSettings.ConsumerKey; credentials.ConsumerSecret = TwitterSettings.ConsumerKeySecret; credentials.Token = tokenx; credentials.TokenSecret = tokensecx; credentials.Version = "1.1"; //credentials.ClientUsername = ""; credentials.CallbackUrl = "none"; var service = new TwitterService(TwitterSettings.ConsumerKey, TwitterSettings.ConsumerKeySecret); service.AuthenticateWith(tokenx, tokensecx); SendTweetOptions st = new SendTweetOptions(); st.Status = "post"; service.SendTweet(new SendTweetOptions { Status = post }, CallBackVerifiedResponse1); // ShowProgressIndicator(AppResources.GettingLocationProgressText); /////////////////////////////// } }
/// <summary> /// Replies to a tweet without mentioning the other participants /// </summary> private void ReplyQuiet(string command) { if (User.IsMissingArgs(command) == false) /* Checks if arguments are missing from the command */ { if (command.Split(' ')[1].Length != 2) { ScreenDraw.ShowMessage("Wrong syntax. Use /rn [id] [reply]"); } else { char[] splitter = { ' ' }; string message = command.Split(splitter, 3)[2]; SendTweetOptions replyOpts = new SendTweetOptions(); Int64 tweetID = (Int64)TweetIdentification.GetTweetID(command.Split(' ')[1]).InReplyToStatusId; InteractiveTweet twit = TweetIdentification.FindTweet(tweetID); if (twit.IsDirectMessage) { SendDirectMessageOptions dmOpts = new SendDirectMessageOptions(); dmOpts.Text = message; dmOpts.ScreenName = twit.AuthorScreenName; User.Account.SendDirectMessage(dmOpts); if (User.Account.Response.Error != null) { TwitterError error = User.Account.Response.Error; ScreenDraw.ShowMessage(error.Code + ": " + error.Message); } } else { replyOpts.InReplyToStatusId = tweetID; replyOpts.Status = message; User.Account.BeginSendTweet(replyOpts); if (User.Account.Response.Error != null) { TwitterError error = User.Account.Response.Error; ScreenDraw.ShowMessage(error.Code + ": " + error.Message); } } } } }
/// <summary> /// Posts a reply to a tweet /// </summary> /// <param name="command">the full command used</param> /// <returns>should the program ask for more input from the user?</returns> private void ReplyGeneric(string command) { if (User.IsMissingArgs(command) == false) /* It's just an exception catching method, don't mind it */ { if (command.Split(' ')[1].Length != 2) { ScreenDraw.ShowMessage("Wrong syntax. Use /r [id] [reply]"); } else { char[] splitter = { ' ' }; string message = ""; try { message = command.Split(splitter, 3)[2]; } catch (Exception) { ScreenDraw.ShowMessage("The command was missing arguments"); return; } SendTweetOptions replyOpts = new SendTweetOptions(); Int64 tweetID = 0; try { tweetID = (Int64)TweetIdentification.GetTweetID(command.Split(' ')[1]).InReplyToStatusId; } catch (InvalidOperationException) { ScreenDraw.ShowMessage("Such an update does not exist"); return; } InteractiveTweet tweetReplyingTo = TweetIdentification.FindTweet(tweetID); if (tweetReplyingTo.IsDirectMessage) { SendDirectMessageOptions dmOpts = new SendDirectMessageOptions(); dmOpts.Text = message; dmOpts.ScreenName = tweetReplyingTo.AuthorScreenName; User.Account.SendDirectMessage(dmOpts); if (User.Account.Response.Error != null) { TwitterError error = User.Account.Response.Error; ScreenDraw.ShowMessage(error.Code + ": " + error.Message); } } else { string[] words = tweetReplyingTo.Contents.Split(' '); string userScreenName = GetUpdates.userScreenName.ToLower(); for (int index = 0; index < words.Length; index++) /* This checks for extra people mentioned in the tweet */ { if (words[index].StartsWith("@") && words[index].CompareTo("@") != 0) { if (words[index].ToLower().CompareTo("@" + userScreenName) != 0) { replyOpts.Status = replyOpts.Status + words[index] + " "; } } } replyOpts.InReplyToStatusId = tweetID; replyOpts.Status = replyOpts.Status + message; User.Account.BeginSendTweet(replyOpts); } } } }
/// <summary> /// Sets an user status. /// </summary> /// <param name="status">Status entity.</param> public async Task SetStatusAsync(TwitterStatus status) { // Pass your credentials to the service string consumerKey = _settings.TwitterConsumerKey; string consumerSecret = _settings.TwitterConsumerSecret; // Authorize var service = new TwitterService(consumerKey, consumerSecret); service.AuthenticateWith(status.Token, status.TokenSecret); // Send message TweetSharp.TwitterStatus result; if (string.IsNullOrEmpty(status.ScreenshotUrl)) { var tweet = new SendTweetOptions { Status = status.Message }; result = service.SendTweet(tweet); } else { using (var httpClient = new HttpClient()) { HttpResponseMessage response = await httpClient.GetAsync(status.ScreenshotUrl); if (!response.IsSuccessStatusCode) { throw new BadRequestException(response.ReasonPhrase); } Stream stream = await response.Content.ReadAsStreamAsync(); var tweet = new SendTweetWithMediaOptions { Status = status.Message, Images = new Dictionary<string, Stream> { { "media", stream } } }; result = service.SendTweetWithMedia(tweet); } } // Check result status if (result != null) { return; } // Check response status code switch (service.Response.StatusCode) { case HttpStatusCode.Unauthorized: case HttpStatusCode.BadRequest: // Invalid credentials or request data throw new BadRequestException(service.Response.Response); case HttpStatusCode.Forbidden: throw new ForbiddenException(service.Response.Response); case (HttpStatusCode)429: throw new TooManyRequestsException(service.Response.Response); } // Twitter internal errors if ((int)service.Response.StatusCode >= 500) { throw new BadGatewayException(service.Response.Response); } string message = string.Format("Unable to send tweet. Status code {0}: {1}", service.Response.StatusCode, service.Response); throw new InternalServerErrorException(message); }
public bool SendTweet(string body) { var result = false; try { var options = new SendTweetOptions { Status = body }; var status = this.m_service.SendTweet(options); result = status.Id > 0; } catch (Exception e) { throw new Exception(string.Format("Exception in TwitterAPIHelper SendTweet: {0}", e.Message)); } return result; }
public virtual IAsyncResult BeginSendTweet(SendTweetOptions options) { var status = options.Status; var in_reply_to_status_id = options.InReplyToStatusId; var lat = options.Lat; var @long = options.@Long; var place_id = options.PlaceId; var display_coordinates = options.DisplayCoordinates; var trim_user = options.TrimUser; return BeginWithHammock<TwitterStatus>(WebMethod.Post, "statuses/update", FormatAsString, "?status=", status, "&in_reply_to_status_id=", in_reply_to_status_id, "&lat=", lat, "&long=", @long, "&place_id=", place_id, "&display_coordinates=", display_coordinates, "&trim_user=", trim_user); }
public virtual Task<TwitterAsyncResult<TwitterStatus>> SendTweetAsync(SendTweetOptions options) { var status = options.Status; var in_reply_to_status_id = options.InReplyToStatusId; var lat = options.Lat; var @long = options.@Long; var place_id = options.PlaceId; var display_coordinates = options.DisplayCoordinates; var trim_user = options.TrimUser; var media_ids = options.MediaIds; return WithHammockTask<TwitterStatus>(_client, WebMethod.Post, "statuses/update", FormatAsString, "?status=", status, "&in_reply_to_status_id=", in_reply_to_status_id, "&lat=", lat, "&long=", @long, "&place_id=", place_id, "&display_coordinates=", display_coordinates, "&trim_user="******"&media_ids=", media_ids); }
private void ShareOnTwitter(LeaderboardInfo leaderboardInfo) { var tweetOptions = new SendTweetOptions { Status = _tweetMessageService.GetTwitterMessage(leaderboardInfo.Score) }; _twitterService.SendTweet(tweetOptions); }
public void ShareOnTwitter() { MainVen.Venue selectedVenue = post_location.SelectedItem as MainVen.Venue; string post = ""; post = "I'm at "+ selectedVenue.name; twitter_post = post; if (tokenx == " " && tokensecx == " " || tokenx == null && tokensecx == null) { NavigationService.Navigate(new Uri(string.Format("/TwitterLoginPage.xaml?vpost={0}", post), UriKind.Relative)); } else { ////////////////////////// OAuthCredentials credentials = new OAuthCredentials(); credentials.Type = OAuthType.ProtectedResource; credentials.SignatureMethod = OAuthSignatureMethod.HmacSha1; credentials.ParameterHandling = OAuthParameterHandling.HttpAuthorizationHeader; credentials.ConsumerKey = TwitterSettings.ConsumerKey; credentials.ConsumerSecret = TwitterSettings.ConsumerKeySecret; credentials.Token = tokenx; credentials.TokenSecret = tokensecx; credentials.Version = "1.1"; //credentials.ClientUsername = ""; credentials.CallbackUrl = "none"; var service = new TwitterService(TwitterSettings.ConsumerKey, TwitterSettings.ConsumerKeySecret); service.AuthenticateWith(tokenx, tokensecx); SendTweetOptions st = new SendTweetOptions(); st.Status = "post"; service.SendTweet(new SendTweetOptions { Status = post }, CallBackVerifiedResponse1); /////////////////////////////// } }