private void btnUpdateCheck_Click(object sender, EventArgs e) { ManifestUpdate manifest = new ManifestUpdate(); try { manifest = ManifestUpdate.GetManifest(); } catch (Exception ex) { MessageBox.Show("Error getting manifest: " + ex.ToString()); return; } if (manifest.RemoteVersionNewer) { frmUpdate frmUpdate = new frmUpdate(manifest); if (frmUpdate.ShowDialog() == DialogResult.OK) { frmUpdating frmUpdating = new frmUpdating(manifest.PackageURL); frmUpdating.ShowDialog(); frmUpdating.Dispose(); } frmUpdate.Dispose(); } else { MessageBox.Show("The application is currently up-to-date!", "No Updates Available", MessageBoxButtons.OK); } }
private void btnUpdateCheck_Click(object sender, EventArgs e) { ManifestUpdate manifest = new ManifestUpdate(); try { manifest = ManifestUpdate.GetManifest(); } catch (Exception ex) { MessageBox.Show("Error getting manifest: " + ex.ToString()); return; } if (manifest.RemoteVersionNewer) { frmUpdate frmUpdate = new frmUpdate(manifest); if (frmUpdate.ShowDialog() == DialogResult.OK) { //move update exe to root folder for execution var updaterExecutionResources = Application.StartupPath + "\\resources\\OpenBots.Updater.exe"; var updaterExecutableDestination = Application.StartupPath + "\\OpenBots.Updater.exe"; if (!File.Exists(updaterExecutionResources)) { MessageBox.Show("OpenBots.Updater.exe not found in resources directory!"); return; } else { File.Copy(updaterExecutionResources, updaterExecutableDestination); } var updateProcess = new Process(); updateProcess.StartInfo.FileName = updaterExecutableDestination; updateProcess.StartInfo.Arguments = manifest.PackageURL; updateProcess.Start(); Application.Exit(); } } else { MessageBox.Show("The application is currently up-to-date!", "No Updates Available", MessageBoxButtons.OK); } }