private void Tree_AfterExpand(object sender, TreeViewEventArgs e)
{
int FileID = int.Parse(((ListItem)comboxFile.Items[comboxFile.SelectedIndex]).ID);
BackgroundWorker bw = new BackgroundWorker();
bw.DoWork += new DoWorkEventHandler(bw_DoWork);
bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
object[] oArgs = new object[] { e.Node, FileID };
bw.RunWorkerAsync(oArgs);
bomTree.SelectedNode = e.Node;
}
{
int FileID = int.Parse(((ListItem)comboxFile.Items[comboxFile.SelectedIndex]).ID);
BackgroundWorker bw = new BackgroundWorker();
bw.DoWork += new DoWorkEventHandler(bw_DoWork);
bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted);
object[] oArgs = new object[] { e.Node, FileID };
bw.RunWorkerAsync(oArgs);
bomTree.SelectedNode = e.Node;
}
private void bw_DoWork(object sender, DoWorkEventArgs e)
{
object[] oArgs = e.Argument as object[];
TreeNode tn = oArgs[0] as TreeNode;
int FileID = int.Parse(oArgs[1].ToString());
DataAccess da = new DataAccess();
DataTable dtChildren = null;
DataTable dgvlist = null;
if (tn.Tag != null)
{
dtChildren = new DataTable();
dtChildren = GetData();
dgvlist = new DataTable();
dgvlist =GetData();
}
else
{
dtChildren = new DataTable();
dtChildren =da.SearchChildren(FileID, tn.Text + "%");
}
e.Result = new object[] { tn, dtChildren, dgvlist };
}
object[] oArgs = e.Argument as object[];
TreeNode tn = oArgs[0] as TreeNode;
int FileID = int.Parse(oArgs[1].ToString());
DataAccess da = new DataAccess();
DataTable dtChildren = null;
DataTable dgvlist = null;
if (tn.Tag != null)
{
dtChildren = new DataTable();
dtChildren = GetData();
dgvlist = new DataTable();
dgvlist =GetData();
}
else
{
dtChildren = new DataTable();
dtChildren =da.SearchChildren(FileID, tn.Text + "%");
}
e.Result = new object[] { tn, dtChildren, dgvlist };
}
private void bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
object[] oResult = e.Result as object[];
TreeNode tNodeParent = oResult[0] as TreeNode;
DataTable dtChildren = oResult[1] as DataTable;
DataTable dgvlist = oResult[2] as DataTable;
ArrayList arr = new ArrayList();
//dosomething
{
object[] oResult = e.Result as object[];
TreeNode tNodeParent = oResult[0] as TreeNode;
DataTable dtChildren = oResult[1] as DataTable;
DataTable dgvlist = oResult[2] as DataTable;
ArrayList arr = new ArrayList();
//dosomething
}