Not logged in. · Lost password · Register
Forum: MatriX RSS
Page: previous  1  2 
Avatar
Alex #16
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
In reply to post ID 8165
file versions are exactly the same on my machine.
I just verified it again, on WP 6.0 and 6.1 emulator everything runs fine here.
Have you tried the MiniClient example which comes with the download?
Avatar
ghostknight #17
Member since Oct 2013 · 17 posts
Group memberships: Members
Show profile · Link to this post
MiniClient works fine. And my code doesn't. Seems something wrong...
Avatar
ghostknight #18
Member since Oct 2013 · 17 posts
Group memberships: Members
Show profile · Link to this post
Wow!
I managed to make it work by following settings (all of the below):
Setting InvokeControl to some control.
Calling everything (especially creation) from the UI thread.
Seems Matrix is not very thread safe?
Avatar
Alex #19
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by ghostknight:
Seems Matrix is not very thread safe?

it should be, if there is still a problem then please attach a simple test case we will look at it.
Avatar
ghostknight #20
Member since Oct 2013 · 17 posts
Group memberships: Members
Show profile · Link to this post
I've made some more experiments. The clue is to specify InvokeControl.
Here is CallStack for successful OnBind invoke: http://gyazo.com/1a0b333a210f593a6bd1257aa1265d40
Seems that Matrix uses Control.Invoke and without InvokeControl is unable to call event?
But there is nothing about it in tutorial and docs.
Why is it needed and if it is so mandatory, that Matrix couldn't work without it - maybe it is worth specifing it in constructor (without empty constructor at all)?
Avatar
Alex #21
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
MatriX is completely asynchronous, based on async socket. So its multi threaded internal.
The problem is not MatriX, the problem is System.Windows.Forms which is not thread safe. When you get a MatriX event then this event gets raised in most cases from another thread than your UI thread. When you now call Windows Forms code from the event without invoking you get an exception.

When you set an InvokeControl then MatriX does all the invoking for you, and all events should invoke to your GUI thread.
When you set no InvokeControl the events don't get invoked from MatriX and you have to invoke them on your own.
Avatar
ghostknight #22
Member since Oct 2013 · 17 posts
Group memberships: Members
Show profile · Link to this post
And what when it is ok to invoke events in non-UI thread? I don't need to execute any UI code in event handler... I don't call any WindowsForms code. I just get no event fired at all. If InvokeControl is not specified - Matrix don't fire event at all. No first chance exceptions - just not fired. In such a case - how can I know, that event happened (bind was completed) and invoke something by myself? I don't see any way to do this.

To my mind events should be fired regardless InvokeControl specified. On background thread. And once InvokeControl specified - Matrix could help me by Invoking (transferring execution to UI threa) internally. But anyway, If I don't specife InvokeControl and want to Invoke myself - I want OnBind to be fired regargless InvokeControl specified. Am I wrong?
Avatar
ghostknight #23
Member since Oct 2013 · 17 posts
Group memberships: Members
Show profile · Link to this post
And you've mentioned that I can send my own custom presens in OnBeforeSendPresence event handler. I have the following code:
http://pastebin.com/GEJVxC80
And Matrix sends presense like this:
http://pastebin.com/4KaH8D2u
What I need  is http://pastebin.com/RLHnFwF3
Is it possible to achieve this?
Avatar
Alex #24
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
try this:
  1. private void ClientOnBeforeSendPresence(object sender, PresenceEventArgs presenceEventArgs)
  2. {
  3.     presenceEventArgs.Presence.Add(new Status { Value = "status.online" });
  4. }
Avatar
ghostknight #25
Member since Oct 2013 · 17 posts
Group memberships: Members
Show profile · Link to this post
It works, many thanks.

And what about InvokeControl? Is there a way to get OnBind fired without specifying InvokeControl?
Avatar
Alex #26
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
If it doesn't fire for you when no invoke control is set then please attach a simple WM6 test project. Then we can try to cause the problem.
Avatar
ghostknight #27
Member since Oct 2013 · 17 posts
Group memberships: Members
Show profile · Link to this post
Hmm... I was playing for couple hours this morning with the example I wrote before (when I've posted about InvokeControl) - now it works regardless specification of InvokeControl parameter.... O_o I'll play a bit more in next days.

Thanks.

I have a question about Jabber-RPC (XML-RPC). How can I call a method? I've found nothing about it in CHM doc. Is the only way by constructing XmppXElement with the structure of XML-PRC call xml according to http://xmpp.org/extensions/xep-0009.html#sect-id105205 and sending it manually usint IqFilter.SendIq?
Should I open another thread on the forum for this question?
This post was edited on 2013-10-09, 17:29 by ghostknight.
Avatar
Alex #28
Member since Feb 2003 · 4327 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
please open new threads when the topic changes.
RPC was discussed here recently, so I guess this thread will help:
http://forum.ag-software.net/thread/1562-What-is-RPC-mecha…
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:
Page: previous  1  2 
Forum: MatriX RSS