using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; using System.Windows.Media.Imaging; namespace CzokoŚmieciarka.WPF.Models { public class Board { int _rows; int _columns; List _tiles = new List(); public Board(int rows, int columns, List Objects) { _rows = rows; _columns = columns; ImageBrush imgBrush = new ImageBrush(new BitmapImage(new Uri(@"C:\Users\s434678\Source\Repos\Czoko_Smieciarka\Trunk\Interface\CzokoŚmieciarka.WPF\Images\intersection.png"))); for (int r = 0; r < rows; r++) { for (int c = 0; c < columns; c++) { _tiles.Add(new Tile() { Data = string.Format("Dirt {0}", r * 10 + c), Background = imgBrush }); } } foreach(var item in Objects) { _tiles[item.Location.X + item.Location.Y].Background = new ImageBrush(new BitmapImage(new Uri(@item.ImagePath))); } } public int Rows { get { return _rows; } set { _rows = value; } } public int Columns { get { return _columns; } set { _columns = value; } } public List Tiles { get { return _tiles; } set { _tiles = value; } } } }