Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
hipath #1
Member since Dec 2012 · 4 posts · Location: Athens, Grece
Group memberships: Members
Show profile · Link to this post
Subject: What is the equivalent invokerequired code for Matrix on message event in windows forms
I have used agsxmpp for a windows forms VB .net application and on the message receive event I have used the following standard code:

  1. Private Sub myXMPP_OnMessage(sender As Object, msg As Message) Handles XMPP.OnMessage
  2.    If InvokeRequired Then
  3.       BeginInvoke(CType(AddressOf myXMPP_OnMessage, MessageHandler), New Object() {sender, msg})
  4.       Return
  5.    End If
  6.    
  7.    'use the msg to change any form element
  8.    '.........
  9. end sub

I am trying to replicate the same general functionality, e.g. not tied to a specific control on the form, for Matrix, but I am afraid I am lost. I cannot get an object line "MessageHAndler" in the Matrix collection.

Can you please suggest an alternative?
This post was edited 2 times, last on 2013-02-01, 11:03 by Alex.
Edit reason: fixed code formatting
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
You don't need the following code in MatriX:

  1. If InvokeRequired Then
  2.    BeginInvoke(CType(AddressOf myXMPP_OnMessage, MessageHandler), New Object() {sender, msg})
  3.    Return
  4. End If

MatriX does all required invokes automatically internal in the library.
I suggest to look at the MiniClient example. There should be everything you need.

Alex
Avatar
hipath #3
Member since Dec 2012 · 4 posts · Location: Athens, Grece
Group memberships: Members
Show profile · Link to this post
Thank you very much for prompt reply.
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: