private void btnUpdateCheck_Click(object sender, EventArgs e) { taskt.Core.ApplicationUpdate updater = new Core.ApplicationUpdate(); Core.UpdateManifest manifest = new Core.UpdateManifest(); try { manifest = updater.GetManifest(); } catch (Exception ex) { MessageBox.Show("Error getting manifest: " + ex.ToString()); return; } if (manifest.RemoteVersionNewer) { Supplement_Forms.frmUpdate frmUpdate = new Supplement_Forms.frmUpdate(manifest); if (frmUpdate.ShowDialog() == DialogResult.OK) { //move update exe to root folder for execution var updaterExecutionResources = Application.StartupPath + "\\resources\\taskt-updater.exe"; var updaterExecutableDestination = Application.StartupPath + "\\taskt-updater.exe"; if (!System.IO.File.Exists(updaterExecutionResources)) { MessageBox.Show("taskt-updater.exe not found in resources directory!"); return; } else { System.IO.File.Copy(updaterExecutionResources, updaterExecutableDestination); } var updateProcess = new System.Diagnostics.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); } }
public frmUpdate(Core.UpdateManifest manifest) { InitializeComponent(); lblLocal.Text = "your version: " + manifest.LocalVersionProper.ToString(); lblRemote.Text = "latest version: " + manifest.RemoteVersionProper.ToString(); }