forked from s434786/DINO_SCRUM
Bug fixed with value of warehouse button
This commit is contained in:
parent
b6ca8853a8
commit
fbb8fc120c
27
Magazyn_Client/Magazyn/DataModels/WarehousePrice.cs
Normal file
27
Magazyn_Client/Magazyn/DataModels/WarehousePrice.cs
Normal file
@ -0,0 +1,27 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Magazyn.DataModels
|
||||
{
|
||||
class WarehousePrice
|
||||
{
|
||||
float price;
|
||||
|
||||
public float Price
|
||||
{
|
||||
get
|
||||
{
|
||||
return price;
|
||||
}
|
||||
}
|
||||
|
||||
public WarehousePrice( [JsonProperty("price-of-all")] float price)
|
||||
{
|
||||
this.price = price;
|
||||
}
|
||||
}
|
||||
}
|
@ -58,6 +58,7 @@
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="DataModels\Fruit.cs" />
|
||||
<Compile Include="DataModels\WarehousePrice.cs" />
|
||||
<Compile Include="Views\FruitView.xaml.cs">
|
||||
<DependentUpon>FruitView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -69,16 +69,19 @@ namespace Magazyn
|
||||
}
|
||||
}
|
||||
|
||||
private string GetWarehousePrice()
|
||||
private WarehousePrice GetWarehousePrice()
|
||||
{
|
||||
Task<HttpResponseMessage> response = client.GetAsync("https://sysmag.herokuapp.com/api/get-price-of-all");
|
||||
while (response.IsCompleted != true) ;
|
||||
return response.Result.Content.ReadAsStringAsync().Result.ToString();
|
||||
|
||||
WarehousePrice price = JsonConvert.DeserializeObject<WarehousePrice>(response.Result.Content.ReadAsStringAsync().Result.ToString());
|
||||
|
||||
return price;
|
||||
}
|
||||
|
||||
private void Button_Click_1(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MessageBox.Show("Value of warehouse: " + GetWarehousePrice());
|
||||
MessageBox.Show("Value of warehouse: " + GetWarehousePrice().Price.ToString() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user