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


C# NodeViewData.AddSubItem方法代码示例

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


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

示例1: SetSubItem

        /// <summary>
        /// Set the source sub item before the target one.
        /// </summary>
        /// <param name="targetNvd">The target node view data in the current view.</param>
        /// <param name="sourceItem">The source sub item of the current node view data.</param>
        /// <param name="targetItem">The target sub item of the target node view data.</param>
        public bool SetSubItem(NodeViewData targetNvd, SubItemAttachment sourceItem, SubItemAttachment targetItem, bool insertPreviously, bool isCopied)
        {
            if (targetNvd == null ||
            sourceItem == null || sourceItem.Attachment == null ||
            !isCopied && targetItem == sourceItem ||
            !targetNvd.Node.AcceptsAttachment(sourceItem.Attachment))
            { return false; }

            if (!isCopied) {
            this.Node.RemoveAttachment(sourceItem.Attachment);
            this.RemoveSubItem(sourceItem);

            } else {
            sourceItem = sourceItem.Clone(targetNvd.Node) as SubItemAttachment;
            sourceItem.Attachment.ResetId();
            }

            if (targetItem == null) {
            targetNvd.Node.AddAttachment(sourceItem.Attachment);

            } else {
            Debug.Check(targetItem.Attachment != null);

            for (int i = 0; i < targetNvd.Node.Attachments.Count; ++i) {
                if (targetNvd.Node.Attachments[i] == targetItem.Attachment) {
                    targetNvd.Node.AddAttachment(sourceItem.Attachment, insertPreviously ? i : i + 1);
                    break;
                }
            }
            }

            if (targetItem == null) {
            targetNvd.AddSubItem(sourceItem);

            } else {
            for (int i = 0; i < targetNvd.SubItems.Count; ++i) {
                if (targetNvd.SubItems[i] == targetItem) {
                    targetNvd.AddSubItem(sourceItem, insertPreviously ? i : i + 1);
                    break;
                }
            }
            }

            bool setDirty = false;

            if (!isCopied) {
            sourceItem.Attachment.OnPropertyValueChanged(!setDirty);
            setDirty = true;
            }

            for (int i = 0; i < targetNvd.SubItems.Count; ++i) {
            SubItemAttachment attach = targetNvd.SubItems[i] as SubItemAttachment;

            if (attach != null && attach != sourceItem) {
                attach.Attachment.OnPropertyValueChanged(!setDirty);
                setDirty = true;
            }
            }

            targetNvd.SelectedSubItem = sourceItem;

            return true;
        }
开发者ID:XyzalZhang,项目名称:behaviac,代码行数:69,代码来源:NodeViewData.cs

示例2: SetSubItem

        /// <summary>
        /// Set the source sub item before the target one.
        /// </summary>
        /// <param name="targetNvd">The target node view data in the current view.</param>
        /// <param name="targetItem">The target sub item of the target node view data.</param>
        /// <param name="sourceItem">The source sub item of the current node view data.</param>
        public bool SetSubItem(NodeViewData targetNvd, SubItemAttachment targetItem, SubItemAttachment sourceItem, bool insertPrevious)
        {
            if (targetNvd == null ||
                targetItem == null || targetItem.Attachment == null ||
                sourceItem == null || sourceItem.Attachment == null ||
                targetItem == sourceItem)
                return false;

            this.Node.RemoveAttachment(sourceItem.Attachment);
            for (int i = 0; i < targetNvd.Node.Attachments.Count; ++i)
            {
                if (targetNvd.Node.Attachments[i] == targetItem.Attachment)
                {
                    targetNvd.Node.AddAttachment(sourceItem.Attachment, insertPrevious ? i : i + 1);
                    break;
                }
            }

            this.RemoveSubItem(sourceItem);
            for (int i = 0; i < targetNvd.SubItems.Count; ++i)
            {
                if (targetNvd.SubItems[i] == targetItem)
                {
                    targetNvd.AddSubItem(sourceItem, insertPrevious ? i : i + 1);
                    break;
                }
            }

            sourceItem.Attachment.OnPropertyValueChanged(true);
            for (int i = 0; i < targetNvd.SubItems.Count; ++i)
            {
                SubItemAttachment attach = targetNvd.SubItems[i] as SubItemAttachment;
                if (attach != null && attach != sourceItem)
                    attach.Attachment.OnPropertyValueChanged(false);
            }

            return true;
        }
开发者ID:KeyleXiao,项目名称:behaviac,代码行数:44,代码来源:NodeViewData.cs


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