in WindowsSmartInk/SmartInkLaboratory/Services/CustomVisionTrainingService.cs [54:79]
public Task<Iteration> TrainCurrentIterationAsync()
{
return Task.Run(async () => {
try
{
HttpOperationResponse<Iteration> result;
var response = await _trainingApi.TrainProjectWithHttpMessagesAsync(_currentProject.Id);
do
{
result = await _trainingApi.GetIterationWithHttpMessagesAsync(_currentProject.Id,response.Body.Id);
await Task.Delay(1000);
} while (result.Body.Status.ToLower() == "training");
return result.Body;
}
catch (HttpOperationException ex)
{
var response = JsonConvert.DeserializeObject<TrainingServiceResponse>(ex.Response.Content);
throw new TrainingServiceException { Response = response };
}
catch (Exception ex)
{
throw;
}
});
}