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