[Csharp]
Delegate bool MyDelete (TreeNodeCollection node );
Bool prrelust = false;
Bool xz.pdf = false;
Bool prrelust = false;
Bool xz.pdf = false;
Public bool PrintTreeViewNode (TreeNodeCollection node)
{
Foreach (TreeNode n in node)
{
If (n. Checked & (Convert. ToInt32 (n. Tag) = 30 ))
{
Xztasks = true;
String fanode = n. Parent. Parent. Text;
String time = cbTimeDelay. Text. Trim (). Substring (0, cbTimeDelay. Text. Trim (). Length-1); // latency
Int jihao = Convert. toInt32 (fanode. substring (fanode. indexOf ("(") + 1, fanode. indexOf (")")-fanode. indexOf ("(")-1); // host number
Int menhao; // Door Number
GCR. DoorSedBll bl = new GCR. DoorSedBll ();
If (n. Parent. Text! = "Host ")
{
Menhao = Convert. ToInt32 (n. Parent. Tag) * 8 + 4 + n. Index;
}
Else
{
Menhao = n. Index; // Door Number
}
Prrelust = bl. OpenDoorTimedelaySet (jihao, menhao, Convert. ToInt32 (time ));
If (! Prrelust)
{
Label3.Text = "";
Break;
}
}
PrintTreeViewNode (n. Nodes );
}
Return prrelust;
}
# Endregion
Private void btOpenDoorTimeSet_Click (object sender, EventArgs e)
{
Label3.Text = "loading delayed. Please wait .......";
MyDelete Dele = new MyDelete (PrintTreeViewNode );
Dele. BeginInvoke (this. tvDevc. Nodes, new AsyncCallback (AfterMyMothod), null );
}
# Endregion
# Region callback function for asynchronous parameter passing
Public void AfterMyMothod (IAsyncResult result)
{
AsyncResult async = (AsyncResult) result;
MyDelete DelegateInstance = (MyDelete) async. AsyncDelegate;
Bool rt = DelegateInstance. EndInvoke (result );
If (xztasks)
{
If (rt)
{
MessageBox. Show ("delayed loading successful! "," Prompt ", MessageBoxButtons. OK, MessageBoxIcon. Information );
}
Else
{
MessageBox. Show ("delayed loading failed !, Please reload! "," Error prompt ", MessageBoxButtons. OK, MessageBoxIcon. Error );
}
}
Else
{
MessageBox. Show ("select the control host number", "prompt", MessageBoxButtons. OK, MessageBoxIcon. Error );
}
Label3.Text = "";
}
# Endregion
Delegate bool MyDelete (TreeNodeCollection node );
Bool prrelust = false;
Bool xz.pdf = false;
Bool prrelust = false;
Bool xz.pdf = false;
Public bool PrintTreeViewNode (TreeNodeCollection node)
{
Foreach (TreeNode n in node)
{
If (n. Checked & (Convert. ToInt32 (n. Tag) = 30 ))
{
Xztasks = true;
String fanode = n. Parent. Parent. Text;
String time = cbTimeDelay. Text. Trim (). Substring (0, cbTimeDelay. Text. Trim (). Length-1); // latency
Int jihao = Convert. toInt32 (fanode. substring (fanode. indexOf ("(") + 1, fanode. indexOf (")")-fanode. indexOf ("(")-1); // host number
Int menhao; // Door Number
GCR. DoorSedBll bl = new GCR. DoorSedBll ();
If (n. Parent. Text! = "Host ")
{
Menhao = Convert. ToInt32 (n. Parent. Tag) * 8 + 4 + n. Index;
}
Else
{
Menhao = n. Index; // Door Number
}
Prrelust = bl. OpenDoorTimedelaySet (jihao, menhao, Convert. ToInt32 (time ));
If (! Prrelust)
{
Label3.Text = "";
Break;
}
}
PrintTreeViewNode (n. Nodes );
}
Return prrelust;
}
# Endregion
Private void btOpenDoorTimeSet_Click (object sender, EventArgs e)
{
Label3.Text = "loading delayed. Please wait .......";
MyDelete Dele = new MyDelete (PrintTreeViewNode );
Dele. BeginInvoke (this. tvDevc. Nodes, new AsyncCallback (AfterMyMothod), null );
}
# Endregion
# Region callback function for asynchronous parameter passing
Public void AfterMyMothod (IAsyncResult result)
{
AsyncResult async = (AsyncResult) result;
MyDelete DelegateInstance = (MyDelete) async. AsyncDelegate;
Bool rt = DelegateInstance. EndInvoke (result );
If (xztasks)
{
If (rt)
{
MessageBox. Show ("delayed loading successful! "," Prompt ", MessageBoxButtons. OK, MessageBoxIcon. Information );
}
Else
{
MessageBox. Show ("delayed loading failed !, Please reload! "," Error prompt ", MessageBoxButtons. OK, MessageBoxIcon. Error );
}
}
Else
{
MessageBox. Show ("select the control host number", "prompt", MessageBoxButtons. OK, MessageBoxIcon. Error );
}
Label3.Text = "";
}
# Endregion