develop #10

Merged
s426229 merged 80 commits from develop into master 2021-01-27 18:32:19 +01:00
Showing only changes of commit b3732fc11d - Show all commits

View File

@ -301,23 +301,24 @@ namespace Klient.Droid
public async void GetUserHistory(View v) public async void GetUserHistory(View v)
{ {
SetContentView(Resource.Layout.ekranHistorii); SetContentView(Resource.Layout.ekranHistorii);
var response = await client.GetAsync("http://10.0.2.2:5001/api/History"); var response = await client.GetAsync("http://10.0.2.2:5001/api/History");
if (response.StatusCode == HttpStatusCode.OK) if (response.StatusCode == HttpStatusCode.OK)
{ {
var jsonString = await response.Content.ReadAsStringAsync(); var jsonString = await response.Content.ReadAsStringAsync();
dynamic jsonObject = JsonConvert.DeserializeObject(jsonString); dynamic jsonObject = JsonConvert.DeserializeObject(jsonString);
List<string> history = JsonConvert.DeserializeObject<List<string>>(jsonObject.history); List<string> history = JsonConvert.DeserializeObject<List<string>>(jsonObject.history);
int temp; int temp;
for(int i=0; i<10; i++) for (int i = 0; i < 10; i++)
{ {
temp = i + 1; temp = i + 1;
FindViewById<TextView>(Resource.Id.history).Text = FindViewById<TextView>(Resource.Id.history).Text + "\n" + temp + ". " + history[i]; FindViewById<TextView>(Resource.Id.history).Text = FindViewById<TextView>(Resource.Id.history).Text + "\n" + temp + ". " + history[i];
} }
} }
else else
{ {
FindViewById<TextView>(Resource.Id.history).Text = "Coś poszło nie tak!"; FindViewById<TextView>(Resource.Id.history).Text = "Coś poszło nie tak!";
} }
}
} }
} }