Zmiana pola Image w modelach

This commit is contained in:
Michał Dulski 2019-04-18 00:43:48 +02:00
parent 57c53b9bdb
commit 9aaa79a5c5
3 changed files with 42 additions and 28 deletions

View File

@ -18,19 +18,23 @@ namespace CzokoŚmieciarka.WPFv2.Models
{ {
class WPFGarbageCollector : AGarbageCollector, IWPFObject, INotifyPropertyChanged class WPFGarbageCollector : AGarbageCollector, IWPFObject, INotifyPropertyChanged
{ {
public Image Image public Image Image { get; set; }
{ //{
get // get
{ // {
return new Image // return new Image
{ // {
Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png")) // Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png"))
}; // };
} // }
} //}
public WPFGarbageCollector(Coords startPosition, IEnumerable<AGarbageCollectorContainer> trashContainers, int columns, int rows) : base(startPosition, trashContainers, columns, rows) public WPFGarbageCollector(Coords startPosition, IEnumerable<AGarbageCollectorContainer> trashContainers, int columns, int rows) : base(startPosition, trashContainers, columns, rows)
{ {
Image = new Image()
{
Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png"))
};
} }
public event PropertyChangedEventHandler PropertyChanged; public event PropertyChangedEventHandler PropertyChanged;

View File

@ -17,17 +17,21 @@ namespace CzokoŚmieciarka.WPFv2.Models
{ {
public Coords Coords { get; set; } public Coords Coords { get; set; }
public IEnumerable<ATrashCan> TrashCans { get; set; } public IEnumerable<ATrashCan> TrashCans { get; set; }
public Image Image { get { public Image Image { get; set; }
return new Image //{ get {
{ // return new Image
Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\house.png")) // {
}; // Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\house.png"))
} } // };
// } }
public WPFHouse(Coords coords, IEnumerable<ATrashCan> trashCans) public WPFHouse(Coords coords, IEnumerable<ATrashCan> trashCans)
{ {
Image = new Image()
{
Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\house.png"))
};
TrashCans = trashCans; TrashCans = trashCans;
Coords = coords; Coords = coords;
} }

View File

@ -13,20 +13,26 @@ namespace CzokoŚmieciarka.WPFv2.Models
{ {
class Road : IWPFObject class Road : IWPFObject
{ {
public Image Image public Image Image { get; set; }
{ //{
get // get
{ // {
return new Image // return new Image
{ // {
Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png")) // Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png"))
}; // };
} // }
} //}
public Coords Coords { get; set; }
public Road() public Road()
{ {
Image = new Image()
{
Source =
new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\intersection.png"))
};
} }
public Coords Coords { get; set; }
} }
} }