From 1465eead0267942209c71b98d8e0945e325e7050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konrad=20Pierzy=C5=84ski?= Date: Wed, 23 Jan 2019 22:39:54 +0100 Subject: [PATCH] Pagination optymalization, infoWindow about fruits, deleted list of themes, focusing keyboard on value input --- Magazyn_Client/Magazyn.sln | 8 +- Magazyn_Client/Magazyn/App.xaml | 10 +- Magazyn_Client/Magazyn/App.xaml.cs | 35 +-- Magazyn_Client/Magazyn/DataModels/Fruit.cs | 42 +++- Magazyn_Client/Magazyn/Magazyn.csproj | 7 + Magazyn_Client/Magazyn/MainWindow.xaml | 27 +- Magazyn_Client/Magazyn/MainWindow.xaml.cs | 236 ++++++++++-------- .../Magazyn/Views/FruitView.xaml.cs | 12 +- .../Magazyn/Windows/AmountWindow.xaml | 16 +- .../Magazyn/Windows/AmountWindow.xaml.cs | 141 ++++++----- .../Magazyn/Windows/ErrorWindow.xaml | 2 +- .../Magazyn/Windows/InfoWindow.xaml | 28 +++ .../Magazyn/Windows/InfoWindow.xaml.cs | 53 ++++ 13 files changed, 363 insertions(+), 254 deletions(-) create mode 100644 Magazyn_Client/Magazyn/Windows/InfoWindow.xaml create mode 100644 Magazyn_Client/Magazyn/Windows/InfoWindow.xaml.cs 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" > + + +