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" xmlns:local="clr-namespace:Magazyn"
StartupUri="MainWindow.xaml"> StartupUri="MainWindow.xaml">
<Application.Resources> <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.Resources>
</Application> </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> <WarningLevel>4</WarningLevel>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <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"> <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> <HintPath>..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference> </Reference>
@ -117,5 +123,11 @@
<Resource Include="Images\add.png" /> <Resource Include="Images\add.png" />
<Resource Include="Images\sub.png" /> <Resource Include="Images\sub.png" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Resource Include="Images\plus.png" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\minus.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> </Project>

View File

@ -1,15 +1,22 @@
<Window x:Class="Magazyn.MainWindow" <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="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="Fruit Warehouse" Height="350" Width="525"> Title="Fruit Warehouse" Height="400" Width="520">
<Grid> <Grid>
<ListBox x:Name="fruitList" Margin="10,10,90,35"/> <ListBox x:Name="fruitList" Margin="10,35,10,0" Height="239" VerticalAlignment="Top"/>
<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"/>
</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> </Window>

View File

@ -28,8 +28,10 @@ namespace Magazyn
public MainWindow() public MainWindow()
{ {
InitializeComponent(); InitializeComponent();
client = new HttpClient(); loadingContent.IsIndeterminate = true;
} client = new HttpClient();
RefreshListOfFruits();
}
private void Button_Click(object sender, RoutedEventArgs e) private void Button_Click(object sender, RoutedEventArgs e)
{ {
@ -49,13 +51,19 @@ namespace Magazyn
private void RefreshListOfFruits() private void RefreshListOfFruits()
{ {
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all"); loadingContent.Visibility = Visibility.Visible;
while (response.IsCompleted != true) ; 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()); Fruit[] fruits = JsonConvert.DeserializeObject<Fruit[]>(response.Result.Content.ReadAsStringAsync().Result.ToString());
UpdateListOfFruits(fruits); UpdateListOfFruits(fruits);
} }
private void UpdateListOfFruits(Fruit[] list) private void UpdateListOfFruits(Fruit[] list)
{ {
@ -81,8 +89,11 @@ namespace Magazyn
private void Button_Click_1(object sender, RoutedEventArgs e) 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" <UserControl
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="Magazyn.Views.FruitView"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Magazyn.Views" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
d:DesignHeight="64" d:DesignWidth="254"> xmlns:local="clr-namespace:Magazyn.Views"
<Grid> 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"/> <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}"> <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"/> <Image Source="..\Images\sub.png" Stretch="Fill"/>
@ -19,5 +35,5 @@
<Image x:Name="imges" HorizontalAlignment="Left" Height="64" VerticalAlignment="Top" Width="64"/> <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"/> <TextBlock x:Name="allPrice" HorizontalAlignment="Left" Margin="206,48,0,0" TextWrapping="Wrap" Text="allPrice" TextAlignment="Center" VerticalAlignment="Top" Width="48"/>
</Grid> </Grid>-->
</UserControl> </UserControl>

View File

@ -35,14 +35,14 @@ namespace Magazyn.Views
this.fruit = fruit; this.fruit = fruit;
fruitName.Text = fruit.Name; fruitName.Text = fruit.Name;
fruitAmount.Text = fruit.Quantity.ToString(); fruitAmount.Text = fruit.Quantity.ToString();
fruitPrice.Text = fruit.Price.ToString(); fruitPrice.Text = fruit.Price.ToString();
allPrice.Text = (fruit.Quantity * 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) catch (Exception ex)
{ {
@ -68,5 +68,5 @@ namespace Magazyn.Views
{ {
SaveChangingAmountOfFruits.Invoke(amountChanged, fruit); SaveChangingAmountOfFruits.Invoke(amountChanged, fruit);
} }
} }
} }

View File

@ -5,11 +5,11 @@
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="Change Quantity" Height="100" Width="300"> Title="Change Quantity" Height="100" Width="280">
<Grid> <Grid>
<TextBlock x:Name="fruitName" HorizontalAlignment="Left" Margin="10,10,0,0" TextWrapping="Wrap" Text="fruitName" VerticalAlignment="Top" Width="64"/> <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="10,0,0,10" TextWrapping="Wrap" Text="0" Width="64" Height="23" VerticalAlignment="Bottom"/> <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="207,0,10,10" VerticalAlignment="Bottom" Click="saveButton_Click"/> <Button x:Name="saveButton" Content="Save" Margin="175,0,10,10" VerticalAlignment="Bottom" Click="saveButton_Click" />
</Grid> </Grid>
</Window> </Window>

View File

@ -1,4 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <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" /> <package id="Newtonsoft.Json" version="12.0.1" targetFramework="net461" />
</packages> </packages>