Beispiel #1
0
        public async Task RegisterEmployee(string title, Person employee, MediaFile photo)
        {
            if (IsBusy)
            {
                return;
            }

            IsBusy = true;

            try
            {
                // Step 1 - Create Face List
                try
                {
                    await _faceServiceClient.GetLargePersonGroupAsync(groupId);
                }
                catch
                {
                    await _faceServiceClient.CreateLargePersonGroupAsync(groupId, title);
                }

                // Step 2 - Add people to face list

                var p = await _faceServiceClient.CreatePersonInLargePersonGroupAsync(groupId, employee.Name);

                await _faceServiceClient.AddPersonFaceInLargePersonGroupAsync(groupId, p.PersonId, photo.GetStream());

                // Step 3 - Train face group
                await _faceServiceClient.TrainLargePersonGroupAsync(groupId);

                await _faceServiceClient.GetLargePersonGroupTrainingStatusAsync(groupId);
            }

            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                UserDialogs.Instance.ShowError(ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }