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) { if (e.Removed)//if removed than move to faded stars collection { StarControl starControl = _stars[e.StarThatChanged]; _stars.Remove(e.StarThatChanged); _fadedStars.Add(starControl); starControl.FadeOut(); } else {//if exsits then take reference StarControl newStar; if (_stars.ContainsKey(e.StarThatChanged)) { newStar = _stars[e.StarThatChanged]; } else//else create one and add to sprites collection { newStar = new StarControl(); _stars[e.StarThatChanged] = newStar; newStar.Fadein(); Helper.SendToBack(newStar); _sprites.Add(newStar); } Helper.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); } }
private void StarChangedHandler(object sender, StarChangedEventArgs e) { Point star = e.StarThatChanged; if (e.Removed) { if (_starDictionary.ContainsKey(e.StarThatChanged)) { StarControl starControl = _starDictionary[e.StarThatChanged]; _starDictionary.Remove(e.StarThatChanged); _fadedStars.Add(starControl, DateTime.Now); starControl.FadeOut(); //// not sure where to put this resize element method //InvadersHelper.ResizeElement(starControl, e.StarThatChanged.X * Scale, e.StarThatChanged.Y * Scale, // e.StarThatChanged.X * Scale, e.StarThatChanged.Y * Scale, Scale); } } else { StarControl newStar; if (_starDictionary.ContainsKey(e.StarThatChanged)) { newStar = _starDictionary[e.StarThatChanged]; } else { newStar = InvadersHelper.StarControlFactory(star, Scale) as StarControl; _starDictionary[e.StarThatChanged] = newStar; newStar.FadeIn(); _sprites.Add(newStar); } //InvadersHelper.SetCanvasLocation(newStar, e.StarThatChanged.X, e.StarThatChanged.Y, Scale); //// not sure where to put this resize element method //InvadersHelper.ResizeElement(newStar, e.StarThatChanged.X * Scale, e.StarThatChanged.Y * Scale, // e.StarThatChanged.X * Scale, e.StarThatChanged.Y * Scale, Scale); } }