2019-03-13 16:45:38 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
2019-03-20 16:51:35 +01:00
|
|
|
|
using System.Threading;
|
2019-03-13 16:45:38 +01:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
2019-03-14 16:24:37 +01:00
|
|
|
|
using System.Windows.Controls.Primitives;
|
2019-03-13 16:45:38 +01:00
|
|
|
|
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-03-20 16:02:05 +01:00
|
|
|
|
using CzokoŚmieciarka.DataModels.GeneralModels.Models;
|
|
|
|
|
using CzokoŚmieciarka.DataModels.Interfaces;
|
|
|
|
|
using CzokoŚmieciarka.DataModels.Interfaces.TrashCans;
|
2019-03-20 12:34:03 +01:00
|
|
|
|
using CzokoŚmieciarka.DataModels.Models;
|
2019-03-13 16:45:38 +01:00
|
|
|
|
using CzokoŚmieciarka.WPF.Models;
|
|
|
|
|
|
|
|
|
|
namespace CzokoŚmieciarka.WPF
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for MainWindow.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class MainWindow : Window
|
|
|
|
|
{
|
2019-03-20 12:34:03 +01:00
|
|
|
|
public List<IObject> Objects = new List<IObject>();
|
2019-03-20 16:02:05 +01:00
|
|
|
|
public GarbageCollector garbageCollector = new GarbageCollector(new Coords(0,0), new List<AGarbageCollectorContainer>());
|
2019-03-20 16:51:35 +01:00
|
|
|
|
public Board board;
|
2019-03-20 18:27:11 +01:00
|
|
|
|
private int rows = 9;
|
|
|
|
|
private int columns = 9;
|
2019-03-20 12:34:03 +01:00
|
|
|
|
|
2019-03-13 16:45:38 +01:00
|
|
|
|
public MainWindow()
|
|
|
|
|
{
|
|
|
|
|
|
2019-03-20 12:34:03 +01:00
|
|
|
|
InitializeComponent();
|
2019-03-20 18:27:11 +01:00
|
|
|
|
Objects.Add(new House(columns, new Coords(3, 2)));
|
|
|
|
|
Objects.Add(new House(columns, new Coords(5, 8)));
|
|
|
|
|
Objects.Add(new House(columns, new Coords(7, 5)));
|
|
|
|
|
Objects.Add(new DumpWPF(columns, new Coords(2, 4), new TypeOfGarbage("glass",0,0)));
|
|
|
|
|
Objects.Add(new DumpWPF(columns, new Coords(2, 5), new TypeOfGarbage("plasticmetal", 0, 0)));
|
|
|
|
|
Objects.Add(new DumpWPF(columns, new Coords(3, 4), new TypeOfGarbage("organic", 0, 0)));
|
|
|
|
|
Objects.Add(new DumpWPF(columns, new Coords(3, 5), new TypeOfGarbage("paper", 0, 0)));
|
|
|
|
|
|
|
|
|
|
board = new Board(Objects, garbageCollector);
|
|
|
|
|
this.DataContext = board;
|
2019-03-13 16:45:38 +01:00
|
|
|
|
}
|
2019-03-20 16:02:05 +01:00
|
|
|
|
|
2019-03-20 16:51:35 +01:00
|
|
|
|
private void MainWindow_OnKeyDown(object sender, KeyEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (e.Key == Key.Up)
|
|
|
|
|
{
|
|
|
|
|
garbageCollector.Position.Y -= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.Key == Key.Down)
|
|
|
|
|
{
|
|
|
|
|
garbageCollector.Position.Y += 1;
|
|
|
|
|
}
|
|
|
|
|
if (e.Key == Key.Left)
|
|
|
|
|
{
|
|
|
|
|
garbageCollector.Position.X -= 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (e.Key == Key.Right)
|
|
|
|
|
{
|
|
|
|
|
garbageCollector.Position.X += 1;
|
|
|
|
|
}
|
2019-03-20 18:27:11 +01:00
|
|
|
|
//board = board.BoardRefresh(Objects, garbageCollector);
|
|
|
|
|
//this.DataContext = board;
|
|
|
|
|
this.DataContext = new Board(Objects, garbageCollector);
|
2019-03-20 16:51:35 +01:00
|
|
|
|
}
|
2019-03-13 16:45:38 +01:00
|
|
|
|
}
|
|
|
|
|
}
|