private void FriendRequestFromReceived(FriendRequest friendRequest) { if (HaveFriendRequestUserControl(stackPanelFriendRequestsFrom.Children, friendRequest._id)) return; var control = new FriendRequestFromUserControl(); control.FriendRequestId = friendRequest._id; control.Username = friendRequest.to_user.username; control.UserId = friendRequest.to_user._id; control.FriendRequestCanceled += FriendRequestFromCanceled; stackPanelFriendRequestsFrom.Children.Add(control); }
private void FriendRequestFromCanceled(FriendRequestFromUserControl source) { string id = source.FriendRequestId; _userData.PgSession.Begin(delegate { var apiCall = _userData.PgSession.GetWebAppFunction("/api", "/friend_requests/" + id); var client = new RestClient(apiCall); var request = new RestRequest(Method.DELETE); client.Execute<ApiResponse>(request); }); }