Example #1
0
        private static void ConfigureAndAddElement(Canvas gameGrid, FrameworkElement circle, PortablePoint positionOfCenter)
        {
            circle.VerticalAlignment = VerticalAlignment.Stretch;
            circle.HorizontalAlignment = HorizontalAlignment.Stretch;

            Validate.Between(positionOfCenter.X, 0, gameGrid.Width);
            Validate.Between(positionOfCenter.Y, 0, gameGrid.Height);

            Canvas.SetLeft(circle, positionOfCenter.X - circle.Width / 2);
            Canvas.SetTop(circle, positionOfCenter.Y - circle.Height / 2);

            gameGrid.Children.Add(circle);
        }
Example #2
0
 private bool Equals(PortablePoint other)
 {
     return Math.Abs(Y - other.Y) <= Epsilon && Math.Abs(X - other.X) <= Epsilon;
 }