public GProperty GetGProperty(GPPresentation propertyPresentation) { double propertyPresentationX = propertyPresentation.PointPresentation.X; double propertyPresentationY = propertyPresentation.PointPresentation.Y; foreach (UIElement element in Workspace.Children) { if (element is GProperty) { if (Canvas.GetLeft(element) == propertyPresentationX && Canvas.GetTop(element) == propertyPresentationY) { return(element as GProperty); } } } return(null); }
// -------- Access -------- private void HookProperties() { foreach (UIElement element in Workspace.Children) { if (element is GStatement) { GStatement gStatement = element as GStatement; GSPresentation statement = new GSPresentation(gStatement); statement.PointPresentation = new PointPresentation(Canvas.GetLeft(element as GStatement), Canvas.GetTop(element as GStatement)); Statements.Add(statement); } else if (element is GProperty) { GProperty gProperty = element as GProperty; GPPresentation property = new GPPresentation(gProperty); property.PointPresentation = new PointPresentation(Canvas.GetLeft(element as GProperty), Canvas.GetTop(element as GProperty)); Properties.Add(property); } } }