public void Click(Point p) { if (this.FirstPoint.IsEmpty) { this.FirstPoint = p; } else if (this.SecondPoint.IsEmpty) { this.SecondPoint = p; RedCircle redCircle = new RedCircle(this.FirstPoint, this.distance(this.FirstPoint, this.SecondPoint)); if (!this.checkCollisions(redCircle)) { this.Circles.Add(redCircle); } this.FirstPoint = Point.Empty; this.SecondPoint = Point.Empty; } }
private bool checkCollisions(Circle redCircle) { using (List <RedCircle> .Enumerator enumerator = this.Circles.GetEnumerator()) { while (true) { if (!enumerator.MoveNext()) { break; } RedCircle current = enumerator.Current; if (current.IsColiding(redCircle)) { return(true); } } } return(false); }