private void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { userInfoBackup(); Uninstall(); Labeldelegate dele = new Labeldelegate(changeLabelText); Invoke(dele, new object[]{"WeDo 업데이트중..."}); }
private void Uninstall() { try { Labeldelegate dele = new Labeldelegate(changeLabelText); Invoke(dele, new object[] { "기존프로그램 삭제중" }); //File.Copy(localDir + backupFileName, "C:\\temp\\" + backupFileName, true); Installer wi = (Installer)Activator.CreateInstance(Type.GetTypeFromProgID("WindowsInstaller.Installer")); StringList sl = wi.Products; foreach (string pn in sl) { string pc = wi.get_ProductInfo(pn, "ProductName"); if (pc.Equals(productName)) { pro = new Process(); pro.StartInfo.FileName = "msiexec.exe"; pro.StartInfo.Arguments = "/x " + pn + " /passive"; pro.Exited += new EventHandler(uninstall_Exited); pro.EnableRaisingEvents = true; pro.Start(); } } } catch (Exception ex) { logFileWrite(ex.ToString()); } }