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


C# IPropertyBag.Remove方法代码示例

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


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

示例1: DoBeforeUpdate

        /// <summary>
        /// This method is called just before a node is updated by the repository.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        /// <param name="node">The node which will be modified.</param>
        /// <param name="modifiedProperties">The updated properties of the node.</param>
        protected override void DoBeforeUpdate(IMansionContext context, Node node, IPropertyBag modifiedProperties)
        {
            // if the name has not changed we are not interested
            string newName;
            if (!modifiedProperties.TryGet(context, "name", out newName))
                return;

            // if the name has not changed after normalization we are not interested
            newName = TagUtilities.Normalize(newName);
            if (node.Pointer.Name.Equals(newName))
            {
                modifiedProperties.Remove("name");
                return;
            }
            modifiedProperties.Set("name", newName);

            // if the tag is renamed to another already existing tag, move all content to that existing tag and delete this one
            Node existingTag;
            var tagIndexNode = TagUtilities.RetrieveTagIndexNode(context);
            if (TagUtilities.TryRetrieveTagNode(context, tagIndexNode, newName, out existingTag))
            {
                // TODO: move all content to the existing tag

                // TODO: delete this tag
            }
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:32,代码来源:TagListener.cs

示例2: ToGuids

        /// <summary>
        /// Manages the tags.
        /// </summary>
        /// <param name="context">The <see cref="IMansionContext"/>.</param>
        /// <param name="properties">The new properties.</param>
        public static void ToGuids(IMansionContext context, IPropertyBag properties)
        {
            // validate arguments
            if (context == null)
                throw new ArgumentNullException("context");
            if (properties == null)
                throw new ArgumentNullException("properties");

            // get the tag name string
            string tagNameString;
            if (!properties.TryGet(context, "_tags", out tagNameString))
                return;

            // normalize the tag names
            var tagNames = NormalizeNames(tagNameString).ToList();

            // retrieve the tag index node
            var tagIndexNode = RetrieveTagIndexNode(context);

            // loop over all the tag names
            var tagNodes = tagNames.Select(tagName => RetrieveTagNode(context, tagIndexNode, tagName));

            // set the new tag guids
            properties.Set("tagGuids", string.Join(",", tagNodes.Select(x => x.PermanentId)));
            properties.Remove("_tags");
        }
开发者ID:Erikvl87,项目名称:Premotion-Mansion,代码行数:31,代码来源:TagUtilities.cs


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