1
0
forked from s442333/DINO_SCRUM

Zmiana GUI dodatnie MD

This commit is contained in:
Mati 2019-01-14 20:10:05 +01:00
parent 723a415808
commit d903b5b18d
10 changed files with 92 additions and 37 deletions

View File

@ -4,6 +4,13 @@
xmlns:local="clr-namespace:Magazyn"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<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.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>

Binary file not shown.

After

Width:  |  Height:  |  Size: 391 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 446 B

View File

@ -34,6 +34,12 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="MaterialDesignColors, Version=1.0.0.14576, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignColors.1.1.1\lib\net45\MaterialDesignColors.dll</HintPath>
</Reference>
<Reference Include="MaterialDesignThemes.Wpf, Version=2.5.0.1205, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\MaterialDesignThemes.2.5.0.1205\lib\net45\MaterialDesignThemes.Wpf.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
@ -117,5 +123,11 @@
<Resource Include="Images\add.png" />
<Resource Include="Images\sub.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\plus.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\minus.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -1,15 +1,22 @@
<Window x:Class="Magazyn.MainWindow"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
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="Fruit Warehouse" Height="350" Width="525">
<Grid>
<ListBox x:Name="fruitList" Margin="10,10,90,35"/>
<Button Content="Get List" Margin="0,10,10,0" VerticalAlignment="Top" Click="Button_Click" HorizontalAlignment="Right" Width="75"/>
<Button Content="Summary" Margin="0,0,90,10" Click="Button_Click_1" HorizontalAlignment="Right" Width="75" Height="20" VerticalAlignment="Bottom"/>
Title="Fruit Warehouse" Height="400" Width="520">
<Grid>
<ListBox x:Name="fruitList" Margin="10,35,10,0" Height="239" VerticalAlignment="Top"/>
</Grid>
<Button Name="sum" Content="Suma" HorizontalAlignment="Left" Margin="414,0,0,46" VerticalAlignment="Bottom" Width="74" Height="35" Background="Teal" Click="Button_Click_1"/>
<TextBox Name="payment" HorizontalAlignment="Left" Margin="404,322,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="84"/>
<Label Content="Do zapłaty:" FontWeight="Bold" HorizontalAlignment="Left" Margin="328,325,0,0" VerticalAlignment="Top" Width="76"/>
<ProgressBar Name="loadingContent" HorizontalAlignment="Left" Height="10" Margin="304,294,0,0" VerticalAlignment="Top" Width="100"/>
<Label Content="Lista owoców:" FontWeight="Bold" HorizontalAlignment="Left" Margin="10,4,0,0" VerticalAlignment="Top" Width="100"/>
</Grid>
</Window>

View File

@ -28,8 +28,10 @@ namespace Magazyn
public MainWindow()
{
InitializeComponent();
client = new HttpClient();
}
loadingContent.IsIndeterminate = true;
client = new HttpClient();
RefreshListOfFruits();
}
private void Button_Click(object sender, RoutedEventArgs e)
{
@ -49,13 +51,19 @@ namespace Magazyn
private void RefreshListOfFruits()
{
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all");
while (response.IsCompleted != true) ;
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());
UpdateListOfFruits(fruits);
}
}
private void UpdateListOfFruits(Fruit[] list)
{
@ -81,8 +89,11 @@ namespace Magazyn
private void Button_Click_1(object sender, RoutedEventArgs e)
{
MessageBox.Show("Value of warehouse: " + GetWarehousePrice().Price.ToString() );
payment.Text = GetWarehousePrice().Price.ToString();
//MessageBox.Show("Value of warehouse: " + GetWarehousePrice().Price.ToString() );
}
}
}
}

View File

@ -1,12 +1,28 @@
<UserControl x:Class="Magazyn.Views.FruitView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Magazyn.Views"
mc:Ignorable="d"
d:DesignHeight="64" d:DesignWidth="254">
<Grid>
<UserControl
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
x:Class="Magazyn.Views.FruitView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Magazyn.Views"
mc:Ignorable="d" Height="64" Width="520">
<materialDesign:Card Height="64" Background="Teal">
<Grid Height="64">
<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="238,25,0,0" VerticalAlignment="Top" Width="24" Source="/Images/minus.png" MouseDown="subButton_Click" />
<Image Name="plusImage" HorizontalAlignment="Left" Height="24" Margin="306,26,0,0" VerticalAlignment="Top" Width="24" Source="/Magazyn;component/Images/plus.png" RenderTransformOrigin="0.208,0.521" MouseDown="addButton_Click"/>
<TextBox Name="fruitAmount" HorizontalAlignment="Left" Height="35" Margin="267,14,0,0" VerticalAlignment="Top" Width="34" TextAlignment="Center"/>
<TextBlock Name="fruitPrice" Margin="362,26,106,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top" IsEnabled="False"/>
<TextBlock x:Name="allPrice" Margin="425,26,43,0" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Top"/>
</Grid>
</materialDesign:Card>
<!--<Grid>
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="69,0,0,48" TextWrapping="Wrap" Text="fruitName" Width="72"/>
<Button x:Name="subButton" BorderThickness="0" Padding="0" HorizontalAlignment="Left" Margin="138,21,0,27" Width="16" Click="subButton_Click" Background="{x:Null}">
<Image Source="..\Images\sub.png" Stretch="Fill"/>
@ -19,5 +35,5 @@
<Image x:Name="imges" HorizontalAlignment="Left" Height="64" VerticalAlignment="Top" Width="64"/>
<TextBlock x:Name="allPrice" HorizontalAlignment="Left" Margin="206,48,0,0" TextWrapping="Wrap" Text="allPrice" TextAlignment="Center" VerticalAlignment="Top" Width="48"/>
</Grid>
</Grid>-->
</UserControl>

View File

@ -35,14 +35,14 @@ namespace Magazyn.Views
this.fruit = fruit;
fruitName.Text = fruit.Name;
fruitAmount.Text = fruit.Quantity.ToString();
fruitPrice.Text = fruit.Price.ToString();
allPrice.Text = (fruit.Quantity * fruit.Price).ToString();
fruitName.Text = fruit.Name;
fruitAmount.Text = fruit.Quantity.ToString();
fruitPrice.Text = fruit.Price.ToString();
allPrice.Text = (fruit.Quantity * fruit.Price).ToString();
try
try
{
imges.Source = new BitmapImage(new Uri(fruit.ImageLink));
fruitImage.Source = new BitmapImage(new Uri(fruit.ImageLink));
}
catch (Exception ex)
{
@ -68,5 +68,5 @@ namespace Magazyn.Views
{
SaveChangingAmountOfFruits.Invoke(amountChanged, fruit);
}
}
}
}

View File

@ -5,11 +5,11 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Magazyn.Windows"
mc:Ignorable="d"
Title="Change Quantity" Height="100" Width="300">
<Grid>
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="fruitName" VerticalAlignment="Top" Width="64"/>
<TextBox x:Name="amountToChange" HorizontalAlignment="Left" Margin="10,0,0,10" TextWrapping="Wrap" Text="0" Width="64" Height="23" VerticalAlignment="Bottom"/>
<Button x:Name="saveButton" Content="Save" Margin="207,0,10,10" VerticalAlignment="Bottom" Click="saveButton_Click"/>
Title="Change Quantity" Height="100" Width="280">
<Grid>
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="10,36,0,0" TextWrapping="Wrap" Text="fruitName" VerticalAlignment="Top" Width="64"/>
<TextBox x:Name="amountToChange" HorizontalAlignment="Left" Margin="74,0,0,10" TextWrapping="Wrap" Text="0" Width="64" Height="32" VerticalAlignment="Bottom" RenderTransformOrigin="1.456,0.316"/>
<Button x:Name="saveButton" Content="Save" Margin="175,0,10,10" VerticalAlignment="Bottom" Click="saveButton_Click" />
</Grid>
</Grid>
</Window>

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MaterialDesignColors" version="1.1.1" targetFramework="net461" />
<package id="MaterialDesignThemes" version="2.5.0.1205" targetFramework="net461" />
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net461" />
</packages>