Wyświetlanie domków
This commit is contained in:
parent
fe902bb551
commit
f08775224a
@ -9,6 +9,6 @@ namespace CzokoŚmieciarka.DataModels.Interfaces.TrashCans
|
||||
this.Localization = localization;
|
||||
}
|
||||
|
||||
public Coords Localization { get; }
|
||||
public Coords Localization { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -12,6 +13,8 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using CzokoŚmieciarka.DataModels.GeneralModels.Models;
|
||||
using CzokoŚmieciarka.DataModels.Models;
|
||||
using CzokoŚmieciarka.WPFv2.Interfaces;
|
||||
using CzokoŚmieciarka.WPFv2.Models;
|
||||
|
||||
@ -38,9 +41,20 @@ namespace CzokoŚmieciarka.WPFv2
|
||||
Board.RowDefinitions.Add(row);
|
||||
for (int j = 0; j < Columns; j++)
|
||||
{
|
||||
Road road = new Road("path");
|
||||
Road road = new Road();
|
||||
Objects[i, j] = road;
|
||||
Grid.SetRow(Objects[i,j].Image, i);
|
||||
Grid.SetColumn(Objects[i, j].Image, j);
|
||||
Board.Children.Add(Objects[i, j].Image);
|
||||
}
|
||||
|
||||
IEnumerable<TrashCan> trashCans = new List<TrashCan>();
|
||||
WPFHouse house = new WPFHouse(new Coords(i, i), trashCans);
|
||||
Objects[i, i] = house;
|
||||
Grid.SetRow(Objects[i, i].Image, i);
|
||||
Grid.SetColumn(Objects[i, i].Image, i);
|
||||
Board.Children.Add(Objects[i, i].Image);
|
||||
|
||||
}
|
||||
|
||||
Board.ShowGridLines = true;
|
||||
|
@ -5,6 +5,9 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using CzokoŚmieciarka.DataModels.Enums;
|
||||
using CzokoŚmieciarka.DataModels.GeneralModels.Models;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
|
||||
using CzokoŚmieciarka.DataModels.Models;
|
||||
@ -17,9 +20,29 @@ namespace CzokoŚmieciarka.WPFv2.Models
|
||||
public string ImagePath { get; set; }
|
||||
public Image Image { get; set; }
|
||||
|
||||
public WPFDump(ITypeOfGarbage typeOfGarbage, int maxVolume, Coords localization, string imagePath) : base(typeOfGarbage, maxVolume, localization)
|
||||
public WPFDump(ITypeOfGarbage typeofGarbage, int maxVolume, Coords localization, string imagePath) : base ( typeofGarbage, maxVolume, localization)
|
||||
{
|
||||
ImagePath = imagePath;
|
||||
Image = new Image();
|
||||
switch (typeofGarbage.GarbageType)
|
||||
{
|
||||
case GarbageType.Glass:
|
||||
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\glass.png";
|
||||
Image.Source = new BitmapImage(new Uri(ImagePath));
|
||||
break;
|
||||
case GarbageType.PlasticMetal:
|
||||
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\plasticmetal.png";
|
||||
Image.Source = new BitmapImage(new Uri(ImagePath));
|
||||
break;
|
||||
case GarbageType.Organic:
|
||||
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\organic.png";
|
||||
Image.Source = new BitmapImage(new Uri(ImagePath));
|
||||
break;
|
||||
case GarbageType.Paper:
|
||||
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\Dumps\paper.png";
|
||||
Image.Source = new BitmapImage(new Uri(ImagePath));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.GarbageCollector;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
|
||||
using CzokoŚmieciarka.DataModels.Models;
|
||||
@ -17,9 +18,12 @@ namespace CzokoŚmieciarka.WPFv2.Models
|
||||
public string ImagePath { get; set; }
|
||||
public Image Image { get; set; }
|
||||
|
||||
public WPFGarbageCollector(Coords startPosition, IEnumerable<AGarbageCollectorContainer> trashContainers, string imagePath) : base(startPosition, trashContainers)
|
||||
public WPFGarbageCollector(Coords startPosition, IEnumerable<AGarbageCollectorContainer> trashContainers) : base(startPosition, trashContainers)
|
||||
{
|
||||
ImagePath = imagePath;
|
||||
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png";
|
||||
Image = new Image();
|
||||
Image.Source =
|
||||
new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces;
|
||||
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
|
||||
using CzokoŚmieciarka.DataModels.Models;
|
||||
@ -20,10 +21,15 @@ namespace CzokoŚmieciarka.WPFv2.Models
|
||||
public Image Image { get; set; }
|
||||
|
||||
|
||||
public WPFHouse(Coords coords, IEnumerable<ATrashCan> trashCans, string imagePath)
|
||||
public WPFHouse(Coords coords, IEnumerable<ATrashCan> trashCans)
|
||||
{
|
||||
this.Coords = coords;
|
||||
this.TrashCans = trashCans;
|
||||
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\house.png";
|
||||
Image = new Image
|
||||
{
|
||||
Source = new BitmapImage(new Uri(ImagePath))
|
||||
};
|
||||
TrashCans = trashCans;
|
||||
Coords = coords;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,13 @@ namespace CzokoŚmieciarka.WPFv2.Models
|
||||
public string ImagePath { get; set; }
|
||||
public Image Image { get; set; }
|
||||
|
||||
public Road(string imagePath)
|
||||
public Road()
|
||||
{
|
||||
ImagePath = imagePath;
|
||||
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png";
|
||||
Image = new Image
|
||||
{
|
||||
Source = new BitmapImage(new Uri(ImagePath))
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user