Exemple #1
0
        protected override IReadOnlyList <PrtgNode> VisitList(INodeList <PrtgNode> nodes)
        {
            var index = nodes.IndexOf(oldNode);

            if (index >= 0 && index < nodes.Count)
            {
                switch (type)
                {
                case ListEditType.Replace:
                    return(nodes.ReplaceRange(oldNode, newNodes));

                case ListEditType.InsertAfter:
                    return(nodes.InsertRange(index + 1, newNodes));

                case ListEditType.InsertBefore:
                    return(nodes.InsertRange(index, newNodes));

                default:
                    throw new NotImplementedException($"Don't know how to process list edit type '{type}'.");
                }
            }

            return(base.VisitList(nodes));
        }