当前位置: 首页>>代码示例>>C#>>正文


C# ClientPipelineArgs.AbortPipeline方法代码示例

本文整理汇总了C#中ClientPipelineArgs.AbortPipeline方法的典型用法代码示例。如果您正苦于以下问题:C# ClientPipelineArgs.AbortPipeline方法的具体用法?C# ClientPipelineArgs.AbortPipeline怎么用?C# ClientPipelineArgs.AbortPipeline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ClientPipelineArgs的用法示例。


在下文中一共展示了ClientPipelineArgs.AbortPipeline方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        public new void Execute(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            var database = Factory.GetDatabase(args.Parameters["database"]);
            Assert.IsNotNull(database, args.Parameters["database"]);
            var str = args.Parameters["id"];
            var item = database.Items[str];
            if (item.IsNull())
            {
                SheerResponse.Alert("Item not found.", new string[0]);
                args.AbortPipeline();
            }
            else
            {
                var parent = item.Parent;
                if (parent.IsNull())
                {
                    SheerResponse.Alert("Cannot duplicate the root item.", new string[0]);
                    args.AbortPipeline();
                }
                else if (parent.Access.CanCreate())
                {
                    Log.Audit(this, "Duplicate item: {0}", new[] { AuditFormatter.FormatItem(item) });

                    var parentBucketOfItem = item.GetParentBucketItemOrSiteRoot();
                    if (BucketManager.IsBucket(parentBucketOfItem))
                    {

                        var duplicatedItem = Context.Workflow.DuplicateItem(item, args.Parameters["name"]);
                        var newDestination = BucketManager.CreateAndReturnDateFolderDestination(parentBucketOfItem, DateTime.Now);
                        if (!item.Template.IsBucketTemplateCheck())
                        {
                            newDestination = parentBucketOfItem;
                        }
                        Event.RaiseEvent("item:bucketing:duplicating", args, this);
                        ItemManager.MoveItem(duplicatedItem, newDestination);
                        Event.RaiseEvent("item:bucketing:duplicated", args, this);
                        Log.Info("Item " + duplicatedItem.ID + " has been duplicated to another bucket", this);
                    }
                    else
                    {
                        Context.Workflow.DuplicateItem(item, args.Parameters["name"]);
                    }
                }
                else
                {
                    SheerResponse.Alert(Translate.Text("You do not have permission to duplicate \"{0}\".", new object[] { item.DisplayName }), new string[0]);
                    args.AbortPipeline();
                }
            }

            args.AbortPipeline();
        }
开发者ID:katebutenko,项目名称:Sitecore-Item-Buckets,代码行数:53,代码来源:ItemDuplicate.cs

示例2: ConstrainMove

        /// <summary>
        /// This method is fired in the pipeline as a validation check before the process executes.
        /// </summary>
        /// <param name = "args"></param>
        /// <returns></returns>
        public void ConstrainMove(ClientPipelineArgs args)
        {
            //check for postback
            //this occurs when an Administrator fires the event and is prompted with a confirmation message
            if (args.IsPostBack)
            {
                if (!string.IsNullOrEmpty(args.Result) && args.Result != "yes")
                {
                    args.AbortPipeline();
                }

                return;
            }

            //get selected item and target item
            Assert.ArgumentNotNull(args, "args");
            List<Item> items = GetItems(args);
            if (items.Count == 0) return;

            Assert.IsNotNull(items, typeof (List<Item>));
            Item targetItem = GetTarget(args);
            Assert.IsNotNull(targetItem, typeof (Item));

            //validate the event
            if (!MoveUtil.IsValidCopy(items[0], targetItem))
            {
                //validation failed, prompt user
                MoveUtil.PromptUser(args);
            }
        }
开发者ID:Velir,项目名称:Sitecore-MoveValidator,代码行数:35,代码来源:CustomCopyItems.cs

示例3: Execute

        public new void Execute(ClientPipelineArgs args)
        {
            var item = Context.ContentDatabase.GetItem(args.Parameters[1]);
            if (item.IsNotNull())
            {
                Error.AssertItem(item, "item");
                if (!args.IsPostBack)
                {
                    if (item.IsABucket())
                    {
                        new ClientResponse().Confirm("You are about to delete an item which is an item bucket with lots of hidden items below it. Are you sure you want to do this?");
                        args.WaitForPostBack();
                    }
                }
                else
                {
                    if (args.Result != "yes")
                    {
                        args.AbortPipeline();
                        args.Result = string.Empty;
                        args.IsPostBack = false;
                        return;
                    }

                    Event.RaiseEvent("item:bucketing:deleting", args, this);
                }
            }
        }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:28,代码来源:ItemDeleted.cs

示例4: ConstrainDragTo

        /// <summary>
        /// This method is fired in the pipeline as a validation check before the process executes.
        /// </summary>
        /// <param name = "args"></param>
        /// <returns></returns>
        public void ConstrainDragTo(ClientPipelineArgs args)
        {
            //check for postback
            //this occurs when an Administrator fires the event and is prompted with a confirmation message
            if (args.IsPostBack)
            {
                if (!string.IsNullOrEmpty(args.Result) && args.Result != "yes")
                {
                    args.AbortPipeline();
                }

                return;
            }

            //get database as listed in args
            Database database = GetDatabase(args);
            if (database == null) return;

            //get selected item and target item
            Item targetItem = GetTarget(args);
            Item copiedItem = GetSource(args, database);
            if (targetItem.IsNull() || copiedItem.IsNull()) return;

            //validate the event
            if (!MoveUtil.IsValidCopy(copiedItem, targetItem))
            {
                //validation failed, prompt user
                MoveUtil.PromptUser(args);
            }
        }
开发者ID:Velir,项目名称:Sitecore-MoveValidator,代码行数:35,代码来源:CustomDragItemTo.cs

示例5: Execute

 public new void Execute(ClientPipelineArgs args)
 {
     Assert.ArgumentNotNull(args, "args");
     var contentDatabase = Context.ContentDatabase;
     if (BucketManager.IsBucket(contentDatabase.GetItem(args.Parameters["target"])))
     {
         var item = contentDatabase.GetItem(args.Parameters["items"]);
         Event.RaiseEvent("item:bucketing:moving", args, this);
         Shell.Applications.Dialogs.ProgressBoxes.ProgressBox.Execute("Moving Items", "Moving Items", Images.GetThemedImageSource("Business/16x16/chest_add.png"), this.StartProcess, new object[] { item, BucketManager.CreateAndReturnDateFolderDestination(contentDatabase.GetItem(args.Parameters["target"]), DateTime.Now) });
         Event.RaiseEvent("item:bucketing:moved", args, this);
         Log.Info("Item " + item.ID + " has been moved to another bucket", this);
         Context.ClientPage.SendMessage(this, "item:refreshchildren(id=" + item.Parent.ID + ")");
         args.AbortPipeline();
     }
 }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:15,代码来源:ItemMove.cs

示例6: Run

 /// <summary>
 /// Method gets called in the pipeline to allow an interaction with a user.
 /// </summary>
 /// <param name="args"></param>
 public void Run(ClientPipelineArgs args)
 {
     Assert.ArgumentNotNull(args, "args");
      string cancelAll = args.Parameters["cancelAll"];
      if (args.Result == "yes")
      {
     if (cancelAll == "yes")
     {
        CancelAll();
     }
     else
     {
        CancelJob();
     }
      }
      else if (args.Result == "no")
      {
     args.AbortPipeline();
      }
      else
      {
     if (cancelAll == "yes")
     {
        var jobs = PublishJobHelper.GetJobs(JobState.Running);
        if (jobs.GetEnumerator().MoveNext())
        {
           SheerResponse.Confirm(Translate.Text("Are you sure you want to cancel all current publishing jobs?"));
        }
        else
        {
           SheerResponse.Alert(Translate.Text("There are no publishing jobs to cancel."));
        }
     }
     else
     {
        if (PublishJobHelper.GetSelectedJob("JobList") != null)
        {
           SheerResponse.Confirm(Translate.Text("Are you sure you want to cancel selected publishing job?"));
        }
        else
        {
           SheerResponse.Alert(Translate.Text("Please select a job from the list to cancel."));
        }
     }
      }
      args.WaitForPostBack();
 }
开发者ID:ivansharamok,项目名称:AdvancedPublishDialog,代码行数:51,代码来源:PublishCancel.cs

示例7: PromptUser

        /// <summary>
        /// Prompts the user after the validation has failed.
        /// Additional functionality to pass parameters into the args so 
        /// they can be picked up on the postback.
        /// </summary>
        /// <param name = "args">Client Pipeline Arguments</param>
        /// <param name = "selectedItem">Selected Item that is being copied or moved</param>
        /// <param name = "destinationItem">Destination Item</param>
        /// <returns></returns>
        public static void PromptUser(ClientPipelineArgs args, Item selectedItem, Item destinationItem)
        {
            //validation failed, if administrator prompt with confirmation message for override
            MoveValidatorSettingsItem settingsItem = GetSettingsItem();

            //if administrator allow for an override
            if (Context.User.IsAdministrator)
            {
                //validation failed, if administrator prompt with confirmation message for override
                if (settingsItem.IsNull() || string.IsNullOrEmpty(settingsItem.AdminAlertMessage))
                    SheerResponse.Confirm(MoveValidatorSettingsItem.DEFAULT_ADMIN_ALERT);
                else
                    SheerResponse.Confirm(settingsItem.AdminAlertMessage);

                //add parameters for command style approach, we loose our parameters on the postback otherwise
                //and therefore cannot pickup the item and destination item to perform the event.
                args.Parameters["selectedItem"] = selectedItem.ID.ToString();
                args.Parameters["destinationItem"] = destinationItem.ID.ToString();
                args.Parameters["database"] = selectedItem.Database.Name;
                args.Parameters["copyOrMove"] = "move";
                if (args.Result.ToLower().StartsWith("sitecore:copy:"))
                    args.Parameters["copyOrMove"] = "copy";

                args.WaitForPostBack();
            }
            else
            {
                //notify user this action is not allowed
                if (settingsItem.IsNull() || string.IsNullOrEmpty(settingsItem.UserAlertLongMessage) ||
                    string.IsNullOrEmpty(settingsItem.UserAlertShortMessage))
                    SheerResponse.ShowError(MoveValidatorSettingsItem.DEFAULT_USER_SHORT_ALERT,
                                            MoveValidatorSettingsItem.DEFAULT_USER_LONG_ALERT);
                else
                    SheerResponse.ShowError(settingsItem.UserAlertShortMessage, settingsItem.UserAlertLongMessage);
                args.AbortPipeline();
            }
        }
开发者ID:Velir,项目名称:Sitecore-MoveValidator,代码行数:46,代码来源:MoveUtil.cs

示例8: CancelOperation

        private static void CancelOperation(ClientPipelineArgs args, string alertMessage)
        {
            Assert.ArgumentNotNull(args, "args");
            if (!string.IsNullOrEmpty(alertMessage))
            {
                SheerResponse.Alert(alertMessage);
            }

            args.AbortPipeline();
        }
开发者ID:scjunkie,项目名称:Sitecore.PullUpFields,代码行数:10,代码来源:PullUpFieldsIntoBaseTemplate.cs

示例9: Run

        protected new void Run(ClientPipelineArgs args)
        {
            string strMaster = StringUtil.GetString(new string[] {args.Parameters["master"]});
             string strTemplate = StringUtil.GetString(new string[] {args.Parameters["template"]});
             Database database = Factory.GetDatabase(StringUtil.GetString(new string[] {args.Parameters["database"]}));
             if (args.IsPostBack)
             {
            if (args.HasResult)
            {
               Item parent = database.Items[args.Parameters["id"]];
               if (parent != null)
               {
                  try
                  {
                     if (strMaster.Length > 0)
                     {
                        BranchItem branch = database.Masters[strMaster];
                        PostStep(Context.Workflow.AddItem(args.Result, branch, parent));
                     }
                     else
                     {
                        PostStep(database.Templates[strTemplate].AddTo(parent, args.Result));
                     }
                  }
                  catch (UnauthorizedAccessException ex)
                  {
                     Context.ClientPage.ClientResponse.Alert(ex.Message);
                  }
               }
               else
               {
                  Context.ClientPage.ClientResponse.ShowError(ResourceManager.Localize("PARENT_NOT_FOUND"), "");
                  args.AbortPipeline();
               }
            }
             }
             else
             {
            string defaultValue;
            string text =
               StringUtil.GetString(
                  new string[] {args.Parameters["prompt"], ResourceManager.Localize("ENTER_ITEM_NAME")});
            if (strMaster.Length > 0)
            {
               defaultValue = database.Masters[strMaster].Name;
            }
            else
            {
               defaultValue = database.Templates[strTemplate].Name;
            }
            Context.ClientPage.ClientResponse.Input(text, defaultValue, Settings.ItemNameValidation,
                                                    ResourceManager.Localize("NOT_VALIDE_NAME"), 100);

            args.WaitForPostBack();
             }
        }
开发者ID:Refactored,项目名称:SitecoreCalendarModule,代码行数:56,代码来源:CreateItem.cs

示例10: ConfirmPublish

        /// <summary>
        /// Confirmation dialog for next wizard button.
        /// </summary>
        /// <param name="args">
        /// Pipeline arguments.
        /// </param>
        private void ConfirmPublish(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
             if (args.Result == "yes")
             {
            // Call this method to move to next page in the Wizard form.
            Next();
             }
             else if (args.Result == "no")
             {
            args.AbortPipeline();
             }
             else
             {
            Context.ClientPage.ClientResponse.Confirm(Translate.Text("Are you sure you want to publish subitems too?"));
             }

             args.WaitForPostBack();
        }
开发者ID:ivansharamok,项目名称:AdvancedPublishDialog,代码行数:25,代码来源:PublishForm.cs

示例11: Cancel

        /// <summary>
        /// This method gets called as a pipeline from OnCancel method.
        /// </summary>
        /// <param name="args">
        /// Pipeline arguments.
        /// </param>
        private void Cancel(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
             if (args.Result == "yes")
             {
            this.CancelJob();
             }
             else if (args.Result == "no")
             {
            args.AbortPipeline();
             }
             else
             {
            Context.ClientPage.ClientResponse.Confirm(
               Translate.Text("Are you sure you want to cancel this publishing job?"));
             }

             args.WaitForPostBack();
        }
开发者ID:ivansharamok,项目名称:AdvancedPublishDialog,代码行数:25,代码来源:PublishForm.cs

示例12: Run

        /// <summary>
        /// 	This method is fired by Execute.
        /// 	Runs through a range of checks to validate the event.
        /// </summary>
        /// <param name = "args"></param>
        /// <returns></returns>
        protected void Run(ClientPipelineArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            //check for postback
            //this occurs when an Administrator fires the event and is prompted with a confirmation message
            if (args.IsPostBack && args.Result == "yes")
            {
                PerformEvent(args);
                args.AbortPipeline();
                return;
            }

            //this occurs when an Administrator clicks the cancel button on the override prompt
            if (args.IsPostBack && args.Result == "no")
                return;

            if (args.Parameters["fetched"] == "0")
            {
                args.Parameters["fetched"] = "1";
                Context.ClientPage.ClientResponse.Eval("window.clipboardData.getData(\"Text\")").Attributes["response"]
                    = "1";
                args.WaitForPostBack();
            }
            else
            {
                string name = args.Parameters["database"];
                Database database = Factory.GetDatabase(name);
                Assert.IsNotNull(database, name);
                string str2 = StringUtil.GetString(new[] {args.Result});
                if (!string.IsNullOrEmpty(str2))
                {
                    if (!str2.StartsWith("sitecore:copy:") && !str2.StartsWith("sitecore:cut:"))
                    {
                        SheerResponse.Alert("The data on the clipboard is not valid.\n\nTry copying the data again.",
                                            new string[0]);
                    }
                    else
                    {
                        string id = StringUtil.Right(str2, 0x26);
                        if (!ID.IsID(id))
                        {
                            SheerResponse.Alert(
                                "The data on the clipboard is not valid.\n\nTry copying the data again.", new string[0]);
                        }
                        else
                        {
                            Item item = database.GetItem(id);
                            if (item == null)
                            {
                                SheerResponse.Alert(
                                    "The item that you want to paste could not be found.\n\nIt may have been deleted by another user.",
                                    new string[0]);
                                args.AbortPipeline();
                            }
                            else
                            {
                                Item item2 = database.GetItem(args.Parameters["id"]);
                                if (item2 == null)
                                {
                                    SheerResponse.Alert(
                                        "The destination item could not be found.\n\nIt may have been deleted by another user.",
                                        new string[0]);
                                    args.AbortPipeline();
                                }
                                else if ((item.ID != item2.ID) && item.Axes.IsAncestorOf(item2))
                                {
                                    SheerResponse.Alert("You cannot paste an item to a subitem of itself.",
                                                        new string[0]);
                                    args.AbortPipeline();
                                }
                                    //check to see if it meets custom validation
                                else if (!MoveUtil.IsValidCopy(item, item2))
                                {
                                    //validation failed, prompt user
                                    MoveUtil.PromptUser(args, item, item2);
                                }
                                else if (str2.StartsWith("sitecore:copy:"))
                                {
                                    Log.Audit(this, "Paste from: {0} to {1}",
                                              new[] {AuditFormatter.FormatItem(item2), AuditFormatter.FormatItem(item)});
                                    item.CopyTo(item2, ItemUtil.GetCopyOfName(item2, item.Name));
                                }
                                else if (item.ID != item2.ID)
                                {
                                    Log.Audit(this, "Cut from: {0} to {1}",
                                              new[] {AuditFormatter.FormatItem(item2), AuditFormatter.FormatItem(item)});
                                    item.MoveTo(item2);
                                }
                            }
                        }
                    }
                }
            }
//.........这里部分代码省略.........
开发者ID:Velir,项目名称:Sitecore-MoveValidator,代码行数:101,代码来源:CustomPasteFromClipBoard.cs


注:本文中的ClientPipelineArgs.AbortPipeline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。