private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) { e.Handled = true; ShutdownApplication("Unhandled exception", e.Exception); WC?.Dispose(); ClearTemp(); }
/// <summary> /// 实现关闭进度条事件 /// </summary> private void FrmUpdate_closeProgress() { if (this.InvokeRequired) { this.Invoke(new CloseProgressDelegate(FrmUpdate_closeProgress)); } else { if (WC != null) { WC.Dispose(); } if (Zips.Length > 0) { MessageBox.Show("升级成功!"); } else { MessageBox.Show("未找到升级包!"); } string updateini = System.Configuration.ConfigurationManager.ConnectionStrings["UPDATE"].ConnectionString; if (string.IsNullOrEmpty(updateini)) { updateini = "Update.ini"; } IniClass ini = new IniClass(System.IO.Path.Combine(Application.StartupPath, updateini)); string serviceVersion = Service.GetVersion(); //服务端版本 ini.IniWriteValue("update", "version", serviceVersion); //更新成功后将版本写入配置文件 Application.Exit(); var mainexe = System.Configuration.ConfigurationManager.ConnectionStrings["MAIN"].ConnectionString; if (string.IsNullOrEmpty(mainexe)) { mainexe = "ZtopTodo.exe"; } Process.Start(mainexe); } }
private void App_OnExit(object sender, ExitEventArgs e) { WC?.Dispose(); ClearTemp(); }