public Guid Subscribe(Concept observer, string label, EndemeSet enSetRelationship, Endeme enRelationship, EndemeSet enSet, Endeme en) { // -------------------------------------------------------------------------- // Most Concepts will be added to the Observer list // -------------------------------------------------------------------------- EndemeItem standard = new EndemeItem(null); if (standard.ItemKey == Guid.Empty) { throw new Exception("boom"); } if (enRelationship.Count > 1 || !enRelationship.Contains('L')) { standard = Observer.Add(label, enSetRelationship, enRelationship, observer); } if (standard.ItemKey == Guid.Empty) { throw new Exception("boom"); } // -------------------------------------------------------------------------- // A few Concepts will be added to the Friend list // -------------------------------------------------------------------------- if (enRelationship.Contains('L')) { EndemeItem friend = Friend.Add(label, enSet, en, observer); Observer.ChangeGuid(friend.ItemKey, standard.ItemKey); } return(standard.ItemKey); }
public void Add_Remove() { var session = User.Login(Configuration.GetKey("username"), Configuration.GetKey("password")); var about = User.Get(session, session.Username); Friend.Add(session, Configuration.GetKey("second-username"), "t2_" + about.ID, session.ModHash); // check the friend list var list = Friend.List(session); if (list.Where(f => f.Name == Configuration.GetKey("second-username")).Count() != 1) { Assert.Fail("The user was not successfully added to the friend list"); } // now remove the friend Friend.Remove(session, Configuration.GetKey("second-username"), "t2_" + about.ID, session.ModHash); // refresh the list list = Friend.List(session); if (list.Where(f => f.Name == Configuration.GetKey("second-username")).Count() != 0) { Assert.Fail("The user was not successfully removed from the friend list"); } }
private void addFriend_Clicked(object sender, EventArgs e) { List <Friend> Friend = settings.friendData; if (Friend == null) { Friend = new List <Friend>(); } if (selectedFriend != null) { Friend friendToUpdate = Friend.Where(rec => rec.friendID == selectedFriend.friendID).First(); friendToUpdate.firstName = firstName.Text; friendToUpdate.lastName = lastName.Text; friendToUpdate.likes = likes.Text; friendToUpdate.dislikes = dislikes.Text; friendToUpdate.allergies = allergies.Text; } else { selectedFriend = new Friend(); selectedFriend.firstName = firstName.Text; selectedFriend.lastName = lastName.Text; selectedFriend.likes = likes.Text; selectedFriend.dislikes = dislikes.Text; selectedFriend.allergies = allergies.Text; selectedFriend.friendID = Guid.NewGuid().ToString(); Friend.Add(selectedFriend); } settings.friendData = Friend; Navigation.PopAsync(); }
private void Event_OnMessage(string sender, RevMessageEvent e) { if (Config[0] == "true") { if (e.post_type == "request" && e.request_type == "friend") { e.Exit = true; Friend.Add(e.flag.ToString(), "0"); } } if (Config[1] == "true") { if (e.post_type == "request" && e.request_type == "group" && e.sub_type == "invite") { e.Exit = true; Cluster.ClusterInviteMe(e.flag.ToString(), "0"); } } if (Config[2] == "true") { if (e.post_type == "request" && e.request_type == "group" && e.sub_type == "add") { e.Exit = true; List <uint> Adm = new List <uint>(); if (e.group_id > 0) { Adm = Cluster.GetAdmin(e.group_id); } if (Adm.Contains(Robot.id)) { Cluster.ClusterRequestJoin(e.flag.ToString(), "0"); } else { OnLog("没有权限同意群" + Cluster.ClusterInfo(e.group_id).group_name + "的加群请求"); } } } }
public void ListFriendComments() { var session = User.Login(Configuration.GetKey("username"), Configuration.GetKey("password")); var friends = Friend.List(session); // add some friends if (friends.Count == 0) { var self = User.Get(session, session.Username); // some SC2 folks. Friend.Add(session, "zngelday9", "t2_" + self.ID, session.ModHash); Friend.Add(session, "neodestiny", "t2_" + self.ID, session.ModHash); Friend.Add(session, "dApollo", "t2_" + self.ID, session.ModHash); Friend.Add(session, "TotalBiscuit", "t2_" + self.ID, session.ModHash); } // now check for comments var comments = Friend.GetComments(session); Assert.IsNotNull(comments); Assert.IsTrue(comments.Count > 0); }