private void buttonChangeTarget_Click(object sender, EventArgs e)
        {
            LogInfo("Clicked on Target Change button.");
            if (AdditionalConnectionDetails.Any())
            {
                RemoveAdditionalOrganization(TargetConnection);
            }

            AddAdditionalOrganization();
        }
Пример #2
0
        private void TsbTransfertSolutionClick(object sender, EventArgs e)
        {
            if (mForm.SelectedSolutions.Count == 0 || !AdditionalConnectionDetails.Any())
            {
                MessageBox.Show(@"You have to select a source solution and a target organization to continue.", @"Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            var solutionsToTransfer = PreparareSolutionsToTransfer();

            if (solutionsToTransfer.Count == 0)
            {
                return;
            }

            var requests = new List <OrganizationRequest>();

            progressItems = new Dictionary <OrganizationRequest, ProgressItem>();
            toProcessList = new List <BaseToProcess>();

            foreach (var solution in solutionsToTransfer)
            {
                var exportItem = new ExportToProcess
                {
                    Solution = solution,
                    Previous = toProcessList.OfType <ExportToProcess>().LastOrDefault(),
                    Request  = PrepareExportRequest(solution),
                    Detail   = sourceDetail
                };
                toProcessList.Add(exportItem);

                foreach (var detail in AdditionalConnectionDetails)
                {
                    toProcessList.Add(new ImportToProcess
                    {
                        Solution = solution,
                        Previous = toProcessList.OfType <ImportToProcess>().LastOrDefault(x => x.Detail == detail),
                        Export   = exportItem,
                        Request  = PrepareImportRequest(detail, solution),
                        Detail   = detail
                    });
                }
            }

            if (!Settings.Instance.Managed && Settings.Instance.Publish)
            {
                foreach (var detail in AdditionalConnectionDetails)
                {
                    toProcessList.Add(new PublishToProcess
                    {
                        Request = PreparePublishRequest(detail),
                        Detail  = detail
                    });
                }
            }

            // Add items to progress form
            pForm.Items = progressItems.Values.ToList();
            pForm.Start();

            pForm.Show(dpMain, DockState.DockRight);

            ToggleWaitMode(true);

            StartExport(toProcessList.OfType <ExportToProcess>().First());

            timer.Elapsed += Timer_Elapsed;
            timer.Interval = Settings.Instance.RefreshIntervalProp.TotalMilliseconds;
            timer.Start();
        }
        private void TsbTransfertSolutionClick(object sender, EventArgs e)
        {
            if (lstSourceSolutions.SelectedItems.Count > 0 && AdditionalConnectionDetails.Any())
            {
                var item = lstSourceSolutions.SelectedItems[0];

                var solutionsToTransfer = new List <string>();
                if (lstSourceSolutions.SelectedItems.Count > 1)
                {
                    // Open dialog to order solutions import
                    foreach (ListViewItem sourceItem in lstSourceSolutions.SelectedItems)
                    {
                        solutionsToTransfer.Add(sourceItem.Text);
                    }

                    var dialog = new SolutionOrderDialog(solutionsToTransfer);
                    if (dialog.ShowDialog(ParentForm) == DialogResult.OK)
                    {
                        solutionsToTransfer = dialog.Solutions;
                    }
                    else
                    {
                        return;
                    }
                }
                else
                {
                    solutionsToTransfer.Add(item.Text);
                }

                infoPanel = InformationPanel.GetInformationPanel(this, "Initializing...", 340, 120);

                var requests = new List <OrganizationRequest>();

                foreach (var solution in solutionsToTransfer)
                {
                    var importId = Guid.NewGuid();

                    requests.Add(new ExportSolutionRequest
                    {
                        Managed      = chkExportAsManaged.Checked,
                        SolutionName = solution,
                        ExportAutoNumberingSettings          = chkAutoNumering.Checked,
                        ExportCalendarSettings               = chkCalendar.Checked,
                        ExportCustomizationSettings          = chkCustomization.Checked,
                        ExportEmailTrackingSettings          = chkEmailTracking.Checked,
                        ExportGeneralSettings                = chkGeneral.Checked,
                        ExportIsvConfig                      = chkIsvConfig.Checked,
                        ExportMarketingSettings              = chkMarketing.Checked,
                        ExportOutlookSynchronizationSettings = chkOutlookSynchronization.Checked,
                        ExportRelationshipRoles              = chkRelationshipRoles.Checked
                    });

                    requests.Add(new ImportSolutionRequest
                    {
                        ConvertToManaged = chkConvertToManaged.Checked,
                        OverwriteUnmanagedCustomizations = chkOverwriteUnmanagedCustomizations.Checked,
                        PublishWorkflows = chkActivate.Checked,
                        ImportJobId      = importId
                    });
                }

                if (!chkExportAsManaged.Checked && chkPublish.Checked)
                {
                    requests.Add(new PublishAllXmlRequest());
                }

                tsbDownloadLogFile.Enabled         = false;
                tsbFindMissingDependencies.Enabled = false;
                tsbLoadSolutions.Enabled           = false;
                tsbTransfertSolution.Enabled       = false;
                btnAddTarget.Enabled = false;
                Cursor = Cursors.WaitCursor;

                using (var worker = new BackgroundWorker())
                {
                    worker.DoWork               += WorkerDoWorkExport;
                    worker.ProgressChanged      += WorkerProgressChanged;
                    worker.RunWorkerCompleted   += WorkerRunWorkerCompleted;
                    worker.WorkerReportsProgress = true;
                    worker.RunWorkerAsync(requests);
                }
            }
            else
            {
                MessageBox.Show("You have to select a source solution and a target organization to continue.", "Warning",
                                MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }