private async void CheckForUpdates() { var latest = await updateService.GetLatestAsync(); if (latest == null) { return; } await Dispatcher.BeginInvoke((Action) delegate { HasNewUpdate = latest.IsNewUpdate; UpdateName = latest.ClientName; UpdateLink = latest.DownloadLink; ApplicationSettings.SlimCatChannelId = latest.SlimCatChannelId; OnPropertyChanged("HasNewUpdate"); OnPropertyChanged("UpdateName"); OnPropertyChanged("UpdateLink"); }); var updated = await updateService.TryUpdateAsync(); await Dispatcher.BeginInvoke((Action) delegate { UpdateFailed = !updated; UpdateCompleted = true; OnPropertyChanged("UpdateFailed"); OnPropertyChanged("UpdateCompleted"); }); }
private async void CheckForUpdates() { var latest = await updateService.GetLatestAsync(); await Dispatcher.BeginInvoke((Action) delegate { HasNewUpdate = latest.IsNewUpdate; UpdateName = latest.ClientName; UpdateLink = latest.DownloadLink; UpdateBuildTime = latest.PublishDate; ChangeLog = latest.ChangelogLink; OnPropertyChanged("HasNewUpdate"); OnPropertyChanged("UpdateName"); OnPropertyChanged("UpdateLink"); OnPropertyChanged("UpdateBuildTime"); OnPropertyChanged("ChangeLog"); }); if (!latest.IsNewUpdate) { return; } var updated = await updateService.TryUpdateAsync(); var message = "Automatic update successful, restart to finish applying updates."; if (!updated) { message = "Automatic update failed, please install update manually."; } Events.NewError(message); }