Exemple #1
0
        private async System.Threading.Tasks.Task Authenticate(Settings settings)
        {
            FacebookSessionInfo sessionInfo = new FacebookSessionInfo();
            sessionInfo.FacebookToken = settings.FacebookToken;
            sessionInfo.FacebookID = settings.FacebookId;

            TinderSession activeSession = TinderSession.CreateNewSession(sessionInfo, _location);
            if (await activeSession.Authenticate())
            {
                (App.Current as App).RightSideBar.DataContext = activeSession.Matches;

                TopBarViewModel.ShowTopButtons = System.Windows.Visibility.Visible;

                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));

                App.RootFrame.RemoveBackEntry();
            }
        }
Exemple #2
0
 public void Logout()
 {
     Settings settings = new Settings();
     settings.Save();
 }
Exemple #3
0
        private async void webBrowser_Navigating(object sender, NavigatingEventArgs e)
        {
            if (e.Uri.ToString().StartsWith("https://www.facebook.com/connect/login_success.html"))
            {
                e.Cancel = true;

                WebViewBorder.Visibility = System.Windows.Visibility.Collapsed;

                LoginButtonBorder.Visibility = System.Windows.Visibility.Collapsed;

                if (Pulsate.GetCurrentState() != ClockState.Active)
                {
                    Pulsate.RepeatBehavior = RepeatBehavior.Forever;
                    Pulsate.Begin();
                }

                string accessToken = e.Uri.ToString().Substring(e.Uri.ToString().IndexOf("access_token=") + "access_token=".Length);
                if (accessToken.IndexOf("&") > 0)
                    accessToken = accessToken.Substring(0, accessToken.IndexOf("&"));

                var user = await FacebookUserResponse.GetFacebookUser(accessToken);

                Settings settings = new Settings();
                settings.FacebookId = user.Id;
                settings.FacebookToken = accessToken;
                settings.Save();

                await Authenticate(settings);
            }
        }