mail-archives/gtk-sharp-list/2010-June/010359.html

104 строки
3.8 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Gtk-sharp-list] How to show custom window and do the computation in the background
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20How%20to%20show%20custom%20window%20and%20do%20the%0A%09computation%20in%20the%20background&In-Reply-To=4C277534.8020507%40chrishowie.com">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="010358.html">
<LINK REL="Next" HREF="010360.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Gtk-sharp-list] How to show custom window and do the computation in the background</H1>
<B>Maciej Pilichowski</B>
<A HREF="mailto:gtk-sharp-list%40lists.ximian.com?Subject=%5BGtk-sharp-list%5D%20How%20to%20show%20custom%20window%20and%20do%20the%0A%09computation%20in%20the%20background&In-Reply-To=4C277534.8020507%40chrishowie.com"
TITLE="[Gtk-sharp-list] How to show custom window and do the computation in the background">bluedzins at wp.pl
</A><BR>
<I>Sun Jun 27 13:13:30 EDT 2010</I>
<P><UL>
<LI>Previous message: <A HREF="010358.html">[Gtk-sharp-list] How to show custom window and do the computation in the background
</A></li>
<LI>Next message: <A HREF="010360.html">[Gtk-sharp-list] gtk-sharp 2.12.10 win32
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#10359">[ date ]</a>
<a href="thread.html#10359">[ thread ]</a>
<a href="subject.html#10359">[ subject ]</a>
<a href="author.html#10359">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>On Sunday 27 June 2010 17:58:44 Christopher David Howie wrote:
&gt;<i> The only thing you really have to worry about is if the Show() call
</I>&gt;<i> happens after the Destroy() call. But again, as you should be
</I>&gt;<i> using Application.Invoke() to call Destroy(), the dialog cannot be
</I>&gt;<i> destroyed until it is shown, since it is shown before control
</I>&gt;<i> returns to the GLib main loop.
</I>&gt;<i>
</I>&gt;<i> Make sense?
</I>
Yes, but with the shift I described not such worry:
public void UpdateCorpusInfo()
{
var dlg = new ProgressDialog(&quot;My title&quot;);
var thread = new Thread (new ParameterizedThreadStart
(doUpdateCorpusInfo));
thread.Start(dlg);
}
private void doUpdateCorpusInfo(object _arg)
{
var dlg = (ProgressDialog)_arg;
try
{
Gtk.Application.Invoke (delegate{ dlg.Show(); });
// loading data and refreshing GUI (via Invoke)
}
finally
{
if (dlg!=null)
Gtk.Application.Invoke (delegate{ dlg.Destroy();});
}
}
&gt;<i> I thought it already had an example of this... or maybe it was
</I>&gt;<i> removed. I'm not sure. But I do recall reading such an example on
</I>&gt;<i> the Mono website a while ago.
</I>
There are examples, but all scattered all over the page, there is no
section (task oriented). So it was (for me at least) get the big
picture.
Cheers,
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="010358.html">[Gtk-sharp-list] How to show custom window and do the computation in the background
</A></li>
<LI>Next message: <A HREF="010360.html">[Gtk-sharp-list] gtk-sharp 2.12.10 win32
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#10359">[ date ]</a>
<a href="thread.html#10359">[ thread ]</a>
<a href="subject.html#10359">[ subject ]</a>
<a href="author.html#10359">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/gtk-sharp-list">More information about the Gtk-sharp-list
mailing list</a><br>
</body></html>