//============================================================================
        //! OKボタンが押された
        private void _ClickOKButton(object iSender, RoutedEventArgs iArgs)
        {
            //チェック
            var tweet = TweetTextBox.Text.Trim();

            if (tweet.Length == 0)
            {
                System.Media.SystemSounds.Hand.Play();
                MessageBox.Show("ツイートが入力されて居ません", "エラー", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }
            tweet += "\n\n#FCあどみぃ!";

            //ツイート
            try
            {
                var manager = SystemManager.GetInstance();
                var service = new TweetSharp.TwitterService(manager.GetTwitterAPICKey(), manager.GetTwitterAPICSecret());
                var info    = manager.GetSystemInfo();
                service.AuthenticateWith(info.mAccessToken.mToken, info.mAccessToken.mTokenSecret);
                var responce = service.SendTweet(new TweetSharp.SendTweetOptions {
                    Status = tweet
                });

                System.Media.SystemSounds.Asterisk.Play();
                MessageBox.Show("ツイートに成功しました!", "確認", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (System.Exception iException)
            {
                SystemUtility.DisplayErrorDialog("ツイートに失敗しました\n\n" + iException.Message);
            }

            Close();
        }
Exemple #2
0
 public void SendTwitterMessage(string message)
 {
     TweetSharp.TwitterService service = new TweetSharp.TwitterService(Constants.App_ConsumerKey, Constants.App_ConsumerSecret);
     service.AuthenticateWith(Constants.accessToken, Constants.tokenSecret);
     service.SendTweet(new TweetSharp.SendTweetOptions {
         Status = message
     });
 }
Exemple #3
0
 public static void Setup()
 {
     // Setup the Ioc container
     Ioc.Register <TweetSharp.TwitterService>(() => {
         var service = new TweetSharp.TwitterService(SettingHelper.ConsumerKey, SettingHelper.ConsumerSecret);
         service.AuthenticateWith(SettingHelper.Token, SettingHelper.TokenSecret);
         return(service);
     });
 }
        private async Task SetTwitterProfileImage(string userId, IEnumerable<Claim> claims)
        {
            // Retrieve the twitter access token and claim
            var accessTokenClaim = claims.FirstOrDefault(x => x.Type == "urn:twitter:accesstoken");
            var accessTokenSecretClaim = claims.FirstOrDefault(x => x.Type == "urn:twitter:accesstokensecret");

            if (accessTokenClaim != null && accessTokenSecretClaim != null)
            {
                var service = new TweetSharp.TwitterService("ztVUp8CwG0jyYZZoDKGXg", "jyFWNjzApKtogHMnRVvdvBqWJF2gPHNldjvopHZSoE", accessTokenClaim.Value, accessTokenSecretClaim.Value);
                var profile = service.GetUserProfile(new TweetSharp.GetUserProfileOptions());

                if (profile != null && !String.IsNullOrWhiteSpace(profile.ProfileImageUrl))
                {
                    var user = db.Users.Find(userId);

                    user.ImageUrl = profile.ProfileImageUrl.Replace("_normal", "_bigger");

                    db.Entry(user).State = System.Data.Entity.EntityState.Modified;

                    await db.SaveChangesAsync();
                }
            }
        }
Exemple #5
0
 public void SendTwitterMessage(string message)
 {
     TweetSharp.TwitterService service = new TweetSharp.TwitterService(Constants.App_ConsumerKey, Constants.App_ConsumerSecret);
     service.AuthenticateWith(Constants.accessToken, Constants.tokenSecret);
     service.SendTweet(new TweetSharp.SendTweetOptions { Status = message});
 }