public List<NetworkDiagram> GetInconsistentDiagrams(UtilityNetwork utilityNetwork)
{
// Get the DiagramManager from the utility network
using (DiagramManager diagramManager = utilityNetwork.GetDiagramManager())
{
List<NetworkDiagram> myList = new List<NetworkDiagram>();
// Loop through the network diagrams in the diagram manager
foreach (NetworkDiagram diagram in diagramManager.GetNetworkDiagrams())
{
NetworkDiagramInfo diagramInfo = diagram.GetDiagramInfo();
// If the diagram is not a system diagram and is in an inconsistent state, add it to our list
if (!diagramInfo.IsSystem && diagram.GetConsistencyState() != NetworkDiagramConsistencyState.DiagramIsConsistent)
{
myList.Add(diagram);
}
else
{
diagram.Dispose(); // If we are not returning it we need to Dispose it
}
}
return myList;
}
}