Hi Jiri, so I managed it faster as supposed.
The original problem: Suppose we have following code in for instance Windows
Forms window.


public Form1()
        {
            InitializeComponent();


            FbConnection conn = new FbConnection("some connection");
            conn.Open();
            FbRemoteEvent remoteEvent = new FbRemoteEvent(conn);
            remoteEvent.AddEvents(new[] {"TEST"});
            remoteEvent.RemoteEventCounts += new
FbRemoteEventEventHandler(remoteEvent_RemoteEventCounts);
            remoteEvent.QueueEvents();
            int id = Thread.CurrentThread.ManagedThreadId; //Here we'll have
value for instance 10
        }

        void remoteEvent_RemoteEventCounts(object sender,
FbRemoteEventEventArgs e)
        {
            //Here we are, when event fires
            int id = Thread.CurrentThread.ManagedThreadId; //this value will
be different from value obtained in Form1 constructor
            bool v = this.InvokeRequired; //Expression is true, that means
if somebody writes here something
                                                    //like
this.textBox1.Text = e.Counts.ToString()
                                                    //there will be
Exception about accessing UI from another Thread 
        }



My patch should address this issue so that objects of the spawning thread
can be safely accessed from event handler. Could you test it and commit if
you find it useful?

Regards, Pavel. http://www.nabble.com/file/p18535420/FbRemoteEvent.patch
FbRemoteEvent.patch 
-- 
View this message in context: 
http://www.nabble.com/RemoteEventCounts-in-FbRemoteEvent-tp18531448p18535420.html
Sent from the firebird-net-provider mailing list archive at Nabble.com.
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to