private void _getUpdateInfoButton_Click(object sender, EventArgs e) { _updateButton.Enabled = false; this.Cursor = Cursors.WaitCursor; if (FromGithub.TryGetLatestRelease(OWNER, PROJECT, out var latestRelease, out string errorMessage)) { MessageBox.Show($"{latestRelease.Name}/{latestRelease.TagName}", "获取成功", MessageBoxButtons.OK, MessageBoxIcon.Information); _updateButton.Enabled = true; }
/// <summary> /// 获取更新信息 /// </summary> public async void GetLatestReleaseInfo() { await Task.Factory.StartNew(() => { if (!FromGithub.TryGetLatestRelease(UpdateArgs.Username, UpdateArgs.Project, out _currentLatestRelease, out var msg)) { OnUpdateStatusChanged(new UpdateStatusChangedEventArgs(UpdateStatus.Error, msg)); return; } //为用户界面组装一条更新信息 var infoBuilder = BuildUpdateTipInfo(_currentLatestRelease); OnUpdateStatusChanged(new UpdateStatusChangedEventArgs(UpdateStatus.GetLatestReleaseCompleted, infoBuilder.ToString())); }); }