Wyświetlanie Śmieciary na drugim gridzie

This commit is contained in:
Michał Dulski 2019-04-01 23:47:13 +02:00
parent f08775224a
commit 18e2eb092c
3 changed files with 20 additions and 7 deletions

View File

@ -8,8 +8,8 @@
Title="MainWindow" Height="800" Width="1000"> Title="MainWindow" Height="800" Width="1000">
<Grid> <Grid>
<Grid Name="Board" Margin="0,0,200,0"/> <Grid Name="Board" Margin="0,0,200,0"/>
<Grid Name="CollectorInfo" Margin="800,0,0,0"> <Grid Name="CollectorInfo" Margin="800,0,0,0"/>
<Grid Name="CollectorBoard" Margin="0,0,200,0"/>
</Grid>
</Grid> </Grid>
</Window> </Window>

View File

@ -14,6 +14,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using CzokoŚmieciarka.DataModels.GeneralModels.Models; using CzokoŚmieciarka.DataModels.GeneralModels.Models;
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
using CzokoŚmieciarka.DataModels.Models; using CzokoŚmieciarka.DataModels.Models;
using CzokoŚmieciarka.WPFv2.Interfaces; using CzokoŚmieciarka.WPFv2.Interfaces;
using CzokoŚmieciarka.WPFv2.Models; using CzokoŚmieciarka.WPFv2.Models;
@ -39,6 +40,10 @@ namespace CzokoŚmieciarka.WPFv2
row = new RowDefinition(); row = new RowDefinition();
Board.ColumnDefinitions.Add(column); Board.ColumnDefinitions.Add(column);
Board.RowDefinitions.Add(row); Board.RowDefinitions.Add(row);
column = new ColumnDefinition();
row = new RowDefinition();
CollectorBoard.ColumnDefinitions.Add(column);
CollectorBoard.RowDefinitions.Add(row);
for (int j = 0; j < Columns; j++) for (int j = 0; j < Columns; j++)
{ {
Road road = new Road(); Road road = new Road();
@ -57,7 +62,6 @@ namespace CzokoŚmieciarka.WPFv2
} }
Board.ShowGridLines = true;
for(int rows = 0; rows < 3; rows++) for(int rows = 0; rows < 3; rows++)
{ {
row = new RowDefinition(); row = new RowDefinition();
@ -70,6 +74,13 @@ namespace CzokoŚmieciarka.WPFv2
CollectorInfo.ColumnDefinitions.Add(column); CollectorInfo.ColumnDefinitions.Add(column);
} }
CollectorInfo.ShowGridLines = true; CollectorInfo.ShowGridLines = true;
IEnumerable<AGarbageCollectorContainer> GarbageCollectorContainers = new List<AGarbageCollectorContainer>();
WPFGarbageCollector garbageCollector = new WPFGarbageCollector(new Coords(2,1), GarbageCollectorContainers);
Grid.SetRow(garbageCollector.Image, garbageCollector.Position.Y);
Grid.SetColumn(garbageCollector.Image, garbageCollector.Position.X);
CollectorBoard.Children.Add(garbageCollector.Image);
CollectorBoard.ShowGridLines = true;
} }
} }
} }

View File

@ -21,9 +21,11 @@ namespace CzokoŚmieciarka.WPFv2.Models
public WPFGarbageCollector(Coords startPosition, IEnumerable<AGarbageCollectorContainer> trashContainers) : base(startPosition, trashContainers) public WPFGarbageCollector(Coords startPosition, IEnumerable<AGarbageCollectorContainer> trashContainers) : base(startPosition, trashContainers)
{ {
ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png"; ImagePath = AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png";
Image = new Image(); Image = new Image
Image.Source = {
new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory + @"..\..\Images\garbageCollector.png")); Source = new BitmapImage(new Uri(AppDomain.CurrentDomain.BaseDirectory +
@"..\..\Images\garbageCollector.png"))
};
} }
} }
} }