private async Task TrainPersonGroup(PersonGroupItem groupItem) { if (groupItem != null) { try { await _client.TrainPersonGroupAsync((groupItem.Group.PersonGroupId)); groupItem.IsTraining = true; _trainingTimer.Start(); } catch (ClientException ce) { Debug.WriteLine(ce.Message); } } }
private void NewGroupButton_OnClick(object sender, RoutedEventArgs e) { var groupItem = new PersonGroupItem() {Group = new PersonGroup()}; SelectedPersonGroupItem = groupItem; _isSaveNew = true; }
private async Task LoadPersons(PersonGroupItem groupItem) { if(groupItem.Persons.Count > 0) groupItem.Persons.Clear(); try { var persons = await GetPersonsAsync(groupItem.Group.PersonGroupId); foreach (var person in persons) { groupItem.Persons.Add(person); } } catch (ClientException ex) { Debug.WriteLine(ex.Message); } }
private async Task AddPersonFaceAsync(PersonGroupItem groupItem, Guid personId, Guid faceId) { try { await _client.AddPersonFaceAsync(groupItem.Group.PersonGroupId, personId, faceId); await LoadPersons(groupItem); await TrainPersonGroup(groupItem); } catch (ClientException ce) { Debug.WriteLine(ce.Message); } }
private async Task LoadPersonGroupsAsync() { if(PersonGroups.Count > 0) PersonGroups.Clear(); var groups = await _client.GetPersonGroupsAsync(); foreach(var group in groups) { var groupItem = new PersonGroupItem() {Group = group}; try { var trainingResult = await _client.GetPersonGroupTrainingStatusAsync(group.PersonGroupId); groupItem.LastTrained = trainingResult.EndTime; } catch (ClientException ex) { // hopefully, this means the groupId had no entries for training Debug.WriteLine(ex.Message); } finally { PersonGroups.Add(groupItem); await LoadPersons(groupItem); } } }