src/Misc/EFTools/XmlCore/UI/ViewModels/Explorer/ExplorerEFElement.cs
/// <summary>
///     Compares 2 children (which must be direct children of this node i.e. already
///     in its Children collection)
/// </summary>
/// <param name="childElement1"></param>
/// <param name="childElement2"></param>
/// <returns>
///     -1 if childElement1 is in the Children list before childElement2,
///     +1 if childElement1 is in the Children list after childElement2, or
///     0 if the 2 children are the same
/// </returns>
Compares 2 children (which must be direct children of this node i.e. already
in its Children collection)
Compares 2 children ( which must be direct children of this node i . e . already in its Children collection )
private int CompareChildren(ExplorerEFElement child1, ExplorerEFElement child2)
        {
            EnsureLoaded();
            var child1Index = _children.IndexOf(child1);
            var child2Index = _children.IndexOf(child2);
            if (child1Index < 0
                || child2Index < 0)
            {
                Debug.Assert(child1Index < 0, "CompareChildren(): Could not find child1 named " + child1.Name + " in parent named " + Name);
                Debug.Assert(child2Index < 0, "CompareChildren(): Could not find child2 named " + child2.Name + " in parent named " + Name);
                return 0;
            }
            else
            {
                if (child1Index < child2Index)
                {
                    return -1;
                }
                else if (child1Index > child2Index)
                {
                    return 1;
                }
                else
                {
                    return 0;
                }
            }
        }
private int CompareChildren ( ExplorerEFElement child1 , ExplorerEFElement child2 ) { EnsureLoaded ( ) ; var child1Index = _children . IndexOf ( child1 ) ; var child2Index = _children . IndexOf ( child2 ) ; if ( child1Index < 0 || child2Index < 0 ) { Debug . Assert ( child1Index < 0 , " " + child1 . Name + " " + Name ) ; Debug . Assert ( child2Index < 0 , " " + child2 . Name + " " + Name ) ; return 0 ; } else { if ( child1Index < child2Index ) { return - 1 ; } else if ( child1Index > child2Index ) { return 1 ; } else { return 0 ; } } }
Compares 2 children (which must be direct children of this node i.e.
Compares 2 children ( which must be direct children of this node i . e .
// we can sometimes be called before ViewModel has loaded from Model // if so need to ensure the children have been loaded.
1 if childElement1 is in the Children list before childElement2,
+1 if childElement1 is in the Children list after childElement2, or
0 if the 2 children are the same
1 if childElement1 is in the Children list before childElement2 + 1 if childElement1 is in the Children list after childElement2 or 0 if the 2 children are the same
child1
ExplorerEFElement
child2
ExplorerEFElement
childElement1
None
childElement2
None