[Gtk-sharp-list] Check Process state in an GUI app

hellboy195 hellboy195 at gmail.com
Mon Jan 21 13:26:49 EST 2008

Michael Hutchinson wrote:
> On Jan 21, 2008 11:58 AM, hellboy195 <hellboy195 at gmail.com> wrote:
>> hi,
>> I'm currently trying to write a very very simple front-end for ffmpeg
>> with
>> gtk#.
>> My Code looks like this:
>> First I check if a file already exits with File.Exits(path)
>> MessageDialog -> Overwrite YesNO.
>> Then the I start ffmpeg with Process.Start().
>> Then I want show a MessageDialog if the process finished so I did it like
>> :
>> while(!proc.HasExited) {}
>> MessageDialog -> "Encoding finished";
>> This is working good but this causes some bugs. E.g: If I do Overwrite it
>> "yes". The MessageDialog isn't destroyed until the process finished. If I
>> delete this while {} it's working correct but the Message appears
>> immediately and not after the process hast Finished. Using if is also not
>> that good I suppose :/
>> Any solution? Thx in advance :)
> Your loop is hanging the GUI thread, by not allowing GTK to return to
> its main loop (in which it does all the drawing etc).
> Handle the Process.Exited thread instead:
> proc.Exited += delegate {
>     MessageDialog -> "Encoding finished";
> };
> -- 
> Michael Hutchinson
> http://mjhutchinson.com
> _______________________________________________
> Gtk-sharp-list maillist  -  Gtk-sharp-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/gtk-sharp-list

thank you very much for your help. I tried both of you methods and it's
working really great but there is one thing left that should work. With my
old (buggy) version the Files from the Treeview were removed automatically
when the encoding was finshed. That means. I have a treeview with let's say
3 titels and after the first title is finished with encoding it should be
removed to only 2 are remaining and so on ...
Any chance that I can manage it like in the past with?

		this.menuListStore.GetIterFirst(out iter);
		this.menuListStore.Remove(ref iter);

View this message in context: http://www.nabble.com/Check-Process-state-in-an-GUI-app-tp14982013p15003226.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.

More information about the Gtk-sharp-list mailing list