[MonoDevelop] Progress bars

Rafael Teixeira monoman at gmail.com
Thu Feb 15 17:51:52 EST 2007


No, you're blocking execution of the UI Thread.

Message-based UI frameworks (see
http://en.wikipedia.org/wiki/Event_loop) need you to give them some
chance to retrieve the messages from the queue (everything becomes a
message, like your PBStatus.Fraction = something) and update the UI.

Search '"gtk-sharp" event loop', and you'll find more.

:)

On 2/15/07, Neil Munro <neilmunro at gmail.com> wrote:
> Hey, I'm having some problems with using progress bars, I've had a look
> through my books and through MonoDoc and can't find out where I am going
> wrong with progress bars.
>
> I have a function that calls vUnpackBZ2() which is below, and i have a five
> step process and I want a progress bar to indicate the progress of the
> process, however the finally statements are not being executed. I've tried
> lots of different methods to get the progress bar to increment, and while
> the progress bar DOES increment, it only does so AFTER the 5 parts of the
> process have been complete, but each of the five steps execute the same
> finally statement with the appropriate percentage. Surly the focus should
> come back to the program, adjust the progress bar and then continue to run
> the next process?
>
>     protected virtual void vUnpackBZ2()
>     {
>         try
>         {
>             StreamWriter GenerateScript = new StreamWriter ( "unpack.sh" );
>             GenerateScript.WriteLine ( "#!/bin/bash" );
>             GenerateScript.WriteLine ( "cd temp" );
>             GenerateScript.WriteLine ( "bunzip2 -c *.tar.bz2 | tar -xf -" );
>             GenerateScript.WriteLine ( "rm *.tar.bz2" );
>             GenerateScript.Close ( );
>
>             ProcessStartInfo ExeScript = new ProcessStartInfo ( );
>             ExeScript.FileName = "chmod";
>             ExeScript.Arguments = "+x unpack.sh";
>             Process process = Process.Start ( ExeScript );
>             process.WaitForExit ( );
>             process.Close ( );
>
>             ProcessStartInfo RunScript = new ProcessStartInfo ( );
>             RunScript.FileName = "sh";
>             RunScript.Arguments = "unpack.sh" ;
>             Process process2 = Process.Start ( RunScript );
>             process2.WaitForExit ( );
>              process2.Close ( );
>         }
>
>         catch ( Exception ex )
>         {
>             ENInfo.Text = ex.Message;
>         }
>
>         finally
>         {
>             PBStatus.Fraction = 0.20 * 2;
>         }
>
> Thanks
> Neil
>
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list
>
>


-- 
Rafael "Monoman" Teixeira
---------------------------------------
"The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man." George Bernard Shaw


More information about the Monodevelop-list mailing list