本文整理汇总了C#中ItemDefinition.Clone方法的典型用法代码示例。如果您正苦于以下问题:C# ItemDefinition.Clone方法的具体用法?C# ItemDefinition.Clone怎么用?C# ItemDefinition.Clone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ItemDefinition
的用法示例。
在下文中一共展示了ItemDefinition.Clone方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddDefinedEditors
public override IDictionary<string, System.Web.UI.Control> AddDefinedEditors(ItemDefinition definition, N2.ContentItem item, System.Web.UI.Control container, System.Security.Principal.IPrincipal user, Type containerTypeFilter, IEnumerable<string> editableNameFilter)
{
ItemDefinition cloned = null;
// add a "wrap in container" checkbox to all parts that are within zones that are not wrapped in a container (BeforeMain, AfterMain).
if (!definition.IsPage)
{
if (!(Defaults.IsContainerWrappable(item.ZoneName) ||
Defaults.IsContainerWrappable(System.Web.HttpContext.Current.Request["zoneName"])))
{
cloned = definition.Clone();
var isWrappable = cloned.Editables.FirstOrDefault(x => x.Name == "UseContainer");
if (isWrappable != null)
{
cloned.Editables.Remove(isWrappable);
}
}
}
if (item is IItemAdapter)
{
var result = (item as IItemAdapter).AddDefinedEditors(cloned ?? definition, container, user, containerTypeFilter, editableNameFilter);
if (result != null)
return result;
}
return base.AddDefinedEditors(cloned ?? definition, item, container, user, containerTypeFilter, editableNameFilter);
}
示例2: Refine
public override void Refine(ItemDefinition currentDefinition, IList<ItemDefinition> allDefinitions)
{
Type t = currentDefinition.ItemType;
foreach (ItemDefinition definition in new List<ItemDefinition>(allDefinitions))
{
if (definition.ItemType == t.BaseType)
{
if (ReplacementMode == DefinitionReplacementMode.Remove)
{
allDefinitions.Remove(definition);
var shadowDefinition = currentDefinition.Clone();
shadowDefinition.Discriminator += "Disabled";
N2.Definitions.Static.DefinitionMap.Instance.SetDefinition(definition.ItemType, definition.TemplateKey, shadowDefinition);
if (AssumeParentDiscriminator)
currentDefinition.Discriminator = definition.Discriminator;
}
else
definition.Enabled = false;
return;
}
}
}
示例3: AddDefinedEditors
public IDictionary<string, System.Web.UI.Control> AddDefinedEditors(ItemDefinition definition, System.Web.UI.Control container, System.Security.Principal.IPrincipal user, System.Type containerTypeFilter, IEnumerable<string> editableNameFilter)
{
if (containerTypeFilter != null && containerTypeFilter == typeof(RecursiveContainerAttribute))
{
// we are rendering the "Site" page
// the language intersection and startpage both define "host name" depending on how the user structures the site.
// We want to ensure startpage only uses it when it is NOT defined under the language intersection.
// Most root item (start/intersection) wins for both ISiteSource and the host name editor
if (Parent is LanguageIntersection)
{
// clone the definition and remove "host name" from it
var clonedDefinition = definition.Clone();
var hostName = clonedDefinition.Editables.SingleOrDefault(x => x.Name == "HostName");
if (hostName != null)
{
clonedDefinition.Remove(hostName);
}
return new EditableAdapter().AddDefinedEditors(clonedDefinition, this, container, user, containerTypeFilter, editableNameFilter);
}
}
return null;
}