/// <summary> /// 更新更新程序 /// </summary> public static void updateApp() { try { string updatePath = System.Environment.CurrentDirectory; logger("更新程序路径:" + updatePath); //确定更新程序版本 if (!updatePath.Contains("3.1")) { logger("开始更新更新程序"); string configPath = @"D:\appliaction\UpdateProjectSharding\InletWindow.exe.config"; string dir = System.AppDomain.CurrentDomain.BaseDirectory + "UpdateInletWindow"; string path = @"D:\appliaction\UpdateProjectTV-G3.1\InletWindow.exe"; string newdir = @"D:\appliaction\UpdateProjectTV-G3.1"; if (System.IO.Directory.Exists(newdir)) { System.IO.Directory.Delete(newdir); } System.IO.Directory.CreateDirectory(newdir); CopyFolder(dir, newdir); File.Copy(configPath, newdir + @"\InletWindow.exe.config"); string copy = System.AppDomain.CurrentDomain.BaseDirectory + @"InletWindow.exe"; ComputerBLL.StartApp(path); Thread.Sleep(1000 * 10); ComputerBLL.Restart(); } } catch (Exception ex) { logger("error:updateApp:" + ex.Message); } }
private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { var ex = e.ExceptionObject as Exception; if (ex != null) { logger("Error:CurrentDomain_UnhandledException:" + ex.Message + Environment.NewLine + ex.InnerException.ToString()); ComputerBLL.Restart(); } }
private void 确定_Click(object sender, RoutedEventArgs e) { ComputerBLL.Restart(); }