private void ReloadSolutionComponentFromAggregatedSolution(AggregatedSolution aggregatedSolution) { SetDialog("Retrieving components..."); ThreadManager.Instance.ScheduleTask(() => { var isError = false; var errorMessage = string.Empty; List <MergedInSolutionComponent> mergedSolutionComponents = new List <MergedInSolutionComponent>(); var workSolutions = new List <WorkSolution>(); try { workSolutions = CurrentSolutionManager.GetWorkSolutions(aggregatedSolution); mergedSolutionComponents = CurrentSolutionManager.GetMergedSolutionComponents(workSolutions, true); } catch (Exception ex) { isError = true; errorMessage = ex.Message; } System.Windows.Application.Current.Dispatcher.Invoke(() => { if (isError) { MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { WorkSolutions = workSolutions; SolutionComponents = mergedSolutionComponents; } UnsetDialog(); }); }, "Retrieving components...", _reloadComponentsTaskId); }
private void CleanAndMergeSourceSolutions(List <Solution> affectedSuperSolutions, Dictionary <string, string> mappings) { foreach (var item in affectedSuperSolutions) { UpdateDialogMessage($"Cleaning source solution {item.UniqueName}..."); CurrentSolutionManager.CleanSolution(item.Id); UpdateDialogMessage($"Merging new result in source solution {item.UniqueName}..."); var sourceKey = item.UniqueName; var backupKey = mappings[sourceKey]; var backupSolution = CurrentSolutionManager.GetSolution(backupKey); var componentsInBackupSolution = CurrentSolutionManager.GetSolutionComponents(backupSolution.Id, false); UpdateDialogMessage($"Calculating new components for {item.UniqueName}..."); var componentsForThisSolution = GetSolutionComponentsForSolution(item).Cast <SolutionComponentBase>().ToList(); var allComponents = new List <SolutionComponentBase>(); allComponents.AddRange(componentsInBackupSolution); allComponents.AddRange(componentsForThisSolution); var newSuperSolutionComponents = CurrentSolutionManager .GetMergedSolutionComponents(allComponents); UpdateDialogMessage($"Adding components to supersolution {item.UniqueName}..."); CurrentSolutionManager.CreateMergedSolution(item.Id, newSuperSolutionComponents); UpdateDialogMessage($"Increasing revision version of {item.UniqueName}..."); CurrentSolutionManager.IncreaseSolutionRevisionVersion(item.Id); item.Version = CurrentSolutionManager.GetSolutionVersion(item.Id); } }