This commit is contained in:
s426226 2021-01-18 13:20:12 +01:00
parent 8b51fa1310
commit 41c703bb6d

View File

@ -295,22 +295,20 @@ namespace Klient.Droid
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);
FindViewById<TextView>(Resource.Id.ErrorPhoto).Text = "Przesłano zdjęcie!"; FindViewById<TextView>(Resource.Id.ErrorPhoto).Text = "Przesłano zdjęcie!";
SetContentView(Resource.Layout.ekranZLinkami); SetContentView(Resource.Layout.ekranZLinkami);
var second_response = await client.GetAsync("http://10.0.2.2:5001/api/Search", jsonObject.response); var second_response = await client.GetAsync($"http://10.0.2.2:5001/api/Search/{jsonString}");
if (second_response.StatusCode == HttpStatusCode.OK) if (second_response.StatusCode == HttpStatusCode.OK)
{ {
var second_jsonString = await response.Content.ReadAsStringAsync(); var second_jsonString = await response.Content.ReadAsStringAsync();
dynamic second_jsonObject = JsonConvert.DeserializeObject(second_jsonString);
List<SearchResult> fullLink = JsonConvert.DeserializeObject<List<SearchResult>>(second_jsonObject); List<SearchResult> fullLink = JsonConvert.DeserializeObject<List<SearchResult>>(second_jsonString);
int end = 10; int end = 10;
if (fullLink.Count < 10) end = fullLink.Count; if (fullLink.Count < 10) end = fullLink.Count;
for (int i = 0; i < end; i++) for (int i = 0; i < end; i++)
{ {
FindViewById<TextView>(Resource.Id.links).Text = FindViewById<TextView>(Resource.Id.links).Text + fullLink[i].Title + ": " + fullLink[i].Link + "\n\n"; FindViewById<TextView>(Resource.Id.links).Text = FindViewById<TextView>(Resource.Id.links).Text + fullLink[i].title + ": " + fullLink[i].link + "\n\n";
} }
} }
else else
@ -348,7 +346,6 @@ namespace Klient.Droid
if(second_response.StatusCode == HttpStatusCode.OK) if(second_response.StatusCode == HttpStatusCode.OK)
{ {
var second_jsonString = await second_response.Content.ReadAsStringAsync(); var second_jsonString = await second_response.Content.ReadAsStringAsync();
List<SearchResult> fullLink = JsonConvert.DeserializeObject<List<SearchResult>>(second_jsonString); List<SearchResult> fullLink = JsonConvert.DeserializeObject<List<SearchResult>>(second_jsonString);
int end = 10; int end = 10;