예제 #1
0
 /// <summary>
 /// Convert the window contract to an entity object.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <returns>The entity object</returns>
 private static Window ToEntity(this Contract.Data.Map.Window source)
 {
     return(new Window
     {
         Id = source.Id,
         X = source.X,
         Y = source.Y,
         Holes = source.Holes.Select(hole => hole.ToEntity()).ToList()
     });
 }
예제 #2
0
        /// <summary>
        /// Converts the Window contract to the corresponding entity
        /// </summary>
        /// <param name="contractWindow">The contract window.</param>
        /// <returns>The entity</returns>
        public static Window ToEntity(this Contract.Data.Map.Window contractWindow)
        {
            var window = new Window {
                Id = contractWindow.Id, X = contractWindow.X, Y = contractWindow.Y
            };

            foreach (var contractHole in contractWindow.Holes)
            {
                window.Holes.Add(ToEntity(contractHole));
            }

            return(window);
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameWindow"/> class.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <param name="mapWindow">The map window.</param>
        /// <param name="holeDiameter">The hole diameter.</param>
        public GameWindow(int x, int y, Contract.Data.Map.Window mapWindow, double holeDiameter)
        {
            this.X     = x;
            this.Y     = y;
            this.Holes = new ObservableCollection <Hole>();

            if (mapWindow != null)
            {
                this.Id        = mapWindow.Id;
                this.IsChecked = true;
                foreach (var hole in mapWindow.Holes)
                {
                    this.Holes.Add(hole.ToEntity(holeDiameter));
                }
            }
            else
            {
                this.IsChecked = false;
            }
        }