示例#1
0
        private void MergeWithSuperSolutions()
        {
            string defaultPath = GetDefaultZipPath();
            var    path        = FileDialogManager.SelectPath(defaultPath);

            path = StringFormatter.GetPathWithLastSlash(path);

            SetDialog("Merging...");

            ThreadManager.Instance.ScheduleTask(() =>
            {
                var isError             = false;
                var errorMessage        = string.Empty;
                var mappingsWithBackpus = new Dictionary <string, string>();
                try
                {
                    UpdateDialogMessage($"Publishing all customizations...");
                    CurrentSolutionManager.PublishAll();
                    List <Solution> affectedSuperSolutions = GetAffectedSuperSolutions();
                    UpdateDialogMessage($"Cloning affected solutions... ({affectedSuperSolutions.Count})");
                    mappingsWithBackpus = CloneAffectedSolutions(affectedSuperSolutions);
                    CleanAndMergeSourceSolutions(affectedSuperSolutions, mappingsWithBackpus);
                    RemovedClonedBackupSolutions(affectedSuperSolutions, mappingsWithBackpus);
                    UpdateDialogMessage($"Exporting affected solutions...");
                    ExportAffectedSuperSolutions(affectedSuperSolutions, path);
                }
                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
                    {
                        _window.Close();
                    }
                    UnsetDialog();
                });
            }, string.Empty, _mergeTaskId);
        }