67,68,70,75 Usunięta lista wyboru kolorów, okienko z właświwościami owoców, optymalizacja stronnicowania, input formularza #24

Merged
s434786 merged 1 commits from s442333/DINO_SCRUM:master into master 2019-01-24 01:36:10 +01:00
4 changed files with 37 additions and 7 deletions
Showing only changes of commit c73fd4e058 - Show all commits

View File

@ -1,8 +1,10 @@
using System;
using Magazyn.Tools;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
namespace Magazyn.DataModels
@ -79,6 +81,7 @@ namespace Magazyn.DataModels
public Fruit(int id, string name, int quantity, int quantityMax, float price, string imageLink)
{
this.id = id;
this.name = name;
this.quantity = quantity;
@ -86,11 +89,7 @@ namespace Magazyn.DataModels
this.price = price;
this.imageLink = imageLink;
imageSource = new BitmapImage();
imageSource.BeginInit();
imageSource.UriSource = new Uri(imageLink);
imageSource.CacheOption = BitmapCacheOption.OnLoad;
imageSource.EndInit();
imageSource = CacheImage.GetImageSource(new Uri(imageLink));
}
}
}

View File

@ -67,6 +67,7 @@
</ApplicationDefinition>
<Compile Include="DataModels\Fruit.cs" />
<Compile Include="DataModels\WarehousePrice.cs" />
<Compile Include="Tools\CacheImage.cs" />
<Compile Include="Views\FruitView.xaml.cs">
<DependentUpon>FruitView.xaml</DependentUpon>
</Compile>

View File

@ -20,6 +20,7 @@ using Newtonsoft.Json.Linq;
using System.Net;
using Magazyn.Windows;
using Magazyn.Tools;
namespace Magazyn
{

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
namespace Magazyn.Tools
{
class CacheImage
{
static Dictionary<Uri, BitmapImage> dic = new Dictionary<Uri, BitmapImage>();
static public BitmapImage GetImageSource( Uri url )
{
if (dic.Keys.Contains<Uri>(url)) return dic[url];
else
{
BitmapImage imageSource = new BitmapImage();
imageSource.BeginInit();
imageSource.UriSource = url;
imageSource.CacheOption = BitmapCacheOption.OnLoad;
imageSource.EndInit();
dic.Add(url, imageSource);
return imageSource;
}
}
}
}