public override void Train(SpeechEnroller.TrainCallback callback) { if (IsSessionOpen && !IsSessionClosing) { IsSessionClosing = true; EnrollResults.Clear(); Content.Clear(); Uri uri = Configuration.Server.BuildEndpoint(URI_PATH_TRAIN); Logger?.LogDebug("SpeechEnroller_HttpClient_Version1.Train(callback): URI: " + uri.ToString()); using (var request = BuildRequest(CallMode.Train, uri)) { var task = mHttpClient.SendAsync(request).ContinueWith((requestTask) => { if (requestTask.IsFaulted) { EnrollResult = SpeechEnroller.Result.Timeout; Logger?.LogError(requestTask.Exception); callback?.Invoke(EnrollResult); return; } HandleResponse(CallMode.Train, request, requestTask.Result).ContinueWith((responseTask) => { if (responseTask.IsFaulted) { EnrollResult = SpeechEnroller.Result.Timeout; Logger?.LogError(responseTask.Exception); callback?.Invoke(EnrollResult); return; } callback?.Invoke(EnrollResult); }); }); if (task.IsFaulted) { EnrollResult = SpeechEnroller.Result.Timeout; Logger?.LogError(task.Exception); callback?.Invoke(EnrollResult); } return; } } callback?.Invoke(EnrollResult = SpeechEnroller.Result.Invalid); }
public abstract void Train(SpeechEnroller.TrainCallback callback);