Beispiel #1
0
        private void ModelStarChangedEventHandler(object sender, Model.Event_Arguments.StarChangedEventArgs e)
        {
            if (e.Disappeared && _stars.ContainsKey(e.Point))
            {
                _sprites.Remove(_stars[e.Point]);
            }

            else
            {
                if (!_stars.ContainsKey(e.Point))
                {
                    FrameworkElement newStar = InvadersHelper.StarControlFactory(Scale) as FrameworkElement;
                    _stars.Add(e.Point, newStar);
                    _sprites.Add(newStar);
                    InvadersHelper.RepositionElement(newStar, e.Point.X * Scale, e.Point.Y * Scale);
                    InvadersHelper.SendToBack(newStar);
                }
            }
        }