private void RefreshProjectData(WorkUnitProteinUpdateScope scope) { var result = MessageBox.AskYesNoQuestion(Form, "Are you sure? This operation cannot be undone.", Core.Application.NameAndVersion); if (result == DialogResult.No) { return; } long id = 0; if (scope == WorkUnitProteinUpdateScope.Project) { id = Model.SelectedWorkUnitRow.ProjectID; } else if (scope == WorkUnitProteinUpdateScope.Id) { id = Model.SelectedWorkUnitRow.ID; } var proteinDataUpdater = new ProteinDataUpdater((IWorkUnitDatabase)Model.Repository, ProteinService); try { using (var dialog = new ProgressDialog((progress, token) => proteinDataUpdater.Execute(progress, scope, id, token), true)) { dialog.Text = Core.Application.NameAndVersion; dialog.ShowDialog(Form); if (dialog.Exception != null) { Logger.Error(dialog.Exception.Message, dialog.Exception); MessageBox.ShowError(Form, dialog.Exception.Message, Core.Application.NameAndVersion); } } Model.ResetBindings(true); } catch (Exception ex) { Logger.Error(ex.Message, ex); MessageBox.ShowError(Form, ex.Message, Core.Application.NameAndVersion); } }