diff --git a/Magazyn_Client/Magazyn.sln b/Magazyn_Client/Magazyn.sln
index a13e6c2..5a64ce9 100644
--- a/Magazyn_Client/Magazyn.sln
+++ b/Magazyn_Client/Magazyn.sln
@@ -11,10 +11,10 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {C50EC6F3-86E6-405C-991F-1B4157C04B34}.Debug|Any CPU.ActiveCfg = Release|Any CPU
- {C50EC6F3-86E6-405C-991F-1B4157C04B34}.Debug|Any CPU.Build.0 = Release|Any CPU
- {C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C50EC6F3-86E6-405C-991F-1B4157C04B34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C50EC6F3-86E6-405C-991F-1B4157C04B34}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.ActiveCfg = Debug|Any CPU
+ {C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/Magazyn_Client/Magazyn/App.xaml b/Magazyn_Client/Magazyn/App.xaml
index 309f94e..c3abefc 100644
--- a/Magazyn_Client/Magazyn/App.xaml
+++ b/Magazyn_Client/Magazyn/App.xaml
@@ -6,11 +6,11 @@
-
-
-
-
-
+
+
+
+
+
diff --git a/Magazyn_Client/Magazyn/App.xaml.cs b/Magazyn_Client/Magazyn/App.xaml.cs
index 64ce2f8..7e0f6a5 100644
--- a/Magazyn_Client/Magazyn/App.xaml.cs
+++ b/Magazyn_Client/Magazyn/App.xaml.cs
@@ -5,6 +5,7 @@ using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
+using System.Windows.Media.Imaging;
namespace Magazyn
{
@@ -13,39 +14,7 @@ namespace Magazyn
///
public partial class App : Application
{
- public void ChangeTheme(int index)
- {
- Resources.MergedDictionaries.Clear();
- Uri[] uris = new Uri[4];
-
- uris[1] = new Uri("pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml");
-
- switch (index % 3) {
- case 0:
- uris[0] = new Uri("pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml");
- uris[2] = new Uri("pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml");
- uris[3] = new Uri("pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Cyan.xaml");
- break;
-
- case 1:
- uris[0] = new Uri("pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml");
- uris[2] = new Uri("pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Lime.xaml");
- uris[3] = new Uri("pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Green.xaml");
- break;
-
- case 2:
- uris[0] = new Uri("pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Dark.xaml");
- uris[2] = new Uri("pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.DeepOrange.xaml");
- uris[3] = new Uri("pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Orange.xaml");
- break;
- }
-
- Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = uris[0] });
- Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = uris[1] });
- Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = uris[2] });
- Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = uris[3] });
-
- }
+
}
}
diff --git a/Magazyn_Client/Magazyn/DataModels/Fruit.cs b/Magazyn_Client/Magazyn/DataModels/Fruit.cs
index 6c97d6a..47194f4 100644
--- a/Magazyn_Client/Magazyn/DataModels/Fruit.cs
+++ b/Magazyn_Client/Magazyn/DataModels/Fruit.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using System.Windows.Media.Imaging;
namespace Magazyn.DataModels
{
@@ -11,10 +12,14 @@ namespace Magazyn.DataModels
int id;
string name;
int quantity;
- float price;
+ int quantityMax;
+ float price;
string imageLink;
- public int Id
+ BitmapImage imageSource;
+
+
+ public int Id
{
get
{
@@ -38,7 +43,16 @@ namespace Magazyn.DataModels
}
}
- public float Price
+ public int QuantityMax
+ {
+ get
+ {
+ return quantityMax;
+ }
+ }
+
+
+ public float Price
{
get
{
@@ -54,13 +68,29 @@ namespace Magazyn.DataModels
}
}
- public Fruit(int id, string name, int quantity, float price, string imageLink)
+ public BitmapImage ImageSource
+ {
+ get
+ {
+ return imageSource;
+ }
+
+ }
+
+ public Fruit(int id, string name, int quantity, int quantityMax, float price, string imageLink)
{
this.id = id;
this.name = name;
this.quantity = quantity;
- this.price = price;
+ this.quantityMax = quantityMax;
+ this.price = price;
this.imageLink = imageLink;
- }
+
+ imageSource = new BitmapImage();
+ imageSource.BeginInit();
+ imageSource.UriSource = new Uri(imageLink);
+ imageSource.CacheOption = BitmapCacheOption.OnLoad;
+ imageSource.EndInit();
+ }
}
}
diff --git a/Magazyn_Client/Magazyn/Magazyn.csproj b/Magazyn_Client/Magazyn/Magazyn.csproj
index 939a4e8..94e47cb 100644
--- a/Magazyn_Client/Magazyn/Magazyn.csproj
+++ b/Magazyn_Client/Magazyn/Magazyn.csproj
@@ -76,6 +76,9 @@
ErrorWindow.xaml
+
+ InfoWindow.xaml
+
ValueWindow.xaml
@@ -103,6 +106,10 @@
Designer
MSBuild:Compile
+
+ Designer
+ MSBuild:Compile
+
Designer
MSBuild:Compile
diff --git a/Magazyn_Client/Magazyn/MainWindow.xaml b/Magazyn_Client/Magazyn/MainWindow.xaml
index 97485f3..6df635d 100644
--- a/Magazyn_Client/Magazyn/MainWindow.xaml
+++ b/Magazyn_Client/Magazyn/MainWindow.xaml
@@ -15,24 +15,23 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Magazyn"
mc:Ignorable="d"
- Title="Magazyn Owoców" Height="500" MaxWidth="590" MinWidth="590" Width="590" SizeChanged="Window_SizeChanged">
-
-
+ Title="Magazyn Owoców" MinHeight="259" Height="500" MaxWidth="590" MinWidth="590" Width="590" >
+
+
+
+
+
-
-
-
+
-
+
+
-
-
-
-
-
-
+
+
+
-
+
diff --git a/Magazyn_Client/Magazyn/MainWindow.xaml.cs b/Magazyn_Client/Magazyn/MainWindow.xaml.cs
index 5cc8b41..6902005 100644
--- a/Magazyn_Client/Magazyn/MainWindow.xaml.cs
+++ b/Magazyn_Client/Magazyn/MainWindow.xaml.cs
@@ -23,146 +23,160 @@ using Magazyn.Windows;
namespace Magazyn
{
- public partial class MainWindow : Window
- {
+ public partial class MainWindow : Window
+ {
- public int size = 4;
- public int page = 0;
+ public int size = 4;
+ public int page = 0;
- bool firstPage;
- bool lastPage;
+ bool firstPage;
+ bool lastPage;
- HttpClient client;
+ HttpClient client;
- public MainWindow()
- {
- InitializeComponent();
- this.Initialized += MainWindow_Initialized;
- themeCombo.Items.Add("Jasno/Niebieski");
- themeCombo.Items.Add("Jasno/Zielony");
- themeCombo.Items.Add("Ciemno/Pomarańczowy");
- themeCombo.SelectedIndex = 0;
+ Size windowSize;
- client = new HttpClient();
- }
+ public MainWindow()
+ {
+ InitializeComponent();
+ client = new HttpClient();
+ this.Loaded += MainWindowLoaded;
+ }
- private void MainWindow_Initialized(object sender, EventArgs e)
- {
- RefreshListOfFruits();
- }
+ private void MainWindowLoaded(object sender, EventArgs e)
+ {
+ RefreshListOfFruits();
+ windowSize = new Size(this.Width, this.Height);
+ this.SizeChanged += Window_SizeChanged;
+ }
- private void FruitViewSaveChangingAmountOfFruits(int amountChanged, Fruit fruit)
- {
- string json = "{\"id\": " + fruit.Id.ToString() + ", \"change\": " + amountChanged.ToString() + " }";
+ private void FruitViewSaveChangingAmountOfFruits(int amountChanged, Fruit fruit)
+ {
+ string json = "{\"id\": " + fruit.Id.ToString() + ", \"change\": " + amountChanged.ToString() + " }";
- Task response = client.PostAsync("https://sysmag.herokuapp.com/api/product/change-quantity", new StringContent(json, Encoding.UTF8, "application/json"));
- while (response.IsCompleted != true) ;
+ Task response = client.PostAsync("https://sysmag.herokuapp.com/api/product/change-quantity", new StringContent(json, Encoding.UTF8, "application/json"));
+ while (response.IsCompleted != true) ;
- if (response.Result.StatusCode == HttpStatusCode.BadRequest)
- {
- JObject data = JObject.Parse(response.Result.Content.ReadAsStringAsync().Result.ToString());
+ if (response.Result.StatusCode == HttpStatusCode.BadRequest)
+ {
+ JObject data = JObject.Parse(response.Result.Content.ReadAsStringAsync().Result.ToString());
- ErrorWindow window;
+ ErrorWindow window;
- if (data["message"].ToString().Contains("Too low"))
- {
- window = new ErrorWindow("Wystąpił błąd niedomiaru. Próbujesz usunąć więcej owoców niż masz w magazynie.");
- }
- else if (data["message"].ToString().Contains("Over max"))
- {
- window = new ErrorWindow("Wystąpił błąd nadmiaru. Próbujesz dodać więcej owoców niż pomieści magazyn.");
- }
- else
- {
- window = new ErrorWindow("Nieznany błąd.");
- }
- window.Owner = this;
- window.ShowDialog();
- }
+ if (data["message"].ToString().Contains("Too low"))
+ {
+ window = new ErrorWindow("Wystąpił błąd niedomiaru. Próbujesz usunąć więcej owoców niż masz w magazynie.");
+ }
+ else if (data["message"].ToString().Contains("Over max"))
+ {
+ window = new ErrorWindow("Wystąpił błąd nadmiaru. Próbujesz dodać więcej owoców niż pomieści magazyn.");
+ }
+ else
+ {
+ window = new ErrorWindow("Nieznany błąd.");
+ }
+ window.Owner = this;
+ window.ShowDialog();
+ }
- RefreshListOfFruits();
- }
+ RefreshListOfFruits();
+ }
- private void RefreshListOfFruits()
- {
+ private void RefreshListOfFruits()
+ {
+ pageBlock.Text = page.ToString();
- Task response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all?page=" + page.ToString() + "&size=" + size.ToString());
- while (response.IsCompleted != true) ;
+ Task response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all?page=" + page.ToString() + "&size=" + size.ToString());
+ while (response.IsCompleted != true) ;
- if (response.Result.StatusCode != HttpStatusCode.OK)
- {
- ErrorWindow window = new ErrorWindow("Nastąpił błąd połączenia z serwerem.");
- window.Owner = this;
- window.ShowDialog();
- return;
- }
+ if (response.Result.StatusCode != HttpStatusCode.OK)
+ {
+ ErrorWindow window = new ErrorWindow("Nastąpił błąd połączenia z serwerem.");
+ window.Owner = this;
+ window.ShowDialog();
- string responseString = response.Result.Content.ReadAsStringAsync().Result;
+ page = 0;
+ size = 0;
- JObject replay = JObject.Parse(responseString);
+ return;
+ }
- firstPage = bool.Parse(replay["first"].ToString());
- lastPage = bool.Parse(replay["last"].ToString());
+ string responseString = response.Result.Content.ReadAsStringAsync().Result;
- Fruit[] fruits = JsonConvert.DeserializeObject(replay["content"].ToString());
+ JObject replay = JObject.Parse(responseString);
- UpdateListOfFruits(fruits);
- }
+ firstPage = bool.Parse(replay["first"].ToString());
+ lastPage = bool.Parse(replay["last"].ToString());
- private void UpdateListOfFruits(Fruit[] list)
- {
- fruitList.Items.Clear();
+ Fruit[] fruits = JsonConvert.DeserializeObject(replay["content"].ToString());
- foreach (Fruit item in list)
- {
- FruitView fruitView = new FruitView(item);
- fruitView.SaveChangingAmountOfFruits += FruitViewSaveChangingAmountOfFruits;
- fruitList.Items.Add(fruitView);
- }
- }
+ UpdateListOfFruits(fruits);
+ }
- private WarehousePrice GetWarehousePrice()
- {
- Task response = client.GetAsync("https://sysmag.herokuapp.com/api/get-price-of-all");
- while (response.IsCompleted != true) ;
+ private void UpdateListOfFruits(Fruit[] list)
+ {
+ fruitList.Items.Clear();
- WarehousePrice price = JsonConvert.DeserializeObject(response.Result.Content.ReadAsStringAsync().Result.ToString());
+ foreach (Fruit item in list)
+ {
+ FruitView fruitView = new FruitView(item);
+ fruitView.SaveChangingAmountOfFruits += FruitViewSaveChangingAmountOfFruits;
+ fruitList.Items.Add(fruitView);
+ }
+ }
- return price;
- }
+ private WarehousePrice GetWarehousePrice()
+ {
+ Task response = client.GetAsync("https://sysmag.herokuapp.com/api/get-price-of-all");
+ while (response.IsCompleted != true) ;
- private void Value_Click(object sender, RoutedEventArgs e)
- {
- ValueWindow window = new ValueWindow(GetWarehousePrice().Price);
- window.Owner = this;
- window.ShowDialog();
- }
+ WarehousePrice price = JsonConvert.DeserializeObject(response.Result.Content.ReadAsStringAsync().Result.ToString());
- private void prevButton_Click(object sender, RoutedEventArgs e)
- {
- if (firstPage != true) page--;
- RefreshListOfFruits();
- }
+ return price;
+ }
- private void nextButton_Click(object sender, RoutedEventArgs e)
- {
- if (lastPage != true) page++;
- RefreshListOfFruits();
- }
+ private void Value_Click(object sender, RoutedEventArgs e)
+ {
+ ValueWindow window = new ValueWindow(GetWarehousePrice().Price);
+ window.Owner = this;
+ window.ShowDialog();
+ }
- private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
- {
- Size size = e.NewSize;
- double height = size.Height - 124;
- this.size = (int)(height / 90);
- RefreshListOfFruits();
- }
+ private void prevButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (firstPage != true) page--;
+ RefreshListOfFruits();
+ }
- private void themeCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- var app = App.Current as App;
- app.ChangeTheme(themeCombo.SelectedIndex);
- }
- }
+ private void nextButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (lastPage != true) page++;
+ RefreshListOfFruits();
+ }
+
+ private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ Size size = e.NewSize;
+
+ if( Math.Abs(windowSize.Height - size.Height) >= 40 )
+ {
+ //size -> number of elementy by page
+ this.size = (int)((size.Height - 124) / 80);
+ page = 0;
+ windowSize = size;
+ RefreshListOfFruits();
+ }
+ }
+
+ private void fruitListMouseDoubleClick(object sender, MouseButtonEventArgs e)
+ {
+ if (fruitList.SelectedItem != null)
+ {
+ InfoWindow window = new InfoWindow((fruitList.SelectedItem as FruitView).fruit);
+ window.Owner = this;
+ window.ShowDialog();
+ }
+ }
+ }
}
diff --git a/Magazyn_Client/Magazyn/Views/FruitView.xaml.cs b/Magazyn_Client/Magazyn/Views/FruitView.xaml.cs
index 653e228..70d0d23 100644
--- a/Magazyn_Client/Magazyn/Views/FruitView.xaml.cs
+++ b/Magazyn_Client/Magazyn/Views/FruitView.xaml.cs
@@ -24,7 +24,7 @@ namespace Magazyn.Views
///
public partial class FruitView : UserControl
{
- Fruit fruit;
+ public Fruit fruit;
public delegate void ChangingAmountOfFruits(int amountChanged, Fruit fruit);
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
@@ -42,18 +42,18 @@ namespace Magazyn.Views
try
{
- fruitImage.Source = new BitmapImage(new Uri(fruit.ImageLink));
- }
+ fruitImage.Source = fruit.ImageSource;
+ }
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
- }
+ }
- private void subaddButton_Click(object sender, RoutedEventArgs e)
+ private void subaddButton_Click(object sender, RoutedEventArgs e)
{
- AmountWindow window = new AmountWindow(fruit, ((sender as Image).Name == "minusImage")?-1:1, fruit.Quantity);
+ AmountWindow window = new AmountWindow(fruit, ((sender as Image).Name == "minusImage")?-1:1, fruit.Quantity);
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
window.Owner = Application.Current.MainWindow;
window.ShowDialog();
diff --git a/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml b/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml
index 5d4b456..936dd51 100644
--- a/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml
+++ b/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml
@@ -15,14 +15,14 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Magazyn.Windows"
mc:Ignorable="d"
- Title="Magazyn" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize" Keyboard.KeyDown="Window_KeyDown">
-
-
-
-
-
-
-
+ Title="" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize" Keyboard.KeyDown="Window_KeyDown">
+
+
+
+
+
+
+
diff --git a/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml.cs b/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml.cs
index 9c58f14..c3ac79c 100644
--- a/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml.cs
+++ b/Magazyn_Client/Magazyn/Windows/AmountWindow.xaml.cs
@@ -15,85 +15,94 @@ using System.Windows.Shapes;
namespace Magazyn.Windows
{
- ///
- /// Interaction logic for AmountWindow.xaml
- ///
- ///
+ ///
+ /// Interaction logic for AmountWindow.xaml
+ ///
+ ///
- public partial class AmountWindow : Window
- {
- Fruit fruit;
- int type;
- int quantity;
+ public partial class AmountWindow : Window
+ {
+ Fruit fruit;
+ int type;
+ int quantity;
- public delegate void ChangingAmountOfFruits(int amountChanged);
- public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
+ public delegate void ChangingAmountOfFruits(int amountChanged);
+ public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
- public AmountWindow(Fruit fruit, int type, int quantity)
- {
- InitializeComponent();
- this.fruit = fruit;
- this.type = type;
+ bool focusLock = false;
- this.quantity = quantity;
+ public AmountWindow(Fruit fruit, int type, int quantity)
+ {
+ InitializeComponent();
+ this.fruit = fruit;
+ this.type = type;
- if (type == -1)
- this.Title = "Zmniejsz ilość: " + fruit.Name;
- else
- this.Title = "Zwiększ ilość: " + fruit.Name;
+ this.quantity = quantity;
- fruitName.Text = fruit.Name;
+ if (type == -1)
+ this.Title = "Zmniejsz ilość: " + fruit.Name;
+ else
+ this.Title = "Zwiększ ilość: " + fruit.Name;
- messageBox.Text = String.Format("Jaką ilość produktu chcesz {0} do magazynu?", (type > 0) ? "dodać" : "odjąć");
+ fruitName.Text = fruit.Name;
- try
- {
- fruitImage.Source = new BitmapImage(new Uri(fruit.ImageLink));
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
+ messageBox.Text = String.Format("Jaką ilość produktu chcesz {0} do magazynu?", (type > 0) ? "dodać" : "odjąć");
- }
+ try
+ {
+ fruitImage.Source = fruit.ImageSource;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
- private void SendNewQuantity()
- {
- int amount = int.Parse(amountToChange.Text);
- try
- {
- if (amount < 0)
- {
- ErrorWindow window = new ErrorWindow("Podana wartość jest nieprawidłowa, proszę podać wartość dodatnią.");
- window.Owner = Application.Current.MainWindow;
- window.ShowDialog();
- amountToChange.Text = "0";
- return;
- }
+ this.Loaded += AmountWindowLoaded;
- }
- catch (Exception ex)
- {
- throw new NotImplementedException(ex.Message);
- }
+ }
- SaveChangingAmountOfFruits.Invoke((type > 0) ? amount : -amount);
- this.Close();
- }
+ private void AmountWindowLoaded(object sender, RoutedEventArgs e)
+ {
+ amountToChange.Focus();
+ }
- private void saveButton_Click(object sender, RoutedEventArgs e)
- {
- SendNewQuantity();
- }
+ private void SendNewQuantity()
+ {
+ int amount = int.Parse(amountToChange.Text);
+ try
+ {
+ if (amount < 0)
+ {
+ ErrorWindow window = new ErrorWindow("Podana wartość jest nieprawidłowa, proszę podać wartość dodatnią.");
+ window.Owner = Application.Current.MainWindow;
+ window.ShowDialog();
+ amountToChange.Text = "0";
+ return;
+ }
- private void cancelButton_Click(object sender, RoutedEventArgs e)
- {
- this.Close();
- }
+ }
+ catch (Exception ex)
+ {
+ throw new NotImplementedException(ex.Message);
+ }
- private void Window_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.Key == Key.Return) SendNewQuantity();
- }
- }
+ SaveChangingAmountOfFruits.Invoke((type > 0) ? amount : -amount);
+ this.Close();
+ }
+
+ private void saveButton_Click(object sender, RoutedEventArgs e)
+ {
+ SendNewQuantity();
+ }
+
+ private void cancelButton_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+
+ private void Window_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Return) SendNewQuantity();
+ }
+ }
}
diff --git a/Magazyn_Client/Magazyn/Windows/ErrorWindow.xaml b/Magazyn_Client/Magazyn/Windows/ErrorWindow.xaml
index ef49a77..599811e 100644
--- a/Magazyn_Client/Magazyn/Windows/ErrorWindow.xaml
+++ b/Magazyn_Client/Magazyn/Windows/ErrorWindow.xaml
@@ -15,7 +15,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Magazyn.Windows"
mc:Ignorable="d"
- Title="Błąd" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize">
+ Title="Błąd" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize">
diff --git a/Magazyn_Client/Magazyn/Windows/InfoWindow.xaml b/Magazyn_Client/Magazyn/Windows/InfoWindow.xaml
new file mode 100644
index 0000000..a627cc5
--- /dev/null
+++ b/Magazyn_Client/Magazyn/Windows/InfoWindow.xaml
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Magazyn_Client/Magazyn/Windows/InfoWindow.xaml.cs b/Magazyn_Client/Magazyn/Windows/InfoWindow.xaml.cs
new file mode 100644
index 0000000..cb7de38
--- /dev/null
+++ b/Magazyn_Client/Magazyn/Windows/InfoWindow.xaml.cs
@@ -0,0 +1,53 @@
+using Magazyn.DataModels;
+using System;
+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.Shapes;
+
+namespace Magazyn.Windows
+{
+ ///
+ /// Interaction logic for InfoWindow.xaml
+ ///
+ public partial class InfoWindow : Window
+ {
+ Fruit fruit;
+ public InfoWindow(Fruit fruit)
+ {
+ InitializeComponent();
+ this.fruit = fruit;
+
+ fruitName.Text = "Owoc: " + fruit.Name;
+ this.Title = this.Title + fruit.Name;
+
+ fruitPrice.Text = "Cena: " + fruit.Price.ToString() + "zł";
+ fruitQuantity.Text = "Ilość: " + fruit.Quantity.ToString();
+ fruitQuantityMax.Text = "Ilość maks: " + fruit.QuantityMax.ToString();
+
+ fruitValue.Text = "Wartość: " + (fruit.Price * fruit.Quantity).ToString() + "zł";
+
+ try
+ {
+ fruitImage.Source = fruit.ImageSource;
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show(ex.Message);
+ }
+ }
+
+ private void okButton_Click(object sender, RoutedEventArgs e)
+ {
+ this.Close();
+ }
+ }
+}