public void Logout() { Settings settings = new Settings(); settings.Save(); }
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); } }