private void PerformUpdateCheck()
{
var uc = new UpdateChecker();
uc.AlreadyLatest += (o, e) => UpdateStatus("already latest version", 100);
uc.Connected += (o, e) => UpdateStatus("connected", 10);
uc.DownloadProgressChanged += (o, e) => { /* care, xml is small anyway */ };
uc.UpdateCheckFailed += (o, e) => UpdateStatus("update check failed", 100);
uc.UpdateAvailable += (o, e) =>
{
UpdateStatus("update available", 100);
var dr =
MessageBox.Show(
string.Format(
"An update to version {0} released on {1} is available. Release notes: \r\n\r\n{2}\r\n\r\nUpdate now?",
e.Version.ToString(), e.ReleaseDate.ToShortDateString(), e.ReleaseNotes), "Update available",
MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
if (dr == DialogResult.Yes)
{
DownloadAndUpdate(e.DownloadUrl);
}
};
uc.CheckVersion();
}