private void LoginInternal(string authenticationToken) { Token = authenticationToken; System.Diagnostics.Debug.WriteLine("LoginInternal Refresh"); DataManager.Current.Refresh <LocalCredentials>(LoginIdentity, (fbl) => { var so = Application.Current as ISetAuthenticationForThisAppInstance; if (so != null) { so.SetAuthenticationForThisAppInstance(_token); //FourSquareApp.Instance.SetAuthenticationForThisAppInstance(_token); } DataManager.Current.Flush(); if (_current != null && string.IsNullOrEmpty(_current.UserId)) { _current = DataManager.Current.LoadFromCache <LocalCredentials>(LoginIdentity); } OnAuthenticationSuccess(EventArgs.Empty); } , (ex) => { PriorityQueue.AddUiWorkItem(() => OnAuthenticationFailure(EventArgs.Empty)); } ); }
public static bool Initialize() { if (_current == null) { // Synchronous load attempt of the credentials. _current = DataManager.Current.LoadFromCache<LocalCredentials>(LoginIdentity); } return _current.HasLoggedIn; }
public static bool Initialize() { if (_current == null) { // Synchronous load attempt of the credentials. _current = DataManager.Current.LoadFromCache <LocalCredentials>(LoginIdentity); } return(_current.HasLoggedIn); }
private void LogoutInternal() { // "hack" for v1, v2 release ((ISignedOutThisInstance)Application.Current).SignedOutThisInstance = true; Token = null; _current = null; Initialize(); }
public override object Deserialize(LoadContext context, Type objectType, Stream stream) { var sr = new StreamReader(stream); var lc = new LocalCredentials(); try { Token = sr.ReadLine(); lc.UserId = sr.ReadLine(); if (!string.IsNullOrEmpty(Token) && !string.IsNullOrEmpty(lc.UserId)) { return(lc); } } catch { } throw new InvalidOperationException("There was a problem validating your credentials."); }
public override object Deserialize(LoadContext context, Type objectType, Stream stream) { var sr = new StreamReader(stream); var lc = new LocalCredentials(); try { Token = sr.ReadLine(); lc.UserId = sr.ReadLine(); if (!string.IsNullOrEmpty(Token) && !string.IsNullOrEmpty(lc.UserId)) { return lc; } } catch { } throw new InvalidOperationException("There was a problem validating your credentials."); }
private void LogoutInternal() { // "hack" for v1, v2 release ((ISignedOutThisInstance) Application.Current).SignedOutThisInstance = true; Token = null; _current = null; Initialize(); }
private void LoginInternal(string authenticationToken) { Token = authenticationToken; System.Diagnostics.Debug.WriteLine("LoginInternal Refresh"); DataManager.Current.Refresh<LocalCredentials>(LoginIdentity, (fbl) => { var so = Application.Current as ISetAuthenticationForThisAppInstance; if (so != null) { so.SetAuthenticationForThisAppInstance(_token); //FourSquareApp.Instance.SetAuthenticationForThisAppInstance(_token); } DataManager.Current.Flush(); if (_current != null && string.IsNullOrEmpty(_current.UserId)) { _current = DataManager.Current.LoadFromCache<LocalCredentials>(LoginIdentity); } OnAuthenticationSuccess(EventArgs.Empty); } , (ex) => { PriorityQueue.AddUiWorkItem(() => OnAuthenticationFailure(EventArgs.Empty)); } ); }