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); } }
/// <summary> /// Set Global fields /// </summary> /// <param name="map">Diagram Layer</param> internal static void GetParameters(Map map) { if (map == null) { CleanModule(); return; } if (GlobalActiveMapName != map.Name || GlobalDiagram == null || GlobalDiagramLayer == null) { GlobalActiveMap = map; GlobalActiveMapName = GlobalActiveMap.Name; GlobalDiagramLayer = GetDiagramLayerFromMap(map); if (GlobalDiagramLayer == null) { CleanModule(); } else { QueuedTask.Run(() => { try { GlobalDiagram = GlobalDiagramLayer.GetNetworkDiagram(); } catch { GlobalDiagram = null; } try { if (GlobalDiagram != null) { GlobalDiagramManager = GlobalDiagram.DiagramManager; GlobalUtilityNetwork = GlobalDiagramManager.GetNetwork <UtilityNetwork>(); GlobalGeodatabase = GlobalUtilityNetwork.GetDatastore() as Geodatabase; NetworkDiagramInfo networkDiagramInfo = GlobalDiagram.GetDiagramInfo(); if (networkDiagramInfo == null) { GlobalIsSystem = false; GlobalEnvelope = null; GlobalIsStored = false; GlobalContainerMargin = 0.5; } else { GlobalIsSystem = networkDiagramInfo.IsSystem; GlobalEnvelope = networkDiagramInfo.DiagramExtent; GlobalIsStored = networkDiagramInfo.IsStored; GlobalContainerMargin = networkDiagramInfo.ContainerMargin; } GlobalTypeGeo = GlobalGeodatabase.GetGeodatabaseType(); if (GlobalTypeGeo == GeodatabaseType.Service) { VersionManager vm = GlobalGeodatabase.GetVersionManager(); if (vm != null) { GlobalIsVersioned = (vm.GetCurrentVersion() != null); } else { GlobalIsVersioned = false; } } else { GlobalIsVersioned = false; } } else { GlobalDiagramLayer = null; } CleanSelections(); } catch (Exception ex) { ShowException(exception: ex); CleanModule(); } }); } } }