private void CheckForUpdates()
{
try
{
string dataDownload = (string)BusyDialog.Show("Please wait while we check for updates...", new BusyDialog.ProcessingHandler(DownloadUpdateStatusThread), null);
XmlDocument doc = new XmlDocument();
doc.LoadXml(dataDownload);
string newVersionName;
VersionCheckStatus status = CompareVersionWithXML(doc, "latest_version_number_full", "latest_version_number", out newVersionName);
if (status == VersionCheckStatus.ServerNewer)
{
if (_guiController.ShowQuestion("A newer version of AGS (" + newVersionName + ") is available on the AGS website. Would you like to go there now?") == DialogResult.Yes)
{
LaunchBrowserAtAGSDownloadPage();
}
}
else if (status == VersionCheckStatus.ThisNewer)
{
// This is newer than the website version, so it must be a beta
// version. So, see if a newer beta is available.
status = CompareVersionWithXML(doc, "development_version_number_full", "development_version_number", out newVersionName);
if (status == VersionCheckStatus.ServerNewer)
{
if (_guiController.ShowQuestion("A newer in-development version of AGS (" + newVersionName + ") is available on the AGS forums. Would you like to go there now?") == DialogResult.Yes)
{
LaunchBrowserAtPage(GetPageURL(doc, "development_version_thread"));
}
}
else
{
_guiController.ShowMessage("There are no further in-development updates at this time.", MessageBoxIcon.Information);
}
}
else
{
_guiController.ShowMessage("This version of AGS is up to date.", MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
_guiController.ShowMessage("Unable to check for updates. Your internet connection may be down, or server response had mistakes.\nPlease visit the AGS website to see if an updated version is available.\n\nError details: " + ex.Message, MessageBoxIcon.Warning);
}
}