2019-03-27 15:54:50 +01:00
|
|
|
|
using System;
|
2019-04-01 23:10:31 +02:00
|
|
|
|
using System.Collections;
|
2019-03-27 15:54:50 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using System.Windows.Navigation;
|
|
|
|
|
using System.Windows.Shapes;
|
2019-04-01 23:10:31 +02:00
|
|
|
|
using CzokoŚmieciarka.DataModels.GeneralModels.Models;
|
2019-04-01 23:47:13 +02:00
|
|
|
|
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
|
2019-04-01 23:10:31 +02:00
|
|
|
|
using CzokoŚmieciarka.DataModels.Models;
|
2019-04-01 21:53:06 +02:00
|
|
|
|
using CzokoŚmieciarka.WPFv2.Interfaces;
|
|
|
|
|
using CzokoŚmieciarka.WPFv2.Models;
|
2019-03-27 15:54:50 +01:00
|
|
|
|
|
|
|
|
|
namespace CzokoŚmieciarka.WPFv2
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for MainWindow.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class MainWindow : Window
|
|
|
|
|
{
|
2019-04-01 21:53:06 +02:00
|
|
|
|
public static int Columns = 9;
|
|
|
|
|
public static int Rows = 9;
|
|
|
|
|
IWPFObject[,] Objects = new IWPFObject[Columns,Rows];
|
2019-04-02 16:14:33 +02:00
|
|
|
|
private IEnumerable<AGarbageCollectorContainer> GarbageCollectorContainers;
|
|
|
|
|
private WPFGarbageCollector garbageCollector;
|
|
|
|
|
|
2019-03-27 15:54:50 +01:00
|
|
|
|
public MainWindow()
|
|
|
|
|
{
|
|
|
|
|
ColumnDefinition column;
|
|
|
|
|
RowDefinition row;
|
|
|
|
|
InitializeComponent();
|
2019-04-01 21:53:06 +02:00
|
|
|
|
for(int i = 0; i < Rows; i++)
|
2019-03-27 15:54:50 +01:00
|
|
|
|
{
|
|
|
|
|
column = new ColumnDefinition();
|
|
|
|
|
row = new RowDefinition();
|
|
|
|
|
Board.ColumnDefinitions.Add(column);
|
|
|
|
|
Board.RowDefinitions.Add(row);
|
2019-04-01 23:47:13 +02:00
|
|
|
|
column = new ColumnDefinition();
|
|
|
|
|
row = new RowDefinition();
|
|
|
|
|
CollectorBoard.ColumnDefinitions.Add(column);
|
|
|
|
|
CollectorBoard.RowDefinitions.Add(row);
|
2019-04-01 21:53:06 +02:00
|
|
|
|
for (int j = 0; j < Columns; j++)
|
|
|
|
|
{
|
2019-04-01 23:10:31 +02:00
|
|
|
|
Road road = new Road();
|
2019-04-01 21:53:06 +02:00
|
|
|
|
Objects[i, j] = road;
|
2019-04-01 23:10:31 +02:00
|
|
|
|
Grid.SetRow(Objects[i,j].Image, i);
|
|
|
|
|
Grid.SetColumn(Objects[i, j].Image, j);
|
|
|
|
|
Board.Children.Add(Objects[i, j].Image);
|
2019-04-01 21:53:06 +02:00
|
|
|
|
}
|
2019-04-01 23:10:31 +02:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
2019-03-27 15:54:50 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for(int rows = 0; rows < 3; rows++)
|
|
|
|
|
{
|
|
|
|
|
row = new RowDefinition();
|
|
|
|
|
CollectorInfo.RowDefinitions.Add(row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (int columns = 0; columns < 2; columns++)
|
|
|
|
|
{
|
|
|
|
|
column = new ColumnDefinition();
|
|
|
|
|
CollectorInfo.ColumnDefinitions.Add(column);
|
|
|
|
|
}
|
|
|
|
|
CollectorInfo.ShowGridLines = true;
|
2019-04-02 16:14:33 +02:00
|
|
|
|
GarbageCollectorContainers = new List<AGarbageCollectorContainer>();
|
|
|
|
|
garbageCollector = new WPFGarbageCollector(new Coords(2, 1), GarbageCollectorContainers);
|
2019-04-01 23:47:13 +02:00
|
|
|
|
Grid.SetRow(garbageCollector.Image, garbageCollector.Position.Y);
|
|
|
|
|
Grid.SetColumn(garbageCollector.Image, garbageCollector.Position.X);
|
|
|
|
|
CollectorBoard.Children.Add(garbageCollector.Image);
|
|
|
|
|
CollectorBoard.ShowGridLines = true;
|
|
|
|
|
|
2019-03-27 15:54:50 +01:00
|
|
|
|
}
|
2019-04-02 16:14:33 +02:00
|
|
|
|
|
|
|
|
|
private void MainWindow_OnKeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if (e.Key == Key.Space)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2019-03-27 15:54:50 +01:00
|
|
|
|
}
|
|
|
|
|
}
|