[Gtk-sharp-list] Components using SynchronizationContext/AsyncOperationManager in GTK# ?

Jonas Finnemann Jensen jopsen at gmail.com
Fri Sep 21 10:10:40 EDT 2007


Hi,

I'm developing a small open source application in C#, it's suppose to run on
both Windows, Linux og OS X. Using Windows.Forms, Gtk# and Cocoa#
respectively.
To make this easier I'm writing a .dll library to contain 99% of the program
logic. Also enabling other projects to reuse some of the code...

Now, I want to download a lot of things asynchronously in this library, and
since both Windows.Forms and Gtk# isn't thread safe (don't know about
Cocoa#) I have to make sure that my file downloaded event is executed on the
main thread...

I've seen people do this with BackgroundWorker or
SynchronizationContext/AsyncOperationsManager, an article here:
http://www.julmar.com/blog/mark/PermaLink,guid,78805871-cb7b-4ea4-9be8-a8a1d61a15d8.aspx

But how can I make any of these work under Gtk#, I don't want to handle the
thread invocation in my GUI frontends with Windows.Forms.Form.BeginInvoke(),
Gtk.Application.Invoke() and whatever is used in Cocoa#... This wouldn't be
nice to other thirdparty developers who might want to reuse some of my code
either...

So how can I host a ComponentModel.IComponent correctly i a Gtk#
application? if possible? Is there anyother solution I've missed?
The only reasonable solution I've seen is to takeover the main loop, but
that's just a plain ugly hack :)

Hope somebody is able to help me, if it this is impossible it's never going
to be easy to write cross platform applications with mono...

-- 
Regards Jonas Finnemann Jensen.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/gtk-sharp-list/attachments/20070921/5ac7accc/attachment.html 


More information about the Gtk-sharp-list mailing list