首页 > 代码库 > 下载Xml文件方法

下载Xml文件方法

#region 下载Xml文件方法        //定义委托        private delegate void DownLoadDelegate(string url, string filename);        private DownLoadDelegate _downlaoddelegate;        /// <summary>        /// 文件下载        /// </summary>        /// <param name="url"></param>        /// <param name="filemane"></param>        private void download(string url, string filemane)        {            System.Net.WebClient wc = new System.Net.WebClient();            wc.DownloadFile(url, filemane);        }        private void dlNode()        {            showNode(treeView1.Nodes);        }        private void showNode(TreeNodeCollection node)        {            foreach (TreeNode n in node)            {                if (n.GetNodeCount(false) == 0)                {                    if (n.Tag != null)                    {                        Thread thread = new Thread(new ThreadStart(delegate                        {                            this.BeginInvoke(_downlaoddelegate, n.Tag.ToString(), mf.DirData + @"\" + n.Name + ".xml");                        }));                        thread.IsBackground = true;                        thread.Start();                    }                }                showNode(n.Nodes);            }        }        #endregion