private void Update(object parameter) { Task.Factory.StartNew(() => { canExecute = false; this.Dispatcher.Invoke(new Action(() => { BtnContent = "正在下载升级包,请等待..."; })); UpdateRequest updateRequest = CheckUpdateHelper.GetUploadRequest(); if (updateRequest != null) { Application.Current.Dispatcher.BeginInvoke(new Action(() => { if (MessageBoxHelper.MessageBoxShowQuestion($"检测到新版本{updateRequest.Version}[当前版本{EnvironmentInfo.CurrentVersion}],是否立即升级?") == MessageBoxResult.Yes) { CheckUpdateHelper.ExecuteUpdate(updateRequest); } })); } canExecute = true; this.Dispatcher.Invoke(new Action(() => { BtnContent = "立即升级"; })); }); }