private void timer1_Tick(object sender, EventArgs e) { this.timer1.Interval = 1000000; string _ip = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "ip")); string _id = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "id")); string _pwd = Securit.DeDES(FileReadAndWrite.IniReadValue("ftpfile", "pwd")); fileUpDown = new FileUpDown(_ip, _id, _pwd); string thePreUpdateDate = GetThetUpdateVersionNum(CommonStaticParameter.TEMP); File.Copy(CommonStaticParameter.TEMP + "\\UpdateConfig.xml", System.Windows.Forms.Application.StartupPath + "\\UpdateConfig.xml", true); //关闭原有的应用程序 this.labDownFile.Text = "正在关闭程序...."; System.Diagnostics.Process[] proc = System.Diagnostics.Process.GetProcessesByName("WorkLogForm"); //关闭原有应用程序的所有进程 foreach (System.Diagnostics.Process pro in proc) { pro.Kill(); } this.labDownFile.Text = "下载更新文件"; this.progressBar.Value = 0; BatchDownload(); MessageBox.Show("更新成功!"); this.labDownFile.Text = "正在启动程序...."; System.Diagnostics.Process.Start(Application.StartupPath + "\\" + "WorkLogForm.exe"); this.timer1.Stop(); this.Close(); }