private async void OnNewModelCreated(object sender, SpeakerRecognitionViewModel e) { try { this.Models.Add(e); // update local file with custom models await SpeakerRecognitionDataLoader.SaveCustomModelsToFileAsync(this.Models.Where(x => !x.IsPrebuiltModel)); } catch (Exception ex) { await Util.GenericApiCallExceptionHandler(ex, "Failure creating model"); } }
private async Task DeleteModelAsync(SpeakerRecognitionViewModel model) { try { this.Models.Remove(model); await SpeakerRecognitionDataLoader.SaveCustomModelsToFileAsync(this.Models.Where(x => !x.IsPrebuiltModel)); if (model.IdentificationProfileId != null) { await this.userProvidedSpeakerRecognitionService.DeleteProfileAsync(model.IdentificationProfileId, VoiceProfileType.TextIndependentIdentification); } } catch (Exception ex) { await Util.GenericApiCallExceptionHandler(ex, "Failure deleting model"); } }