forked from s434786/DINO_SCRUM
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
313540f4d8
@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<startup>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
</startup>
|
</startup>
|
||||||
|
<appSettings>
|
||||||
|
<add key="serverUrl" value="https://sysmag.herokuapp.com/api/"/>
|
||||||
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
@ -46,6 +46,7 @@
|
|||||||
<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>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.Xml" />
|
<Reference Include="System.Xml" />
|
||||||
<Reference Include="Microsoft.CSharp" />
|
<Reference Include="Microsoft.CSharp" />
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
<TextBlock x:Name="pageBlock" FontSize="16" Margin="274,0,273,25" TextWrapping="Wrap" Text="NaN" Height="19" VerticalAlignment="Bottom"/>
|
<TextBlock x:Name="pageBlock" FontSize="16" Margin="274,0,273,25" TextWrapping="Wrap" Text="NaN" Height="19" VerticalAlignment="Bottom"/>
|
||||||
<Label Content="Status:" HorizontalAlignment="Left" Margin="4,0,0,14" VerticalAlignment="Bottom" Grid.RowSpan="3"/>
|
<Label Content="Status:" HorizontalAlignment="Left" Margin="4,0,0,14" VerticalAlignment="Bottom" Grid.RowSpan="3"/>
|
||||||
<TextBlock Name="netStatus" HorizontalAlignment="Left" Margin="50,0,0,19" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Bottom" Grid.RowSpan="3"/>
|
<TextBlock Name="netStatus" HorizontalAlignment="Left" Margin="50,0,0,19" TextWrapping="Wrap" Text="TextBlock" VerticalAlignment="Bottom" Grid.RowSpan="3"/>
|
||||||
|
<TextBox x:Name="searchBox" TextWrapping="Wrap" Text="" HorizontalAlignment="Right" Width="120" Height="23" VerticalAlignment="Top" TextChanged="TextBox_TextChanged" />
|
||||||
|
<materialDesign:PackIcon Kind="Search" Height="23" Width="23" Margin="0,0,121,0" VerticalAlignment="Top" HorizontalAlignment="Right"/>
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
@ -22,6 +22,7 @@ using System.Net;
|
|||||||
using Magazyn.Windows;
|
using Magazyn.Windows;
|
||||||
using Magazyn.Tools;
|
using Magazyn.Tools;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Configuration;
|
||||||
|
|
||||||
namespace Magazyn
|
namespace Magazyn
|
||||||
{
|
{
|
||||||
@ -39,9 +40,14 @@ namespace Magazyn
|
|||||||
|
|
||||||
Size windowSize;
|
Size windowSize;
|
||||||
|
|
||||||
|
string serverUrl;
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
serverUrl = ConfigurationManager.AppSettings.Get("serverUrl");
|
||||||
|
|
||||||
client = new HttpClient();
|
client = new HttpClient();
|
||||||
this.Loaded += MainWindowLoaded;
|
this.Loaded += MainWindowLoaded;
|
||||||
netConn = checkInternetConnection();
|
netConn = checkInternetConnection();
|
||||||
@ -62,7 +68,7 @@ namespace Magazyn
|
|||||||
{
|
{
|
||||||
string json = "{\"id\": " + fruit.Id.ToString() + ", \"change\": " + amountChanged.ToString() + " }";
|
string json = "{\"id\": " + fruit.Id.ToString() + ", \"change\": " + amountChanged.ToString() + " }";
|
||||||
|
|
||||||
Task<HttpResponseMessage> response = client.PostAsync("https://sysmag.herokuapp.com/api/product/change-quantity", new StringContent(json, Encoding.UTF8, "application/json"));
|
Task<HttpResponseMessage> response = client.PostAsync(serverUrl+"product/change-quantity", new StringContent(json, Encoding.UTF8, "application/json"));
|
||||||
while (response.IsCompleted != true) ;
|
while (response.IsCompleted != true) ;
|
||||||
|
|
||||||
if (response.Result.StatusCode == HttpStatusCode.BadRequest)
|
if (response.Result.StatusCode == HttpStatusCode.BadRequest)
|
||||||
@ -92,14 +98,13 @@ namespace Magazyn
|
|||||||
|
|
||||||
private void RefreshListOfFruits()
|
private void RefreshListOfFruits()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (netConn)
|
if (netConn)
|
||||||
{
|
{
|
||||||
pageBlock.Text = (page+1).ToString();
|
pageBlock.Text = (page+1).ToString();
|
||||||
|
|
||||||
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-all?page=" + page.ToString() + "&size=" + size.ToString());
|
Task<HttpResponseMessage> response = client.GetAsync(serverUrl+"get-all?page=" + page.ToString() + "&size=" + size.ToString() + "&search=" + ((string.IsNullOrEmpty(searchBox.Text) || string.IsNullOrWhiteSpace(searchBox.Text)) ? "none" : searchBox.Text) );
|
||||||
while (response.IsCompleted != true) ;
|
while (response.IsCompleted != true) ;
|
||||||
|
|
||||||
if (response.Result.StatusCode != HttpStatusCode.OK)
|
if (response.Result.StatusCode != HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
ErrorWindow window = new ErrorWindow("Nastąpił błąd połączenia z serwerem.");
|
ErrorWindow window = new ErrorWindow("Nastąpił błąd połączenia z serwerem.");
|
||||||
@ -107,7 +112,6 @@ namespace Magazyn
|
|||||||
window.ShowDialog();
|
window.ShowDialog();
|
||||||
|
|
||||||
page = 0;
|
page = 0;
|
||||||
size = 0;
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -139,7 +143,7 @@ namespace Magazyn
|
|||||||
|
|
||||||
private WarehousePrice GetWarehousePrice()
|
private WarehousePrice GetWarehousePrice()
|
||||||
{
|
{
|
||||||
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-price-of-all");
|
Task<HttpResponseMessage> response = client.GetAsync(serverUrl+"get-price-of-all");
|
||||||
while (response.IsCompleted != true) ;
|
while (response.IsCompleted != true) ;
|
||||||
|
|
||||||
WarehousePrice price = JsonConvert.DeserializeObject<WarehousePrice>(response.Result.Content.ReadAsStringAsync().Result.ToString());
|
WarehousePrice price = JsonConvert.DeserializeObject<WarehousePrice>(response.Result.Content.ReadAsStringAsync().Result.ToString());
|
||||||
@ -170,7 +174,7 @@ namespace Magazyn
|
|||||||
{
|
{
|
||||||
Size size = e.NewSize;
|
Size size = e.NewSize;
|
||||||
|
|
||||||
if( Math.Abs(windowSize.Height - size.Height) >= 40 )
|
if( Math.Abs(windowSize.Height - size.Height) >= 64 )
|
||||||
{
|
{
|
||||||
//size -> number of elementy by page
|
//size -> number of elementy by page
|
||||||
this.size = (int)((size.Height - 124) / 80);
|
this.size = (int)((size.Height - 124) / 80);
|
||||||
@ -200,6 +204,12 @@ namespace Magazyn
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void TextBox_TextChanged(object sender, TextChangedEventArgs e)
|
||||||
|
{
|
||||||
|
page = 0;
|
||||||
|
RefreshListOfFruits();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
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="Błąd" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize">
|
Title="Błąd" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize" Keyboard.KeyDown="Window_KeyDown">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Button x:Name="okButton" Content="Ok" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" Click="okButton_Click"/>
|
<Button x:Name="okButton" Content="Ok" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" Click="okButton_Click"/>
|
||||||
<TextBlock x:Name="messageBlock" FontSize="16" Margin="10,10,10,0" TextWrapping="Wrap" Text="messageBlock" VerticalAlignment="Top"/>
|
<TextBlock x:Name="messageBlock" FontSize="16" Margin="10,10,10,0" TextWrapping="Wrap" Text="messageBlock" VerticalAlignment="Top"/>
|
||||||
|
@ -29,5 +29,10 @@ namespace Magazyn.Windows
|
|||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Return) this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
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="Informacje o: " WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize">
|
Title="Informacje o: " WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize" Keyboard.KeyDown="Window_KeyDown">
|
||||||
<Grid>
|
<Grid>
|
||||||
<TextBlock x:Name="fruitName" Margin="79,10,9,0" TextWrapping="Wrap" Text="fruitName" Height="16" VerticalAlignment="Top"/>
|
<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="fruitPrice" Margin="79,31,10,0" TextWrapping="Wrap" Text="fruitPrice" Height="16" VerticalAlignment="Top"/>
|
||||||
|
@ -49,5 +49,10 @@ namespace Magazyn.Windows
|
|||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Return) this.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
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="Wartość magazynu" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize">
|
Title="Wartość magazynu" WindowStartupLocation="CenterOwner" Height="205" Width="220" ResizeMode="NoResize" Keyboard.KeyDown="Window_KeyDown">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Button x:Name="okButton" Content="Ok" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" Click="okButton_Click"/>
|
<Button x:Name="okButton" Content="Ok" HorizontalAlignment="Right" Margin="0,0,10,10" VerticalAlignment="Bottom" Width="75" Click="okButton_Click"/>
|
||||||
<TextBlock Margin="10,28,10,0" TextWrapping="Wrap" Text="Wartość magazynu to:" VerticalAlignment="Top" TextAlignment="Center" RenderTransformOrigin="0.495,1.734" />
|
<TextBlock Margin="10,28,10,0" TextWrapping="Wrap" Text="Wartość magazynu to:" VerticalAlignment="Top" TextAlignment="Center" RenderTransformOrigin="0.495,1.734" />
|
||||||
|
@ -29,5 +29,10 @@ namespace Magazyn.Windows
|
|||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private void Window_KeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Return) this.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user