implemented total amount of API #19

This commit is contained in:
Manuel Kamper 2022-10-31 18:48:36 +01:00
parent 8a22d68fb2
commit 65ef154df8
2 changed files with 12 additions and 1 deletions

View File

@ -7,5 +7,6 @@ namespace Mk0.Software.Bildduplikate
public string response_code { get; set; }
public string response_desc { get; set; }
public List<APIResponsePayload> payload { get; set; }
public string totalDuplicates { get; set; }
}
}

View File

@ -545,7 +545,17 @@ namespace Mk0.Software.Bildduplikate
Duplicate d = new Duplicate(ReplacePath(pl.file1), ReplacePath(pl.file2), pl.id);
Duplicates.Add(d);
}
total = Duplicates.Count;
WebClient webClient2 = new WebClient();
webClient2.Headers[HttpRequestHeader.ContentType] = "application/json";
string json2 = webClient.UploadString(Properties.Settings.Default.ApiUrl + "?totalDuplicates", "");
var resObj2 = new JavaScriptSerializer().Deserialize<APIResponse>(json2);
if (resObj2.response_code != "200") { MessageBox.Show("Fehler", resObj2.response_desc, MessageBoxButtons.OK, MessageBoxIcon.Error); }
else
{
total = int.Parse(resObj2.totalDuplicates);
}
LoadDuplicates(line, true);
}
}