void StarChangedHandler(object sender, StarChangedEventArgs e) { if (e.Removed) { StarControl starControl = _stars[e.StarThatChanged]; _stars.Remove(e.StarThatChanged); _fadedStars.Add(starControl); starControl.FadeOut(); } else { StarControl newStar; if (_stars.ContainsKey(e.StarThatChanged)) { newStar = _stars[e.StarThatChanged]; } else { newStar = new StarControl(); _stars[e.StarThatChanged] = newStar; newStar.FadeIn(); BeeStarHelper.SendToBack(newStar); _sprites.Add(newStar); } BeeStarHelper.SetCanvasLocation(newStar, e.StarThatChanged.Location.X, e.StarThatChanged.Location.Y); } }
private void _model_StarChanged(object sender, StarChangedEventArgs e) { if (e.Removed && _stars.ContainsKey(e.StarThatChanged)) { StarControl starRemoved = _stars[e.StarThatChanged]; _fadedStars.Add(starRemoved); _stars.Remove(e.StarThatChanged); starRemoved.FadeOut(); } else { StarControl starToBeShown; if (_stars.ContainsKey(e.StarThatChanged)) { starToBeShown = _stars[e.StarThatChanged]; } else { starToBeShown = new StarControl(); starToBeShown.FadeIn(); _sprites.Add(starToBeShown); BeeStarHelper.SentToBack(starToBeShown); } BeeStarHelper.SetCanvasLocation(starToBeShown, e.StarThatChanged.Location.X, e.StarThatChanged.Location.Y); } }
void StarChangedHandler(object sender, StarChangedEventArgs e) { if (e.Removed) { StarControl starControl = _stars[e.StarThatChanged]; _stars.Remove(e.StarThatChanged); _fadedStars.Add(starControl); starControl.FadeOut(); } else { StarControl newStar; if (_stars.ContainsKey(e.StarThatChanged)) newStar = _stars[e.StarThatChanged]; else { newStar = new StarControl(); _stars[e.StarThatChanged] = newStar; newStar.FadeIn(); BeeStarHelper.SendToBack(newStar); _sprites.Add(newStar); } BeeStarHelper.SetCanvasLocation( newStar, e.StarThatChanged.Location.X, e.StarThatChanged.Location.Y); } }
void StarChangedHandler(object sender, StarChangedEventArgs e) { StarControl starControl = null; if (_stars.ContainsKey(e.StarThatChanged)) { starControl = _stars[e.StarThatChanged]; } if (e.Removed && starControl != null) { _fadedStars.Add(starControl); _stars.Remove(e.StarThatChanged); starControl.FadeOut(); return; } else if (starControl == null) { starControl = new StarControl(); if (_stars.ContainsKey(e.StarThatChanged)) { _stars[e.StarThatChanged] = starControl; } else { _stars.Add(e.StarThatChanged, starControl); } _sprites.Add(starControl); starControl.FadeIn(); BeeStarHelper.SendToBack(starControl); } BeeStarHelper.SetCanvasLocation(starControl, e.StarThatChanged.Location.X, e.StarThatChanged.Location.Y); }