internal static void CreateAndShowDialog(Version current, GitHub.OnlineVersion available, Form parent) { using (NewVersionForm f = new NewVersionForm()) { f.mDownloadUrl = available.DownloadUrl; f.mPageUrl = available.HtmlUrl; f.LblCurrentVersion.Text = current.ToString(3); f.LblLatestVersion.Text = available.Version.ToString(3); if (available.IsPreRelease) { f.LblLatestVersion.Text = f.LblLatestVersion.Text + " pre-release"; } DialogResult rv = f.ShowDialog(parent); if (rv == DialogResult.OK) { System.Windows.Forms.Application.Exit(); //exit (spawned process will apply update) } else if (rv == DialogResult.Abort) { System.Windows.Forms.MessageBox.Show(Strings.BoxAutoUpdateFailed, Strings.BoxAutoUpdateResult, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
void GitHub_NewVersion(Version current, GitHub.OnlineVersion available, Exception error) { if (InvokeRequired) { Invoke(new GitHub.NewVersionDlg(GitHub_NewVersion), current, available, error); } else { if (error != null) { MessageBox.Show(this, "Cannot check for new version, please verify http://lasergrbl.com manually.", "Software info", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } else if (available != null) { NewVersionForm.CreateAndShowDialog(current, available, this); } else { MessageBox.Show(this, "You have the most updated version!", "Software info", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } }