protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            var url =
                CredentialsCreator.GetAuthorizationURL(TwitterConnectionInfoSingleton.getInstance().GetAppCredentials());

            TwitterPin.Source = new Uri(url);
        }
Exemple #2
0
        public async void ConnectPin()
        {
            if (!string.IsNullOrEmpty(_pinInput))
            {
                var userCredentials = CredentialsCreator.GetCredentialsFromVerifierCode(PinInput, TwitterConnectionInfoSingleton.getInstance().GetAppCredentials());

                if (userCredentials != null)
                {
                    Auth.SetCredentials(userCredentials);
                    var account = new Token(userCredentials.AccessToken, userCredentials.AccessTokenSecret);
                    AccountToken.SaveAccountData(account);
                    this.NavigationService.Navigate(typeof(Views.TimeLine));
                }
                else
                {
                    var msgDialogue = new MessageDialog("Pin code invalid", "Connection error");
                    await msgDialogue.ShowAsync();
                }

                return;
            }

            if (File.Exists(ApplicationData.Current.LocalFolder.Path + "\\config.json"))
            {
                var tokens          = AccountToken.ReadTokens();
                var userCredentials =
                    Auth.CreateCredentials(TwitterConnectionInfoSingleton.getInstance().getConsumerKey(), TwitterConnectionInfoSingleton.getInstance().getConsumerSecret(), tokens.token,
                                           tokens.tokenSecret);
                Auth.SetCredentials(userCredentials);
                this.NavigationService.Navigate(typeof(Views.TimeLine));
            }
            else
            {
                var msgDialogue = new MessageDialog("No account registered", "Connection error");
                await msgDialogue.ShowAsync();
            }
        }