private void RefreshStatus(StatusReport report, ProgressContext progressContext) { try { if (report.IsProgressReport()) { Progress = int.Parse(report.Message); progressContext.SetProgress((uint)Progress); } else { _statusReports.Add(report); } } catch (Exception ex) { _statusReports.Add(StatusReport.CreateOperation("Malformated package. " + ex.Message, MessageLevel.Error, OperationType.None)); } }
private async void ExecuteReserialize() { if (SelectedConnection == null) { MessageBox.Show("Please select connection.", "No connection", MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } await ExecuteSafe(async t => { ResetState(); using (var progressContext = new ProgressContext(StatusBar, "Serializing")) { var legacySynchronizeCommand = new ReserializeCommand(SelectedConnection, SelectedConfigurations, t, s => _dispatcher.Invoke(() => RefreshStatus(s, progressContext))); await UnicornCommandsManager.Execute(legacySynchronizeCommand) .ConfigureAwait(false); } }, $"{SelectedConnection} has been serialized", "Serialization failed").ConfigureAwait(false); }