Ejemplo n.º 1
0
        public void RefreshTokenQuery_QueryResponse(object sender, WebQueryResponseEventArgs e)
        {
            try
            {
                StreamReader reader      = new StreamReader(e.Response);
                string       strResponse = reader.ReadToEnd();
                var          parameters  = MainUtil.GetQueryParameters(strResponse);
                accessToken       = parameters["oauth_token"];
                accessTokenSecret = parameters["oauth_token_secret"];
                TimeSpan t = (DateTime.UtcNow - new DateTime(1970, 1, 1));

                MainUtil.SetKeyValue <string>("AccessToken", accessToken);
                MainUtil.SetKeyValue <string>("AccessTokenSecret", accessTokenSecret);
                MainUtil.SetKeyValue <string>("Timestamp", t.TotalSeconds.ToString());

                userLoggedIn();
            }
            catch (Exception ex)
            {
                Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show(ex.Message);
                });
            }
        }
Ejemplo n.º 2
0
        private void SignOut()
        {
            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.");
            });
        }