示例#1
0
        public void SendFriendRequest(FriendRequest f)
        {
            //Return if we're already friends
            Friends friends = GetFriendList();

            foreach (Friend friend in friends.FriendsInfo.Values)
            {
                if (friend.Address == f.SendTo && friend.Port == f.SendToPort)
                {
                    return;
                }
            }
            try
            {
                ServerManager.Instance.ServerInstance.ServerRequestInvoker.SendFriendRequest(f);
            }
            catch (ServiceUnavailableException)
            {
                throw new ServiceUnavailableException("Não foi possível enviar o pedido.Por favor tente mais tarde.");
            }
            catch (RemotingException)
            {
                throw new ServiceUnavailableException("Não foi possível enviar o pedido.");
            }
            FriendRequestList pl = GetSentFriendRequests();

            pl.AddFriendRequest(f);
            ServerManager.Instance.ServerInstance.WriteDomainObject(pl);
        }