private void CheckForUpdates(bool suppressNonUpdate = false) { try { UpdateService service = new UpdateService(Application.ProductVersion); service.CheckForUpdateAsync(); this.tslblStatus.Text = "正在检查更新..."; while (true) { if (service.AsyncState != UpdateService.AsyncStates.Working) { if ((service.Exceptions.Count > 0) && (service.Exceptions.Peek() != null)) { throw service.Exceptions.Pop(); } switch (service.NewVersionInfo.Status) { case UpdateResult.CurrentVersion: if (!suppressNonUpdate) { MessageBox.Show("你的WinVisible是最新版本!", "信息", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } break; case UpdateResult.NewerAvailable: if (MessageBox.Show("发现新版本。是否下载下载?", "确认", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Services.NavigateToUrl(service.NewVersionInfo.DownloadUrl); } break; default: break; } break; } Application.DoEvents(); } } catch (Exception exception) { if (!suppressNonUpdate) { this.ShowError(exception, false); } } this.tslblStatus.Text = "已就位"; }