private void buttonAuthenticate_Click(object sender, RoutedEventArgs e)
        {
            string accessToken;
            string accessTokenSecret;

            TwitterClient.CreateAccessToken(this.requestToken, textBoxPIN.Text, out accessToken, out accessTokenSecret);

            this.socialMediaAction.SetTwitterAuthSettings(accessToken, accessTokenSecret);
            this.socialMediaAction.Save();

            this.Close();
        }
        public override void Activate(Guid networkId, string networkName)
        {
            // MySite
            bool   updateMySite = String.IsNullOrWhiteSpace(Settings[networkId + "_MySiteActive"]) ? false : bool.Parse(Settings[networkId + "_MySiteActive"]);
            string mySiteUrl    = Settings[networkId + "_MySiteUrl"];

            if (!String.IsNullOrEmpty(mySiteUrl))
            {
                mySiteUrl = mySiteUrl.EndsWith("/") ? mySiteUrl : mySiteUrl + "/";
                mySiteUrl = mySiteUrl + "_vti_bin/UserProfileService.asmx";
            }
            string mySiteUsername = Environment.UserDomainName + "\\" + Environment.UserName;
            string mySiteStatus   = Settings[networkId + "_MySiteStatus"];

            // Facebook
            bool   updateFacebook = String.IsNullOrWhiteSpace(Settings[networkId + "_FBActive"]) ? false : bool.Parse(Settings[networkId + "_FBActive"]);
            string fbAccessToken  = Settings["FBAccessToken"];
            string fbStatus       = Settings[networkId + "_FBStatus"];

            // Twitter
            bool   updateTwitter            = String.IsNullOrWhiteSpace(Settings[networkId + "_TwitterActive"]) ? false : bool.Parse(Settings[networkId + "_TwitterActive"]);
            string twitterStatus            = Settings[networkId + "_TwitterStatus"];
            string twitterAccessToken       = Settings["TwitterAccessToken"];
            string twitterAccessTokenSecret = Settings["TwitterAccessTokenSecret"];

            try
            {
                if (updateMySite)
                {
                    SharePointUMManager.UpdateStatus(mySiteUrl, mySiteUsername, mySiteStatus);
                }

                if (updateFacebook && !String.IsNullOrEmpty(fbAccessToken))
                {
                    FacebookClient.UpdateStatus(fbAccessToken, fbStatus);
                }

                if (updateTwitter && !String.IsNullOrEmpty(twitterAccessToken) && !String.IsNullOrEmpty(twitterAccessTokenSecret))
                {
                    TwitterClient.UpdateStatus(twitterStatus, twitterAccessToken, twitterAccessTokenSecret);
                }
            }
            catch (Exception ex)
            {
                if (HostApplication != null)
                {
                    HostApplication.SetStatusText(this, ex.Message, true);
                }
            }
        }
 private void buttonLogin_Click(object sender, RoutedEventArgs e)
 {
     Process.Start(TwitterClient.GetLoginUrl(out this.requestToken));
 }