0
0
forked from s434786/DINO_SCRUM

Merge branch 'master' of s442333/DINO_SCRUM into master

This commit is contained in:
s1202077 2019-01-22 17:16:17 +00:00 committed by Gogs
commit 0a5e4d37fa
6 changed files with 46 additions and 30 deletions

View File

@ -8,8 +8,8 @@
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Teal.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Blue.xaml" />
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Cyan.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>

View File

@ -1,20 +1,25 @@
<Window x:Class="Magazyn.MainWindow"
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"
mc:Ignorable="d"
Title="Magazyn Owoców
" Height="400" Width="520">
Title="Magazyn Owoców" Height="400" MaxWidth="590" MinWidth="590" Width="590">
<Grid>
<ListBox x:Name="fruitList" Margin="10,35,10,0" Height="239" VerticalAlignment="Top"/>
<ListBox x:Name="fruitList" Margin="10,35,10,50"/>
<Button Name="sum" Content="Wartość magazynu
" HorizontalAlignment="Left" Margin="325,0,0,46" VerticalAlignment="Bottom" Width="163" Height="35" Background="Teal" Click="Button_Click_1"/>
<ProgressBar Name="loadingContent" HorizontalAlignment="Left" Height="10" Margin="213,295,0,0" VerticalAlignment="Top" Width="100"/>
<Button Name="sum" Content="Wartość magazynu" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="35" Click="Button_Click_1" HorizontalAlignment="Right" Width="163"/>
<Label Content="Lista owoców:" FontWeight="Bold" HorizontalAlignment="Left" Margin="10,4,0,0" VerticalAlignment="Top" Width="100"/>

View File

@ -16,6 +16,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Magazyn
{
@ -28,7 +29,6 @@ namespace Magazyn
public MainWindow()
{
InitializeComponent();
loadingContent.IsIndeterminate = true;
client = new HttpClient();
RefreshListOfFruits();
}
@ -52,16 +52,15 @@ namespace Magazyn
private void RefreshListOfFruits()
{
loadingContent.Visibility = Visibility.Visible;
loadingContent.IsIndeterminate = true;
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all");
while (response.IsCompleted != true)
{
loadingContent.IsIndeterminate = false;
loadingContent.Visibility = Visibility.Hidden;
}
Fruit[] fruits = JsonConvert.DeserializeObject<Fruit[]>(response.Result.Content.ReadAsStringAsync().Result.ToString());
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all");
while (response.IsCompleted != true) ;
string responseString = response.Result.Content.ReadAsStringAsync().Result;
JObject replay = JObject.Parse(responseString);
Fruit[] fruits = JsonConvert.DeserializeObject<Fruit[]>(replay["content"].ToString());
UpdateListOfFruits(fruits);
}

View File

@ -9,8 +9,8 @@
mc:Ignorable="d" Height="64" Width="520">
<materialDesign:Card Height="64" Background="Teal">
<Grid Height="64">
<materialDesign:Card Background="{DynamicResource SecondaryAccentBrush}">
<Grid>
<Image Name="fruitImage" HorizontalAlignment="Left" Margin="10,10,0,7" Width="50"/>
<TextBlock Name="fruitName" HorizontalAlignment="Left" Margin="80,26,0,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" Width="116"/>
<Image Name="minusImage" HorizontalAlignment="Left" Height="24" Margin="240,25,0,0" VerticalAlignment="Top" Width="24" Source="/Images/minus.png" MouseDown="subButton_Click" />

View File

@ -54,6 +54,7 @@ namespace Magazyn.Views
{
AmountWindow window = new AmountWindow(fruit, -1, fruit.Quantity);
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
window.Owner = Application.Current.MainWindow;
window.ShowDialog();
}
@ -61,6 +62,7 @@ namespace Magazyn.Views
{
AmountWindow window = new AmountWindow(fruit, 1, fruit.Quantity);
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
window.Owner = Application.Current.MainWindow;
window.ShowDialog();
}

View File

@ -1,11 +1,21 @@
<Window x:Class="Magazyn.Windows.AmountWindow"
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="Magazyn" Height="205" Width="220">
Title="Magazyn" WindowStartupLocation="CenterOwner" Height="205" Width="220">
<Grid>
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="10,82,0,0" TextWrapping="Wrap" Text="fruitName" Width="64" Height="16" VerticalAlignment="Top"/>