public static void QuickCleanup(this IGraphModel self) { var toRemove = self.EdgeModels.Where(e => e?.ToPort == null || e.FromPort == null).Cast <IGraphElementModel>() .Concat(self.NodeModels.Where(m => m.Destroyed)) .ToList(); self.DeleteElements(toRemove); }
public static void Repair(this IGraphModel self) { var toRemove = self.NodeModels.Where(n => n == null).Cast <IGraphElementModel>() .Concat(self.StickyNoteModels.Where(s => s == null)) .Concat(self.PlacematModels.Where(p => p == null)) .Concat(self.EdgeModels.Where(e => e?.ToPort == null || e.FromPort == null)) .ToList(); self.DeleteElements(toRemove); }