forked from s434786/DINO_SCRUM
Pagination optymalization, infoWindow about fruits, deleted list of themes, focusing keyboard on value input
This commit is contained in:
parent
f16b345bfc
commit
1465eead02
@ -11,10 +11,10 @@ Global
|
|||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Debug|Any CPU.ActiveCfg = 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 = Release|Any CPU
|
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.Build.0 = Release|Any CPU
|
{C50EC6F3-86E6-405C-991F-1B4157C04B34}.Release|Any CPU.Build.0 = Debug|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
@ -5,6 +5,7 @@ using System.Data;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
namespace Magazyn
|
namespace Magazyn
|
||||||
{
|
{
|
||||||
@ -13,39 +14,7 @@ namespace Magazyn
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
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] });
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows.Media.Imaging;
|
||||||
|
|
||||||
namespace Magazyn.DataModels
|
namespace Magazyn.DataModels
|
||||||
{
|
{
|
||||||
@ -11,9 +12,13 @@ namespace Magazyn.DataModels
|
|||||||
int id;
|
int id;
|
||||||
string name;
|
string name;
|
||||||
int quantity;
|
int quantity;
|
||||||
|
int quantityMax;
|
||||||
float price;
|
float price;
|
||||||
string imageLink;
|
string imageLink;
|
||||||
|
|
||||||
|
BitmapImage imageSource;
|
||||||
|
|
||||||
|
|
||||||
public int Id
|
public int Id
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -38,6 +43,15 @@ namespace Magazyn.DataModels
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int QuantityMax
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return quantityMax;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public float Price
|
public float Price
|
||||||
{
|
{
|
||||||
get
|
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.id = id;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.quantity = quantity;
|
this.quantity = quantity;
|
||||||
|
this.quantityMax = quantityMax;
|
||||||
this.price = price;
|
this.price = price;
|
||||||
this.imageLink = imageLink;
|
this.imageLink = imageLink;
|
||||||
|
|
||||||
|
imageSource = new BitmapImage();
|
||||||
|
imageSource.BeginInit();
|
||||||
|
imageSource.UriSource = new Uri(imageLink);
|
||||||
|
imageSource.CacheOption = BitmapCacheOption.OnLoad;
|
||||||
|
imageSource.EndInit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,6 +76,9 @@
|
|||||||
<Compile Include="Windows\ErrorWindow.xaml.cs">
|
<Compile Include="Windows\ErrorWindow.xaml.cs">
|
||||||
<DependentUpon>ErrorWindow.xaml</DependentUpon>
|
<DependentUpon>ErrorWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="Windows\InfoWindow.xaml.cs">
|
||||||
|
<DependentUpon>InfoWindow.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Windows\ValueWindow.xaml.cs">
|
<Compile Include="Windows\ValueWindow.xaml.cs">
|
||||||
<DependentUpon>ValueWindow.xaml</DependentUpon>
|
<DependentUpon>ValueWindow.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@ -103,6 +106,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="Windows\InfoWindow.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="Windows\ValueWindow.xaml">
|
<Page Include="Windows\ValueWindow.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
@ -15,10 +15,9 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Magazyn"
|
xmlns:local="clr-namespace:Magazyn"
|
||||||
mc:Ignorable="d"
|
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" >
|
||||||
<Grid>
|
<Grid>
|
||||||
<ListBox x:Name="fruitList" Margin="10,51,10,89"/>
|
<ListBox MouseDoubleClick="fruitListMouseDoubleClick" x:Name="fruitList" Margin="10,51,10,89"/>
|
||||||
|
|
||||||
<Button Name="sum" Content="Wartość magazynu" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="35" Click="Value_Click" HorizontalAlignment="Right" Width="163"/>
|
<Button Name="sum" Content="Wartość magazynu" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="35" Click="Value_Click" HorizontalAlignment="Right" Width="163"/>
|
||||||
<Label Content="Lista owoców:" FontWeight="Bold" HorizontalAlignment="Left" Margin="10,4,0,0" VerticalAlignment="Top" Width="100"/>
|
<Label Content="Lista owoców:" FontWeight="Bold" HorizontalAlignment="Left" Margin="10,4,0,0" VerticalAlignment="Top" Width="100"/>
|
||||||
<Label Content="Nazwa owocu:" FontWeight="Bold" HorizontalAlignment="Left" Margin="91,25,0,0" VerticalAlignment="Top" Width="100"/>
|
<Label Content="Nazwa owocu:" FontWeight="Bold" HorizontalAlignment="Left" Margin="91,25,0,0" VerticalAlignment="Top" Width="100"/>
|
||||||
@ -30,7 +29,7 @@
|
|||||||
|
|
||||||
<Button x:Name="prevButton" Content="Poprzednia" HorizontalAlignment="Left" Margin="10,0,0,52" VerticalAlignment="Bottom" Width="105" Click="prevButton_Click"/>
|
<Button x:Name="prevButton" Content="Poprzednia" HorizontalAlignment="Left" Margin="10,0,0,52" VerticalAlignment="Bottom" Width="105" Click="prevButton_Click"/>
|
||||||
<Button x:Name="nextButton" Content="Następna" HorizontalAlignment="Right" Margin="0,0,10,52" VerticalAlignment="Bottom" Width="105" Click="nextButton_Click"/>
|
<Button x:Name="nextButton" Content="Następna" HorizontalAlignment="Right" Margin="0,0,10,52" VerticalAlignment="Bottom" Width="105" Click="nextButton_Click"/>
|
||||||
<ComboBox SelectionChanged="themeCombo_SelectionChanged" x:Name="themeCombo" HorizontalAlignment="Left" Margin="10,0,0,10" VerticalAlignment="Bottom" Width="162"/>
|
<TextBlock x:Name="pageBlock" FontSize="16" Margin="274,0,273,59" TextWrapping="Wrap" Text="NaN" Height="19" VerticalAlignment="Bottom"/>
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -34,21 +34,20 @@ namespace Magazyn
|
|||||||
|
|
||||||
HttpClient client;
|
HttpClient client;
|
||||||
|
|
||||||
|
Size windowSize;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Initialized += MainWindow_Initialized;
|
|
||||||
themeCombo.Items.Add("Jasno/Niebieski");
|
|
||||||
themeCombo.Items.Add("Jasno/Zielony");
|
|
||||||
themeCombo.Items.Add("Ciemno/Pomarańczowy");
|
|
||||||
themeCombo.SelectedIndex = 0;
|
|
||||||
|
|
||||||
client = new HttpClient();
|
client = new HttpClient();
|
||||||
|
this.Loaded += MainWindowLoaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MainWindow_Initialized(object sender, EventArgs e)
|
private void MainWindowLoaded(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
RefreshListOfFruits();
|
RefreshListOfFruits();
|
||||||
|
windowSize = new Size(this.Width, this.Height);
|
||||||
|
this.SizeChanged += Window_SizeChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void FruitViewSaveChangingAmountOfFruits(int amountChanged, Fruit fruit)
|
private void FruitViewSaveChangingAmountOfFruits(int amountChanged, Fruit fruit)
|
||||||
@ -85,6 +84,7 @@ namespace Magazyn
|
|||||||
|
|
||||||
private void RefreshListOfFruits()
|
private void RefreshListOfFruits()
|
||||||
{
|
{
|
||||||
|
pageBlock.Text = page.ToString();
|
||||||
|
|
||||||
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all?page=" + page.ToString() + "&size=" + size.ToString());
|
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all?page=" + page.ToString() + "&size=" + size.ToString());
|
||||||
while (response.IsCompleted != true) ;
|
while (response.IsCompleted != true) ;
|
||||||
@ -94,6 +94,10 @@ namespace Magazyn
|
|||||||
ErrorWindow window = new ErrorWindow("Nastąpił błąd połączenia z serwerem.");
|
ErrorWindow window = new ErrorWindow("Nastąpił błąd połączenia z serwerem.");
|
||||||
window.Owner = this;
|
window.Owner = this;
|
||||||
window.ShowDialog();
|
window.ShowDialog();
|
||||||
|
|
||||||
|
page = 0;
|
||||||
|
size = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,15 +157,25 @@ namespace Magazyn
|
|||||||
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
private void Window_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||||
{
|
{
|
||||||
Size size = e.NewSize;
|
Size size = e.NewSize;
|
||||||
double height = size.Height - 124;
|
|
||||||
this.size = (int)(height / 90);
|
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();
|
RefreshListOfFruits();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void themeCombo_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void fruitListMouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
var app = App.Current as App;
|
if (fruitList.SelectedItem != null)
|
||||||
app.ChangeTheme(themeCombo.SelectedIndex);
|
{
|
||||||
|
InfoWindow window = new InfoWindow((fruitList.SelectedItem as FruitView).fruit);
|
||||||
|
window.Owner = this;
|
||||||
|
window.ShowDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ namespace Magazyn.Views
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class FruitView : UserControl
|
public partial class FruitView : UserControl
|
||||||
{
|
{
|
||||||
Fruit fruit;
|
public Fruit fruit;
|
||||||
|
|
||||||
public delegate void ChangingAmountOfFruits(int amountChanged, Fruit fruit);
|
public delegate void ChangingAmountOfFruits(int amountChanged, Fruit fruit);
|
||||||
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
|
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
|
||||||
@ -42,7 +42,7 @@ namespace Magazyn.Views
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fruitImage.Source = new BitmapImage(new Uri(fruit.ImageLink));
|
fruitImage.Source = fruit.ImageSource;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -15,14 +15,14 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:Magazyn.Windows"
|
xmlns:local="clr-namespace:Magazyn.Windows"
|
||||||
mc:Ignorable="d"
|
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">
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="10,82,0,0" TextWrapping="Wrap" Text="fruitName" Width="64" Height="16" VerticalAlignment="Top"/>
|
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="10,82,0,0" TextWrapping="Wrap" Text="fruitName" Width="64" Height="16" VerticalAlignment="Top"/>
|
||||||
<TextBlock x:Name="messageBox" HorizontalAlignment="Left" Margin="80,10,0,0" TextWrapping="Wrap" Text="messageBox" VerticalAlignment="Top" Width="125" Height="64"/>
|
<TextBlock x:Name="messageBox" HorizontalAlignment="Left" Margin="80,10,0,0" TextWrapping="Wrap" Text="messageBox" VerticalAlignment="Top" Width="125" Height="64"/>
|
||||||
<TextBox x:Name="amountToChange" Margin="0,71,9,0" TextWrapping="Wrap" Text="0" RenderTransformOrigin="1.456,0.316" Height="32" VerticalAlignment="Top" HorizontalAlignment="Right" Width="64"/>
|
<TextBox x:Name="amountToChange" Margin="0,71,9,0" TextWrapping="Wrap" Text="" RenderTransformOrigin="1.456,0.316" Height="32" VerticalAlignment="Top" HorizontalAlignment="Right" Width="64"/>
|
||||||
<Button x:Name="saveButton" Content="Zastosuj" Margin="105,122,0,0" VerticalAlignment="Top" Click="saveButton_Click" Width="90" HorizontalAlignment="Left"/>
|
<Button x:Name="saveButton" Content="Zastosuj" Margin="0,0,9,10" VerticalAlignment="Bottom" Click="saveButton_Click" Width="90" HorizontalAlignment="Right"/>
|
||||||
<Button x:Name="cancelButton" Content="Anuluj" Margin="10,122,0,0" VerticalAlignment="Top" Click="cancelButton_Click" Width="90" HorizontalAlignment="Left" />
|
<Button x:Name="cancelButton" Content="Anuluj" Margin="10,0,0,10" VerticalAlignment="Bottom" Click="cancelButton_Click" Width="90" HorizontalAlignment="Left" />
|
||||||
<Image x:Name="fruitImage" HorizontalAlignment="Left" Height="64" Margin="10,10,0,0" VerticalAlignment="Top" Width="64"/>
|
<Image x:Name="fruitImage" HorizontalAlignment="Left" Height="64" Margin="10,10,0,0" VerticalAlignment="Top" Width="64"/>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -29,6 +29,8 @@ namespace Magazyn.Windows
|
|||||||
public delegate void ChangingAmountOfFruits(int amountChanged);
|
public delegate void ChangingAmountOfFruits(int amountChanged);
|
||||||
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
|
public event ChangingAmountOfFruits SaveChangingAmountOfFruits;
|
||||||
|
|
||||||
|
bool focusLock = false;
|
||||||
|
|
||||||
public AmountWindow(Fruit fruit, int type, int quantity)
|
public AmountWindow(Fruit fruit, int type, int quantity)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -48,13 +50,20 @@ namespace Magazyn.Windows
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fruitImage.Source = new BitmapImage(new Uri(fruit.ImageLink));
|
fruitImage.Source = fruit.ImageSource;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show(ex.Message);
|
MessageBox.Show(ex.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.Loaded += AmountWindowLoaded;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AmountWindowLoaded(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
amountToChange.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SendNewQuantity()
|
private void SendNewQuantity()
|
||||||
|
28
Magazyn_Client/Magazyn/Windows/InfoWindow.xaml
Normal file
28
Magazyn_Client/Magazyn/Windows/InfoWindow.xaml
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<Window x:Class="Magazyn.Windows.InfoWindow"
|
||||||
|
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||||
|
TextElement.FontWeight="Regular"
|
||||||
|
TextElement.FontSize="13"
|
||||||
|
TextOptions.TextFormattingMode="Ideal"
|
||||||
|
TextOptions.TextRenderingMode="Auto"
|
||||||
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
|
FontFamily="{DynamicResource MaterialDesignFont}"
|
||||||
|
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:Magazyn.Windows"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Informacje o: " WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize">
|
||||||
|
<Grid>
|
||||||
|
<TextBlock x:Name="fruitName" Margin="79,10,9,0" TextWrapping="Wrap" Text="fruitName" Height="16" VerticalAlignment="Top"/>
|
||||||
|
<TextBlock x:Name="fruitPrice" Margin="79,31,10,0" TextWrapping="Wrap" Text="fruitPrice" Height="16" VerticalAlignment="Top"/>
|
||||||
|
<TextBlock x:Name="fruitQuantity" Margin="79,52,10,0" TextWrapping="Wrap" Text="fruitQuantity" Height="16" VerticalAlignment="Top"/>
|
||||||
|
<TextBlock x:Name="fruitQuantityMax" Margin="79,73,10,0" TextWrapping="Wrap" Text="fruitQuantityMax" Height="16" VerticalAlignment="Top"/>
|
||||||
|
<TextBlock x:Name="fruitValue" Margin="79,94,10,0" TextWrapping="Wrap" Text="fruitValue" Height="16" VerticalAlignment="Top"/>
|
||||||
|
<Button x:Name="okButton" Content="Ok" Margin="0,0,9,10" VerticalAlignment="Bottom" Click="okButton_Click" Width="75" HorizontalAlignment="Right"/>
|
||||||
|
<Image x:Name="fruitImage" HorizontalAlignment="Left" Height="64" Margin="10,10,0,0" VerticalAlignment="Top" Width="64"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
53
Magazyn_Client/Magazyn/Windows/InfoWindow.xaml.cs
Normal file
53
Magazyn_Client/Magazyn/Windows/InfoWindow.xaml.cs
Normal file
@ -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
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for InfoWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user