forked from s442333/DINO_SCRUM
Fixed bug with loading fruits. Added easy configurable colors in App.xaml. Some small bugs with resizing windows
This commit is contained in:
parent
0f835efe8c
commit
e2a0994fd2
@ -8,8 +8,8 @@
|
|||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml" />
|
<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:,,,/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/Primary/MaterialDesignColor.Blue.xaml" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Lime.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Cyan.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
@ -1,20 +1,25 @@
|
|||||||
<Window x:Class="Magazyn.MainWindow"
|
<Window x:Class="Magazyn.MainWindow"
|
||||||
|
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
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
|
Title="Magazyn Owoców" Height="400" MaxWidth="590" MinWidth="590" Width="590">
|
||||||
" Height="400" Width="520">
|
|
||||||
<Grid>
|
<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
|
<Button Name="sum" Content="Wartość magazynu" Margin="0,0,10,10" VerticalAlignment="Bottom" Height="35" Click="Button_Click_1" HorizontalAlignment="Right" Width="163"/>
|
||||||
" 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"/>
|
|
||||||
<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"/>
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace Magazyn
|
namespace Magazyn
|
||||||
{
|
{
|
||||||
@ -28,7 +29,6 @@ namespace Magazyn
|
|||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
loadingContent.IsIndeterminate = true;
|
|
||||||
client = new HttpClient();
|
client = new HttpClient();
|
||||||
RefreshListOfFruits();
|
RefreshListOfFruits();
|
||||||
}
|
}
|
||||||
@ -52,16 +52,15 @@ namespace Magazyn
|
|||||||
|
|
||||||
private void RefreshListOfFruits()
|
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);
|
UpdateListOfFruits(fruits);
|
||||||
}
|
}
|
||||||
|
@ -9,8 +9,8 @@
|
|||||||
mc:Ignorable="d" Height="64" Width="520">
|
mc:Ignorable="d" Height="64" Width="520">
|
||||||
|
|
||||||
|
|
||||||
<materialDesign:Card Height="64" Background="Teal">
|
<materialDesign:Card Background="{DynamicResource SecondaryAccentBrush}">
|
||||||
<Grid Height="64">
|
<Grid>
|
||||||
<Image Name="fruitImage" HorizontalAlignment="Left" Margin="10,10,0,7" Width="50"/>
|
<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"/>
|
<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" />
|
<Image Name="minusImage" HorizontalAlignment="Left" Height="24" Margin="240,25,0,0" VerticalAlignment="Top" Width="24" Source="/Images/minus.png" MouseDown="subButton_Click" />
|
||||||
|
@ -54,6 +54,7 @@ namespace Magazyn.Views
|
|||||||
{
|
{
|
||||||
AmountWindow window = new AmountWindow(fruit, -1, fruit.Quantity);
|
AmountWindow window = new AmountWindow(fruit, -1, fruit.Quantity);
|
||||||
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
|
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
|
||||||
|
window.Owner = Application.Current.MainWindow;
|
||||||
window.ShowDialog();
|
window.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,6 +62,7 @@ namespace Magazyn.Views
|
|||||||
{
|
{
|
||||||
AmountWindow window = new AmountWindow(fruit, 1, fruit.Quantity);
|
AmountWindow window = new AmountWindow(fruit, 1, fruit.Quantity);
|
||||||
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
|
window.SaveChangingAmountOfFruits += WindowSaveChangingAmountOfFruits;
|
||||||
|
window.Owner = Application.Current.MainWindow;
|
||||||
window.ShowDialog();
|
window.ShowDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,21 @@
|
|||||||
<Window x:Class="Magazyn.Windows.AmountWindow"
|
<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="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
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" Height="205" Width="220">
|
Title="Magazyn" WindowStartupLocation="CenterOwner" Height="205" Width="220">
|
||||||
|
|
||||||
<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"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user