[Mono-list] Using Mono/C# to develop simple OSX app

Edward Ned Harvey (mono) edward.harvey.mono at clevertrove.com
Mon Nov 9 14:03:26 UTC 2015


> From: mono-list-bounces at lists.ximian.com [mailto:mono-list-
> bounces at lists.ximian.com] On Behalf Of sams
> 
> I know this post is now forking off in all kinds of different directions but
> I just wanted to ask one more thing - the original app I was talking about
> now includes a loop that determines the size of files whose names are
> passed
> in via XML. This takes a little time to run so I'd like to add some progress
> bars. I got as far as adding them and writing the code to make them work but
> the UI does not refresh until the loop is completely finished (ie rather
> than incrementing bit by bit, the UI gets refreshed when the progress bar's
> value is set to the maximum so to the user they just appear to jump from
> beginning to end).
> 
> I have investigated a few asynchronous techniques but I have not had any
> luck. If anyone can shed some light on this, I'd be very grateful! When I
> used to program .net, the solution for me was a call to
> Application.DoEvents......

For this type of question, I've had the best luck asking in the Xamarin Mac forums. But if I remember when I get back here later, I'll try to answer here.

Short answer: It's very likely you're hogging the main thread. You need to release it and run on a different thread in order to let the main thread get back to the main run loop, where it handles things like GUI updates.


More information about the Mono-list mailing list