本文整理汇总了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);
}
}
示例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");
}
示例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");
}
示例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);
}
}
}
示例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);
}