private Navigator _TryGetNavigatorFromProfileUri(Uri uri) { FacebookObjectId fbId = default(FacebookObjectId); // Maybe this is a straight-up profile.php?id=#### if (uri.LocalPath.ToLowerInvariant().Equals("/profile.php")) { string id = null; string idPart = null; foreach (string part in new[] { "?id=", "&id=" }) { if (uri.Query.ToLowerInvariant().Contains(part)) { idPart = part; break; } } if (idPart != null) { id = uri.Query.ToLower(); id = uri.Query.Substring(id.IndexOf(idPart) + idPart.Length); // Strip out the rest of the query id = id.Split('&')[0]; fbId = FacebookObjectId.Create(id); } if (FacebookObjectId.IsValid(fbId)) { var me = (FacebookContact)ViewManager.MasterNavigator.ProfileNavigator.Content; if (me.UserId.Equals(fbId)) { return(ViewManager.MasterNavigator.ProfileNavigator); } Navigator nav = ((ContactCollectionNavigator)ViewManager.MasterNavigator.FriendsNavigator).GetContactWithId(fbId); if (nav != null) { return(nav); } } } return(null); }
protected Navigator(object content, FacebookObjectId guid, Navigator parent) { Verify.IsNotNull(content, "content"); Verify.IsTrue(FacebookObjectId.IsValid(guid), "Invalid guid"); Content = content; Guid = guid; if (parent != null) { Parent = parent; Path = Parent.Path + "/" + Uri.EscapeDataString(Guid.ToString()); } else { Path = Uri.EscapeDataString(Guid.ToString()); } }
protected override Navigator GetChildNavigatorWithGuid(FacebookObjectId guid) { Verify.IsTrue(FacebookObjectId.IsValid(guid), "Invalid guid"); _album.VerifyAccess(); for (int index = 0; index < _album.Photos.Count; ++index) { if (_album.Photos[index].PhotoId == guid) { var navigator = new PhotoNavigator(_album.Photos[index], this) { ParentIndex = index, }; return(navigator); } } return(null); }
public static void GoOnline(string sessionKey, string sessionSecret, FacebookObjectId userId) { Verify.IsNeitherNullNorEmpty(sessionKey, "sessionKey"); Verify.IsNeitherNullNorEmpty(sessionSecret, "sessionSecret"); Verify.IsTrue(FacebookObjectId.IsValid(userId), "invalid userId"); if (FacebookService.IsOnline) { throw new InvalidOperationException(); } FacebookService.RecoverSession(sessionKey, sessionSecret, userId); var handler = GoneOnline; if (handler != null) { handler(FacebookService, new EventArgs()); } }