示例#1
0
        private void ExportSolutionToPath(string path, Solution solution, bool managed)
        {
            var fileName = StringFormatter.GetSolutionFileName(solution.UniqueName, solution.Version, managed);
            var fullPath = string.Format("{0}{1}", path, fileName);

            SetDialog($"Exporting solution '{solution.UniqueName}' managed={managed}...");
            CurrentSolutionManager.ExportSolution(solution.UniqueName, fullPath, managed);
            if (BlobService.IsEnabledBlobStorage())
            {
                SetDialog($"Uploading to BlobStorage '{solution.UniqueName}' managed={managed}...");
                BlobService.Upload(solution.UniqueName, fullPath);
            }
        }
示例#2
0
        private void CheckDependencies()
        {
            SetDialog("Checking dependencies...");
            ThreadManager.Instance.ScheduleTask(() =>
            {
                var isError      = false;
                var errorMessage = string.Empty;
                //var clonedSolutionId = Guid.Empty;
                try
                {
                    SetDialog("Connecting to destination environment...");
                    var stringConnection       = DestinationCrmConnection.GetStringConnetion(); var solution = CurrentSolutionManager.GetSolution(WorkSolution.SolutionId);
                    DestinationService         = CrmDataProvider.GetService(stringConnection);
                    DestinationSolutionManager = new SolutionManager(DestinationService); var path = Path.GetTempPath();

                    SetDialog("Downloading solution...");

                    var filePath = $@"{path}{solution.UniqueName}.zip";
                    CurrentSolutionManager.ExportSolution(solution.UniqueName, filePath, true);
                    SetDialog("Importing solution in destionation environment...");
                    DestinationSolutionManager.ImportSolution(filePath, false, false, false);
                    SetDialog("Removing solution from destination environment...");
                    DestinationSolutionManager.RemoveSolution(solution.UniqueName);
                    CurrentSolutionManager.SetDependenciesOKForWorkSolution(WorkSolution.Id);
                }
                catch (Exception ex)
                {
                    isError      = true;
                    errorMessage = ex.Message;
                }
                System.Windows.Application.Current.Dispatcher.Invoke(() =>
                {
                    if (isError)
                    {
                        CurrentSolutionManager.SetDependenciesKOForWorkSolution(WorkSolution.Id, errorMessage);
                        MessageBox.Show(errorMessage, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        //this.ClonedSolutionId = clonedSolutionId;
                        _window.Close();
                    }
                    UnsetDialog();
                });
            }, "Cloning solution...", _checkDependenciesTaskId);
        }