2019-01-13 16:36:26 +01:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2019-01-23 22:39:54 +01:00
|
|
|
|
using System.Windows.Media.Imaging;
|
2019-01-13 16:36:26 +01:00
|
|
|
|
|
|
|
|
|
namespace Magazyn.DataModels
|
|
|
|
|
{
|
|
|
|
|
public class Fruit
|
|
|
|
|
{
|
|
|
|
|
int id;
|
|
|
|
|
string name;
|
|
|
|
|
int quantity;
|
2019-01-23 22:39:54 +01:00
|
|
|
|
int quantityMax;
|
|
|
|
|
float price;
|
2019-01-13 16:36:26 +01:00
|
|
|
|
string imageLink;
|
|
|
|
|
|
2019-01-23 22:39:54 +01:00
|
|
|
|
BitmapImage imageSource;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public int Id
|
2019-01-13 16:36:26 +01:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return id;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Name
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return name;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int Quantity
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return quantity;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-23 22:39:54 +01:00
|
|
|
|
public int QuantityMax
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return quantityMax;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public float Price
|
2019-01-13 16:36:26 +01:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return price;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string ImageLink
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return imageLink;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-01-23 22:39:54 +01:00
|
|
|
|
public BitmapImage ImageSource
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return imageSource;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Fruit(int id, string name, int quantity, int quantityMax, float price, string imageLink)
|
2019-01-13 16:36:26 +01:00
|
|
|
|
{
|
|
|
|
|
this.id = id;
|
|
|
|
|
this.name = name;
|
|
|
|
|
this.quantity = quantity;
|
2019-01-23 22:39:54 +01:00
|
|
|
|
this.quantityMax = quantityMax;
|
|
|
|
|
this.price = price;
|
2019-01-13 16:36:26 +01:00
|
|
|
|
this.imageLink = imageLink;
|
2019-01-23 22:39:54 +01:00
|
|
|
|
|
|
|
|
|
imageSource = new BitmapImage();
|
|
|
|
|
imageSource.BeginInit();
|
|
|
|
|
imageSource.UriSource = new Uri(imageLink);
|
|
|
|
|
imageSource.CacheOption = BitmapCacheOption.OnLoad;
|
|
|
|
|
imageSource.EndInit();
|
|
|
|
|
}
|
2019-01-13 16:36:26 +01:00
|
|
|
|
}
|
|
|
|
|
}
|