delegate question!
- From: "DBC User" <dbcuser@xxxxxxxxx>
- Date: 12 Aug 2005 08:15:50 -0700
Hi all,
Could someone explain me the following
I have a winform. I call a long process in async model with a callback.
Now that once I get the call back I update a message to the main
winform. Well I got everything to work (based on an example), but I
didn't understand the fullflow. Why do I need to call a delegate to
update the main winform?
//Delegate declaration
delegate void CallDelegate(XmlNode xNode);
//Display information back to main thread
private void CallThread(XmlNode xNode)
{
if (this.Grid1.InvokeRequired == false)
{
DataSet resultDS=null;
DataSet ds = GetData();
ProcessDataandShow();
DisplayComplete();
}
else
{
CallDelegate calMain = new CallDelegate(CallThread);
BeginInvoke(calMain, new object[]{xNode});
}
}
//Callback for long process on completion
private void GetProcComplete(object sender, EventArgs
statusInformation)
{
CallMainThread(statusInformation.XNode);
}
I appriciate if someone can educate me on this?
Thanks in advance.
DBC
.
- Follow-Ups:
- Re: delegate question!
- From: Nicholas Paldino [.NET/C# MVP]
- Re: delegate question!
- Prev by Date: finding Source from dll
- Next by Date: Re: datagrid selectionbackcolor
- Previous by thread: finding Source from dll
- Next by thread: Re: delegate question!
- Index(es):
Relevant Pages
|