예제 #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;
        }
예제 #2
0
파일: Form1.cs 프로젝트: archie/sesun
        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();
        }
예제 #3
0
파일: ClientForm.cs 프로젝트: archie/sesun
        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();
        }