[MonoDevelop] Progress bars

Neil Munro neilmunro at gmail.com
Thu Feb 15 08:54:58 EST 2007


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/monodevelop-list/attachments/20070215/5a84ee44/attachment-0001.html 


More information about the Monodevelop-list mailing list