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


C# CommandContext.CheckCommandContextForItemCount方法代码示例

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


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

示例1: Execute

 /// <summary>
 /// Execute Process
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     if (context.CheckCommandContextForItemCount(1))
     {
         var parameters = new NameValueCollection();
         parameters["items"] = this.SerializeItems(context.Items);
         Context.ClientPage.Start(this, "Run", parameters);
     }
 }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:16,代码来源:Search.cs

示例2: GetHeader

        /// <summary>
        /// Get the Header Text
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        /// <param name="header">
        /// The header.
        /// </param>
        /// <returns>
        /// Header Text
        /// </returns>
        public override string GetHeader(CommandContext context, string header)
        {
            if (!context.CheckCommandContextForItemCount(1))
            {
                return base.GetHeader(context, header);
            }

            var item = context.Items[0];
            if (item.IsNotNull() && item.Fields[Util.Constants.IsTag].IsNotNull())
            {
                if (!((CheckboxField)item.Fields[Util.Constants.IsTag]).Checked)
                {
                    return Translate.Text("Make Tag");
                }
            }

            return Translate.Text("Unmake Tag");
        }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:30,代码来源:SetFieldAsTag.cs

示例3: GetHeader

        /// <summary>
        /// Get the Command Header
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        /// <param name="header">
        /// The header.
        /// </param>
        /// <returns>
        /// Header Text
        /// </returns>
        public override string GetHeader(CommandContext context, string header)
        {
            if (!context.CheckCommandContextForItemCount(1))
            {
                return base.GetHeader(context, header);
            }

            var item = context.Items[0];
            if (item.IsNotNull() && item.Fields[Util.Constants.IsSearchImage].IsNotNull())
            {
                if (!((CheckboxField)item.Fields[Util.Constants.IsSearchImage]).Checked)
                {
                    return Translate.Text("Image Result Field");
                }
            }

            return Translate.Text("Remove Image Result Field");
        }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:30,代码来源:MarkImageFieldAsSearchResultsImage.cs

示例4: Execute

 /// <summary>
 /// Execute Rule
 /// </summary>
 /// <param name="context">
 /// The context.
 /// </param>
 public override void Execute(CommandContext context)
 {
     Assert.ArgumentNotNull(context, "context");
     if (context.CheckCommandContextForItemCount(1))
     {
         var parameters = new NameValueCollection();
         parameters["items"] = this.SerializeItems(context.Items);
         parameters["domainname"] = context.Parameters["domainname"];
         parameters["accountname"] = context.Parameters["accountname"];
         parameters["accounttype"] = context.Parameters["accounttype"];
         parameters["fieldid"] = context.Parameters["fieldid"];
         var args = new ClientPipelineArgs(parameters);
         if (ContinuationManager.Current.IsNotNull())
         {
             ContinuationManager.Current.Start(this, "Run", args);
         }
         else
         {
             Context.ClientPage.Start(this, "Run", args);
         }
     }
 }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:28,代码来源:SetSecurityRule.cs

示例5: QueryState

        /// <summary>
        /// Query State
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        /// <returns>
        /// Command State
        /// </returns>
        public override CommandState QueryState(CommandContext context)
        {
            Assert.ArgumentNotNull(context, "context");
            if (context.CheckCommandContextForItemCount(0))
            {
                return CommandState.Disabled;
            }
            var item = context.Items[0];
            if (item.IsNotNull() && item.Fields[Util.Constants.IsTag].IsNotNull())
            {
                var isFacet = ((CheckboxField)item.Fields[Util.Constants.IsTag]).InnerField.ID;
                if (!this.HasField(item, isFacet))
                {
                    return CommandState.Hidden;
                }

                if (item.Appearance.ReadOnly)
                {
                    return CommandState.Disabled;
                }

                if (!item.Access.CanWrite())
                {
                    return CommandState.Disabled;
                }

                if (IsLockedByOther(item))
                {
                    return CommandState.Disabled;
                }

                if (!CanWriteField(item, isFacet))
                {
                    return CommandState.Disabled;
                }
            }

            return base.QueryState(context);
        }
开发者ID:udt1106,项目名称:Sitecore-Item-Buckets,代码行数:48,代码来源:SetFieldAsTag.cs


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