public override void Execute(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            Assert.ArgumentNotNull(context.Items, "context.Items");

            if (context.Items.Length <= 0 || context.Items[0] == null)
            {
                return;
            }

            if (MigrationManager.Providers[context.Parameters["provider"]] == null)
            {
                SheerResponse.Alert(Translations.MigrationProviderIsNotDefined);
                return;
            }

            var jobOptions = new JobOptions("Migrate Content", "UI", Client.Site.Name, this, "Run", new object[] { context })
            {
                Priority       = ThreadPriority.Normal,
                ContextUser    = Context.User,
                ClientLanguage = Context.Language,
                EnableSecurity = true
            };

            var longRunningOptions = new LongRunningOptions(JobManager.Start(jobOptions).Handle.ToString())
            {
                Title     = "Migrate Content",
                Icon      = this.GetIcon(context, string.Empty),
                Threshold = 200,
                Message   = string.Empty
            };

            longRunningOptions.ShowModal();
        }
        public void ExecuteSync(string title, Action <ClientPipelineArgs> action, Action <ClientPipelineArgs> postAction)
        {
            if (!(Context.ClientPage.CurrentPipelineArgs is ClientPipelineArgs args))
            {
                return;
            }

            if (args.IsPostBack && !string.IsNullOrEmpty(handleString))
            {
                postAction?.Invoke(args);
                handleString = null;
                return;
            }

            var jobOption = new JobOptions(title, "UI", Client.Site.Name, action.Target, action.Method.Name, new object[] { args })
            {
                ContextUser    = Context.User,
                ClientLanguage = Context.Language
            };

            var job = JobManager.Start(jobOption);
            var longRunningOption = new LongRunningOptions(job.Handle.ToString())
            {
                Title = title,
                Icon  = string.Empty
            };

            handleString = job.Handle.ToString();

            longRunningOption.ShowModal(true);
            args.WaitForPostBack();
        }
Beispiel #3
0
        public override void Execute(CommandContext context)
        {
            if (context == null || context.Items.Length <= 0)
            {
                return;
            }

            Item item = context.Items[0];

            if (item == null)
            {
                LogHelper.Error("Error while executing manual operation. Context item is null.", this);
                return;
            }

            Item accountItem = AccountManager.GetAccountItemForDescendant(item);

            if (accountItem == null)
            {
                LogHelper.Error("Error while executing manual operation. An Account item cannot be found.", this);
                return;
            }

            if (!AccountManager.IsValidAccount(accountItem))
            {
                SheerResponse.Alert(Translations.AccountItemValidationFailed);
                return;
            }

            context.CustomData = accountItem;

            JobOptions jobOptions = new JobOptions(this.JobName, "UI", Client.Site.Name, this, "Run", new object[] { context })
            {
                Priority       = ThreadPriority.Normal,
                ContextUser    = Context.User,
                ClientLanguage = Context.Language,
                EnableSecurity = true
            };

            LongRunningOptions longRunningOptions = new LongRunningOptions(JobManager.Start(jobOptions).Handle.ToString())
            {
                Title     = this.Title,
                Icon      = this.GetIcon(context, string.Empty),
                Threshold = 200,
                Message   = string.Empty
            };

            longRunningOptions.ShowModal();
        }
Beispiel #4
0
        public override void Execute(CommandContext context)
        {
            JobOptions jobOptions = new JobOptions("Export MediaFramework Content", "UI", Client.Site.Name, this, "Run", new object[] { context })
            {
                Priority       = ThreadPriority.Normal,
                ContextUser    = Context.User,
                ClientLanguage = Context.Language,
                EnableSecurity = true
            };

            LongRunningOptions longRunningOptions = new LongRunningOptions(JobManager.Start(jobOptions).Handle.ToString())
            {
                Title     = "Export MediaFramework Content",
                Icon      = this.GetIcon(context, string.Empty),
                Threshold = 200,
                Message   = string.Empty
            };

            longRunningOptions.ShowModal();
        }
Beispiel #5
0
        /// <summary>
        /// Starts the import job with progress bar.
        /// </summary>
        /// <param name="jobName">Job-Name</param>
        /// <param name="icon">Icon</param>
        /// <param name="action">Start-Action</param>
        /// <param name="postAction">Finish-Action</param>
        /// <param name="selectedImage">Selected image</param>
        private static void ExecuteSync(string jobName, string icon, Action <ClientPipelineArgs, SelectedImageModel> action, Action <ClientPipelineArgs, SelectedImageModel> postAction, SelectedImageModel selectedImage)
        {
            ClientPipelineArgs currentPipelineArgs = Context.ClientPage.CurrentPipelineArgs as ClientPipelineArgs;

            if (currentPipelineArgs == null)
            {
                return;
            }
            if (currentPipelineArgs.IsPostBack && !string.IsNullOrEmpty(HandleString))
            {
                if (postAction != null)
                {
                    postAction(currentPipelineArgs, selectedImage);
                }
                return;
            }
            string name   = Client.Site.Name;
            object target = action.Target;
            string str    = action.Method.Name;

            object[]   objArray  = new object[] { currentPipelineArgs, selectedImage };
            JobOptions jobOption = new JobOptions(jobName, "FotoWareFields", name, target, str, objArray)
            {
                ContextUser    = Context.User,
                ClientLanguage = Context.Language
            };
            Job job = JobManager.Start(jobOption);
            LongRunningOptions longRunningOption = new LongRunningOptions(job.Handle.ToString())
            {
                Title     = "Import image from FotoWare",
                Icon      = icon,
                Threshold = 5
            };

            HandleString = job.Handle.ToString();

            longRunningOption.ShowModal(true);
            currentPipelineArgs.WaitForPostBack();
        }