Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
pecesama #1
Member since Jun 2005 · 7 posts
Group memberships: Members
Show profile · Link to this post
Subject: onMessage
I am trying to use the event onMessage and is not working for me. (i am working with CF)


I am doing the next

jClient.OnMessage += new agsXMPP.XmppClientConnection.MessageHandler(jClient_OnMessage);

where jClient is

jClient = new XmppClientConnection();

and the method is:

private void jClient_OnMessage(object sender, Message msg)
        {
            MessageBox.Show(msg.Body,"Mensaje",MessageBoxButtons.OK,MessageBoxIcon.Asterisk,MessageBoxDefaultButton.Button1);
        }

Thanks you for your help.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
hi pecesama,

this code looks ok.
possible problems are threads. Because the library runs in another thread as your main app. And windows forms are not thread safe. So you must invoke the most controls.
You can also send me your code then i take a look.

Alex
Avatar
pecesama #3
Member since Jun 2005 · 7 posts
Group memberships: Members
Show profile · Link to this post
thanks again Alex, i did not know that the library runs in another thread, i only include the next line in the header and is working

using System.Threading;
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS