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, Version latest, string name, string url) { if (InvokeRequired) { Invoke(new GitHub.NewVersionDlg(GitHub_NewVersion), current, latest, name, url); } else { NewVersionForm.CreateAndShowDialog(current, latest, name, url, this); } }
internal static void CreateAndShowDialog(Version current, Version latest, string name, string url, Form parent) { using (NewVersionForm f = new NewVersionForm(url)) { f.LblCurrentVersion.Text = current.ToString(3); f.LblLatestVersion.Text = latest.ToString(3); 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); } } }
internal static void CreateAndShowDialog(Version current, Version latest, string name, string url, Form parent) { using (NewVersionForm f = new NewVersionForm(url)) { f.LblCurrentVersion.Text = current.ToString(3); f.LblLatestVersion.Text = latest.ToString(3); DialogResult rv = f.ShowDialog(parent); if (rv == DialogResult.OK && System.Windows.Forms.MessageBox.Show("Update success! Please restart LaserGRBL to apply update.\r\nRestart now?", "Update result", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == System.Windows.Forms.DialogResult.OK) { System.Windows.Forms.Application.Restart(); } else if (rv == DialogResult.Abort) { System.Windows.Forms.MessageBox.Show("Update fail!\r\nPlease download the new version from lasergrbl site.", "Update result", MessageBoxButtons.OKCancel, 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); } } }