Esempio n. 1
0
        private void ImportArchive(ImportSettings iSettings)
        {
            if (ConnectionDetail.OrganizationMajorVersion == 8)
            {
                if (DialogResult.No == MessageBox.Show(ParentForm,
                                                       "This plugin has not been tested with CRM 2016 yet, especially regarding new solution framework\r\n\r\nAre you sure you want to continue?",
                                                       "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                {
                    return;
                }
            }

            sManager = new SolutionManager(Service);
            iSettings.MajorVersion = ConnectionDetail.OrganizationMajorVersion;

            currentOperationId = iSettings.ImportId;

            EnableControls(false);

            WorkAsync(new WorkAsyncInfo
            {
                Message       = "Importing solution...",
                AsyncArgument = iSettings,
                Work          = (bw, e) =>
                {
                    var settings = (ImportSettings)e.Argument;

                    // Launch a new thread to monitor import status
                    if (settings.IsFolder)
                    {
                        sManager.ImportSolutionFolder(settings);
                    }
                    else
                    {
                        sManager.ImportSolutionArchive(settings.Path, settings);
                    }

                    if (((ImportSettings)e.Argument).Publish)
                    {
                        bw.ReportProgress(101, "Publishing solution...");
                        sManager.PublishAll();
                    }
                },
                PostWorkCallBack = e =>
                {
                    if (e.Error != null)
                    {
                        var eForm = new ErrorForm(e.Error.Message);
                        eForm.ShowDialog();
                    }

                    EnableControls(true);
                },
                ProgressChanged = e => { SetWorkingMessage(e.ProgressPercentage <= 100 ? "Importing solution..." : "Publishing solution..."); }
            });
        }
Esempio n. 2
0
        private void ImportArchive(ImportSettings iSettings)
        {
            sManager = new SolutionManager(Service);
            iSettings.MajorVersion = ConnectionDetail.OrganizationMajorVersion;

            currentOperationId = iSettings.ImportId;

            EnableControls(false);

            WorkAsync(new WorkAsyncInfo
            {
                Message       = "Importing solution...",
                AsyncArgument = iSettings,
                Work          = (bw, e) =>
                {
                    var settings = (ImportSettings)e.Argument;

                    // Launch a new thread to monitor import status
                    if (settings.IsFolder)
                    {
                        sManager.ImportSolutionFolder(settings);
                    }
                    else
                    {
                        sManager.ImportSolutionArchive(settings.Path, settings);
                    }

                    if (((ImportSettings)e.Argument).Publish)
                    {
                        bw.ReportProgress(101, "Publishing solution...");
                        sManager.PublishAll();
                    }
                },
                PostWorkCallBack = e =>
                {
                    if (e.Error != null)
                    {
                        var eForm = new ErrorForm(e.Error.Message);
                        eForm.ShowDialog();
                    }

                    EnableControls(true);
                },
                ProgressChanged = e => { SetWorkingMessage(e.ProgressPercentage <= 100 ? "Importing solution..." : "Publishing solution..."); }
            });
        }
Esempio n. 3
0
        private void ImportArchive(ImportSettings iSettings)
        {
            if (ConnectionDetail.OrganizationMajorVersion == 8)
            {
                if (DialogResult.No == MessageBox.Show(ParentForm,
                        "This plugin has not been tested with CRM 2016 yet, especially regarding new solution framework\r\n\r\nAre you sure you want to continue?",
                        "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning))
                {
                    return;
                }
            }

            sManager = new SolutionManager(Service);
            iSettings.MajorVersion = ConnectionDetail.OrganizationMajorVersion;

            currentOperationId = iSettings.ImportId;

            EnableControls(false);

            WorkAsync(new WorkAsyncInfo
            {
                Message = "Importing solution...",
                AsyncArgument = iSettings,
                Work = (bw, e) =>
                {
                    var settings = (ImportSettings)e.Argument;

                    // Launch a new thread to monitor import status
                    if (settings.IsFolder)
                    {
                        sManager.ImportSolutionFolder(settings);
                    }
                    else
                    {
                        sManager.ImportSolutionArchive(settings.Path, settings);
                    }

                    if (((ImportSettings)e.Argument).Publish)
                    {
                        bw.ReportProgress(101, "Publishing solution...");
                        sManager.PublishAll();
                    }
                },
                PostWorkCallBack = e =>
                {
                    if (e.Error != null)
                    {
                        var eForm = new ErrorForm(e.Error.Message);
                        eForm.ShowDialog();
                    }

                    EnableControls(true);
                },
                ProgressChanged = e => { SetWorkingMessage(e.ProgressPercentage <= 100 ? "Importing solution..." : "Publishing solution..."); }
            });
        }
Esempio n. 4
0
        private void ImportArchive(ImportSettings iSettings)
        {
            sManager = new SolutionManager(Service);
            iSettings.MajorVersion = ConnectionDetail.OrganizationMajorVersion;

            currentOperationId = iSettings.ImportId;

            EnableControls(false);

            WorkAsync("Importing solution...",
                (bw, e) =>
                {
                    var settings = (ImportSettings)e.Argument;

                    // Launch a new thread to monitor import status
                    if (settings.IsFolder)
                    {
                        sManager.ImportSolutionFolder(settings);
                    }
                    else
                    {
                        sManager.ImportSolutionArchive(settings.Path, settings);
                    }

                    if (((ImportSettings)e.Argument).Publish)
                    {
                        bw.ReportProgress(101, "Publishing solution...");
                        sManager.PublishAll();
                    }
                },
                e =>
                {
                    if (e.Error != null)
                    {
                        var eForm = new ErrorForm(e.Error.Message);
                        eForm.ShowDialog();
                    }

                    EnableControls(true);
                },
                e => SetWorkingMessage(e.ProgressPercentage <= 100 ? "Importing solution..." : "Publishing solution..."),
                iSettings);
        }