public AuthViewModel() { _AuthorizeCommand = new RelayCommand(AuthorizeCommand, CanAuthorizeCommand); var settings = IsolatedStorageSettings.ApplicationSettings; if (OAuthDetails.IsAuthenticated) { OAuthToken = OAuthDetails.Token; OAuthTokenSecret = OAuthDetails.TokenSecret; IsAuthorized = true; } else { MyWebClient client = new MyWebClient(); OAuthHelper oauth = new OAuthHelper(); oauth.Callback = "oob"; oauth.ConsumerKey = OAuthDetails.ConsumerKey; oauth.ConsumerSecret = OAuthDetails.ConsumerSecret; client.OAuthHelper = oauth; client.DoPostCompleted += new EventHandler<DoPostCompletedEventArgs>(GotRequestToken); client.DoGetAsync(new Uri("https://api.twitter.com/oauth/request_token", UriKind.Absolute)); } }
private void AuthorizeCommand() { MyWebClient client = new MyWebClient(); OAuthHelper oauth = new OAuthHelper(); oauth.Token = OAuthToken; oauth.Verifier = Verifier; oauth.TokenSecret = OAuthTokenSecret; oauth.CreateSignature("https://api.twitter.com/oauth/access_token", "GET"); string auth = oauth.AuthenticationHeader; client.SetHeader("Authorization", auth); client.DoPostCompleted += new EventHandler<DoPostCompletedEventArgs>(AuthCompleted); client.DoGetAsync(new Uri("https://api.twitter.com/oauth/access_token", UriKind.Absolute)); }
private void SetTimelines() { var settings = IsolatedStorageSettings.ApplicationSettings; var oauth_token = settings["oauth_token"].ToString(); var oauth_token_secret = settings["oauth_token_secret"].ToString(); OAuthHelper helper = new OAuthHelper(); //helper.ConsumerKey = CONSUMER_KEY; //helper.ConsumerSecret = CONSUMER_SECRET; //helper.Token = oauth_token; //helper.TokenSecret = oauth_token_secret; var defaulttimeline = new MainTimelineViewModel(helper); AddTimeline(defaulttimeline); helper = new OAuthHelper(); //helper.ConsumerKey = CONSUMER_KEY; //helper.ConsumerSecret = CONSUMER_SECRET; //helper.Token = oauth_token; //helper.TokenSecret = oauth_token_secret; //AddTimeline(new UserTimelineViewModel("jimlynn",helper)); timelines.ItemsSource = timelineList; twitterPanel1.DataContext = defaulttimeline; CurrentTimeline = defaulttimeline; maketweet.OAuthHelper = new OAuthHelper(); foreach (var tl in timelineList) { tl.MakeTweet += new EventHandler<MakeTweetEventArgs>(tl_MakeTweet); } }