Ejemplo n.º 1
0
        public Friend acceptFriendRequest(Friend friend)
        {
            RemoteAsyncPostDelegate postDel;
            AsyncCallback postCallback;

            ClientApp._user.addFriend(friend);
            try
            {
                if (ClientApp._user.getPendingFriend(friend.Name) != null)
                    ClientApp._user.removePendingFriend(friend.Name);
            }
            catch (Exception) { }
            UpdateTextBoxesDelegate updateDelegate = new UpdateTextBoxesDelegate(ClientApp._form.refreshMyFriends);
            updateDelegate += ClientApp._form.refreshMyPendingFriends;
            ClientApp._form.BeginInvoke(updateDelegate);

            postCallback = new AsyncCallback(ClientApp._form.remoteAsyncSendPostCallBack);
            postDel = new RemoteAsyncPostDelegate(ClientApp._form.Server.sendPost);

            postDel.BeginInvoke(new Post(postMessage(ClientApp._user.Username,friend.Name),ClientApp._user.Username),postCallback,null);

            return null;
        }
Ejemplo n.º 2
0
        private void myMuralSend_Click(object sender, EventArgs e)
        {
            /*   if (myMuralText.Text == "")
                   MessageBox.Show("A caixa de texto ta vazia");
               else
               {
                   Post post = new Post(myMuralText.Text);
                   XmlSerializer x = new XmlSerializer(post.GetType());
                   TextWriter myTextWriter = new StringWriter();

                   x.Serialize(myTextWriter, post);

                   MessageBox.Show("Vou adicionar um post: " + myTextWriter.ToString());

                   _server.sendPost(myTextWriter.ToString());

                   myTextWriter.Close();*/
            Post post = new Post(myMuralText.Text);

            AsyncCallback RemoteCallback = new AsyncCallback(this.RemoteAsyncSendPostCallBack);
            RemoteAsyncPostDelegate RemoteDel = new RemoteAsyncPostDelegate(_server.sendPost);
            IAsyncResult RemAr = RemoteDel.BeginInvoke(post, RemoteCallback, null);
            this.myMuralText.Clear();
        }
Ejemplo n.º 3
0
        private void myMuralSend_Click(object sender, EventArgs e)
        {
            Post post = new Post(myMuralText.Text, ClientApp._user.Username);

            AsyncCallback RemoteCallback = new AsyncCallback(remoteAsyncSendPostCallBack);
            RemoteAsyncPostDelegate RemoteDel = new RemoteAsyncPostDelegate(_server.sendPost);
            IAsyncResult RemAr = RemoteDel.BeginInvoke(post, RemoteCallback, null);
            this.myMuralText.Clear();
        }