/// <summary> /// Searches for a DiagramObject in the observable collections of the DiagramData with the sames coordinates as the DiagramObject parameter /// This only makes sense if the user doesn't places two DiagramObject on the same coordinates of the Grid /// </summary> /// <param name="diagramObject">Diagram object parameter</param> /// <returns>Null or the DiagramObject</returns> internal DiagramObject GetDiagramObject(DiagramObject diagramObject) { if (diagramObject == null) { return(null); } DiagramObject diag; diag = Nodes.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) { return(diag); } diag = InterNodes.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) { return(diag); } diag = Transitions.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) { return(diag); } diag = Inputs.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) { return(diag); } diag = Outputs.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) { return(diag); } diag = NotInputs.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) { return(diag); } diag = NotOutputs.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); return(diag); }
/// <summary> /// Searches for a DiagramObject in the observable collections of the DiagramData with the sames coordinates as the DiagramObject parameter /// This only makes sense if the user doesn't places two DiagramObject on the same coordinates of the Grid /// </summary> /// <param name="diagramObject">Diagram object parameter</param> /// <returns>Null or the DiagramObject</returns> internal DiagramObject GetDiagramObject(DiagramObject diagramObject) { if (diagramObject == null) return null; DiagramObject diag; diag = Nodes.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) return diag; diag = InterNodes.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) return diag; diag = Transitions.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) return diag; diag = Inputs.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) return diag; diag = Outputs.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) return diag; diag = NotInputs.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); if (diag != null) return diag; diag = NotOutputs.ToList().Find(e => e != null && !e.IsNew && e.X == diagramObject.X && e.Y == diagramObject.Y); return diag; }