Advertisement
Guest User

Untitled

a guest
Sep 29th, 2014
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. private void postTweet()
  2. {
  3. IsolatedStorageSettings mysetting = IsolatedStorageSettings.ApplicationSettings;
  4. try
  5. {
  6. mysetting.TryGetValue("twitter_token", out value);
  7. mysetting.TryGetValue("twitter_tokensecret", out value2);
  8. }
  9. catch
  10. {
  11. }
  12. if (value == null)
  13. {
  14. NavigationService.Navigate(new Uri("/TwitterAuthPage.xaml", UriKind.Relative));
  15. }
  16. else
  17. {
  18. service = new TwitterService("consumerkey", "consumersecret", value, value2);
  19.  
  20. service.SendTweet(new SendTweetOptions { Status = "Testing..." },
  21. (statuses, response) =>
  22. {
  23. if (response.StatusCode == HttpStatusCode.OK)
  24. {
  25. dispatcher.BeginInvoke(() =>
  26. {
  27. MessageBox.Show("Tweet sent!");
  28. }
  29. );
  30. }
  31. else
  32. {
  33. throw new Exception(response.StatusCode.ToString());
  34. }
  35. });
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement