public async Task GetModuleDownloadUriAsync()

in WindowsSmartInk/SmartInkLaboratory/Services/CustomVisionTrainingService.cs [81:109]


        public async Task<Uri> GetModuleDownloadUriAsync(Guid iterationId)
        {
            Export export;
            try
            {
                var exports = (await _trainingApi.GetExportsWithHttpMessagesAsync(_currentProject.Id, iterationId)).Body;

                if (exports.Count == 0)
                {
                    HttpOperationResponse<IList<Export>> result;
                    var response = await _trainingApi.ExportIterationWithHttpMessagesAsync(_currentProject.Id, iterationId, "onnx", "onnx12");
                    do
                    {
                        result = await _trainingApi.GetExportsWithHttpMessagesAsync(_currentProject.Id, iterationId);
                        await Task.Delay(1000);
                    } while (result.Body.Count == 0);
                    export = result.Body[0];
                }
                else
                    export = exports[0];

                var uri = new Uri(export.DownloadUri );
                return uri;
            }
            catch (Exception ex)
            {
                return null;
            }
        }