public void LoopThroughFriendsList(FaceBookProfile CheckThisFriend) { if (AlreadySearch.Contains(CheckThisFriend) == false) { AlreadySearch.Add(CheckThisFriend); } foreach (FaceBookProfile ThisFriend in CheckThisFriend.FriendsList) { if (AlreadySearch.Contains(ThisFriend) == true) { continue; } if (ThisFriend.Facebookname.Equals(FindThisPerson)) { searchListpath.Add(ThisFriend); PathSaving.Add(searchListpath); searchListpath.Clear(); searchListpath.Add(this); } else { searchListpath.Add(ThisFriend); LoopThroughFriendsList(ThisFriend); } } }
private static void LogFaceBook(FaceBookProfile facebookProfile) { if (facebookProfile != null) { LogService.LogErrors("Successfully pulled facebook details for " + facebookProfile?.Email); } else { LogService.LogErrors("failed to pulled facebook details"); } }
//Find if the Facebook profile in the graph if it exist using the actually class value public FaceBookProfile Find(FaceBookProfile value) { foreach (FaceBookProfile node in nodes) { if (node.Value.Equals(value)) { return(node); } } return(null); }
// Adds a node with the given value to the graph. If a node // with the same value is in the graph, the value // isn't added and the method returns false public bool AddNode(FaceBookProfile value) { if (Find(value) != null) { // duplicate value return(false); } else { nodes.Add(value); return(true); } }
/// <summary> /// Adds the given node as a neighbor for this node /// </summary> /// <param name="neighbor">neighbor to add</param> /// <param name="weight">weight of edge being added</param> /// <returns>true if the neighbor was added, false otherwise</returns> public bool AddNeighbor(FaceBookProfile neighbor) { // don't add duplicate nodes if (FriendsList.Contains(neighbor)) { return(false); } else { FriendsList.Add(neighbor); //weights.Add(weight); return(true); } }
/// <summary> /// Removes the given node as a neighbor for this node /// </summary> /// <param name="neighbor">neighbor to remove</param> /// <returns>true if the neighbor was removed, false otherwise</returns> public bool RemoveNeighbor(FaceBookProfile neighbor) { // remove weight for neighbor int index = FriendsList.IndexOf(neighbor); if (index == -1) { // neighbor not in list return(false); } else { // remove neighbor and edge weight FriendsList.RemoveAt(index); return(true); } }
public bool RemoveNode(FaceBookProfile value) { FaceBookProfile removeNode = Find(value); if (removeNode == null) { return(false); } else { // need to remove as neighor for all nodes // in graph nodes.Remove(removeNode); foreach (FaceBookProfile node in nodes) { node.RemoveNeighbor(removeNode); } return(true); } }
protected override async void OnAppearing() { base.OnAppearing(); //using System.Net.Http; //using System.Net.Http.Headers; var httpCilent = new HttpClient(); var request = new HttpRequestMessage(); request.RequestUri = new Uri("https://graph.facebook.com/v3.1/me?fields=id,name,picture,email,birthday"); request.Method = HttpMethod.Get; request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", FBToken); var response = await httpCilent.SendAsync(request); if (response.IsSuccessStatusCode) { var body = await response.Content.ReadAsStringAsync(); //using Newtonsoft.Json; FaceBookProfile profile = JsonConvert.DeserializeObject <FaceBookProfile>(body); BindingContext = profile; } }
public bool RemoveEdge(FaceBookProfile value1, FaceBookProfile value2) { FaceBookProfile node1 = Find(value1); FaceBookProfile node2 = Find(value2); if (node1 == null || node2 == null) { return(false); } else if (!node1.AllMyCurrentFriends.Contains(node2)) { // edge doesn't exist return(false); } else { // undirected graph, so remove as neighbors to each other node1.RemoveNeighbor(node2); node2.RemoveNeighbor(node1); return(true); } }
public bool AddEdge(FaceBookProfile value1, FaceBookProfile value2) { FaceBookProfile node1 = FindProfile(value1.Facebookname); FaceBookProfile node2 = FindProfile(value2.Facebookname); if (node1 == null || node2 == null) { return(false); } else if (node1.AllMyCurrentFriends.Contains(node2)) { // edge already exists return(false); } else { // undirected graph, so add as neighbors to each other node1.AddNeighbor(node2); node2.AddNeighbor(node1); //foreach (FaceBookProfile Friend in node2.FriendsList) //{ } if (node2.tempstringholder == "") { node2.tempstringholder = node1.Facebookname; node2.ListOfFriends.GetComponent <Text>().text = node1.Facebookname + " Is your friend"; } else { node2.tempstringholder = node2.tempstringholder + ", " + node1.Facebookname; node2.ListOfFriends.GetComponent <Text>().text = node2.tempstringholder + " Are your friend"; } return(true); } }