SelectAdjacentVertices
(
IEdge oEdge,
Boolean bSelect
)
{
Debug.Assert(oEdge != null);
AssertValid();
// Copy the selected vertices to a HashSet. The key is the IVertex.
// A HashSet is used to prevent the same vertex from being selected
// twice.
HashSet<IVertex> oSelectedVertices =
NodeXLControlUtil.GetSelectedVerticesAsHashSet(oNodeXLControl);
// Add or subtract the specified edge's adjacent vertices from the
// HashSet of selected vertices.
foreach (IVertex oAdjacentVertex in oEdge.Vertices)
{
if (bSelect)
{
oSelectedVertices.Add(oAdjacentVertex);
}
else
{
oSelectedVertices.Remove(oAdjacentVertex);
}
}
// Replace the selection.
oNodeXLControl.SetSelected(oSelectedVertices,
oNodeXLControl.SelectedEdges);
}