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


C# ItemDefinition.Clone方法代码示例

本文整理汇总了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);
        }
开发者ID:n2cms,项目名称:N2Bootstrap,代码行数:27,代码来源:ModelAdapter.cs

示例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;
				}
			}
		}
开发者ID:grbbod,项目名称:drconnect-jungo,代码行数:23,代码来源:ReplaceParentDefinitionAttribute.cs

示例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;
 }
开发者ID:pauldotknopf,项目名称:N2Bootstrap,代码行数:22,代码来源:StartPage.cs


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