Czoko_Smieciarka/Trunk/Interface/CzokoŚmieciarka.WPF/Models/GarbageCollectorWPF.cs

56 lines
1.8 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using System.Windows.Media.Imaging;
2019-03-27 00:49:55 +01:00
using CzokoŚmieciarka.DataModels.Enums;
using CzokoŚmieciarka.DataModels.GeneralModels.Models;
using CzokoŚmieciarka.DataModels.Models;
using CzokoŚmieciarka.WPF.Annotations;
2019-03-26 22:47:45 +01:00
using CzokoŚmieciarka.WPF.Interfaces;
namespace CzokoŚmieciarka.WPF.Models
{
2019-03-26 22:47:45 +01:00
public class GarbageCollectorWPF : AObject, INotifyPropertyChanged
{
2019-03-27 00:49:55 +01:00
public void Move(int columns, Direction direction)
{
2019-03-27 00:49:55 +01:00
switch (direction)
{
case (Direction.Up):
Location.Y = Location.Y + (-1 * columns);
break;
case (Direction.Down):
Location.Y = Location.Y + (1 * columns);
break;
case (Direction.Left):
Location.X = Location.X + (-1);
break;
case (Direction.Right):
Location.X = Location.X + (1);
break;
}
}
2019-03-20 18:27:11 +01:00
public GarbageCollectorWPF(int columns,Coords location, string imagePath)
{
2019-03-20 18:27:11 +01:00
Location = new Coords(location.X, location.Y * columns);
ImagePath = imagePath;
Image = new ImageBrush(new BitmapImage(new Uri(ImagePath)));
}
public event PropertyChangedEventHandler PropertyChanged;
[NotifyPropertyChangedInvocator]
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}
}