protected void OnStarChanged(Star starThatChanged, bool removed) { EventHandler<StarChangedEventArgs> starChanged = StarChanged; if (starChanged != null) { starChanged(this, new StarChangedEventArgs(starThatChanged, removed)); } }
private void MoveOneStar(Star star = null) { if (_stars.Keys.Count == 0) { return; } else if (star == null) { star = _stars.Keys.ToList()[_random.Next(_stars.Count)]; } star.Location = FindNonOverlappingPoint(StarSize); OnStarChanged(star, removed: false); }
private void CreateAStar() { Point starLocation = FindNonOverlappingPoint(StarSize); Star newStar = new Star(starLocation); _stars.Add(newStar, starLocation); OnStarChanged(newStar, removed: false); }
public StarChangedEventArgs(Star starThatChanged, bool removed) { StarThatChanged = starThatChanged; Removed = removed; }
private void CreateAStar() { Point newLocation = FindNonOverlappingPoint(StarSize); Star newStar = new Star(newLocation); _stars[newStar] = new Point(newLocation.X, newLocation.Y); OnStarChanged(newStar, false); }