public override void Replace(BuildTopicTocInfo itemOut, BuildTopicTocInfo itemIn) { if (itemIn == null || itemOut == null || _listTopics == null) { return; } int index = this.IndexOf(itemOut); if (index < 0) { BuildTopicTocInfo itemParent = itemOut.Parent; if (itemParent != null) { itemParent.Replace(itemOut, itemIn); } return; } _listTopics.RemoveAt(index); _listTopics.Insert(index, itemIn); }
public override void Replace(BuildTopicTocInfo itemOut, BuildGroupTocInfo groupTocInfo) { if (itemOut == null || groupTocInfo == null || groupTocInfo.Count == 0 || _listTopics == null) { return; } int index = this.IndexOf(itemOut); if (index < 0) { BuildTopicTocInfo itemParent = itemOut.Parent; if (itemParent != null) { itemParent.Replace(itemOut, groupTocInfo); } return; } _listTopics.RemoveAt(index); _listTopics.Insert(index, groupTocInfo.Items); }