如何边执行边显示..

wl_851110 2010-10-09 04:21:52
        private void Form1_Load(object sender, EventArgs e)
{

System.Diagnostics.Process[] proc = System.Diagnostics.Process.GetProcessesByName("SisenMESS");
//关闭原有应用程序的所有进程
foreach (System.Diagnostics.Process pro in proc)
{
pro.Kill();
}

XmlDocument doc = new XmlDocument();
doc.Load(Application.StartupPath + @"\update.xml");
XmlElement root = doc.DocumentElement;
XmlNode updateNode = root.SelectSingleNode("filelist");
string path = updateNode.Attributes["sourcepath"].Value;
int count = int.Parse(updateNode.Attributes["count"].Value);
for (int i = 0; i < count; i++)
{
XmlNode itemNode = updateNode.ChildNodes[i];
string fileName = itemNode.Attributes["name"].Value;
FileInfo fi = new FileInfo(fileName);
fi.Delete();
//File.Delete(Application.StartupPath + @"\" + fileName);
this.label1.Text = "正在更新: " + fileName + " (" + itemNode.Attributes["size"].Value + " ...";

FileStream fs = File.Open(fileName, FileMode.Create, FileAccess.Write);

fs.Write(System.Convert.FromBase64String(itemNode.SelectSingleNode("val").InnerText), 0, int.Parse(itemNode.Attributes["size"].Value));

fs.Close();
}
label1.Text = "更新完成";
File.Delete(Application.StartupPath + @"\update.xml");
label1.Text = "正在重新启动应用程序...";
System.Diagnostics.Process.Start("SisenMESS.exe");
Close();
Application.Exit();
}

请问如何能使程序边执行边显示winform的界面。。
...全文
88 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
wl_851110 2010-10-16
  • 打赏
  • 举报
回复
太过分了 、、、 这样也逼我结贴、、
wl_851110 2010-10-09
  • 打赏
  • 举报
回复
具体点啊。。 或者异步也可以?
charles_y 2010-10-09
  • 打赏
  • 举报
回复
使用多线程

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧