public void DeletePersonFace(Person person, Guid faceId)
 {
     try
     {
         Task.Run(() => Api.DeletePersonFaceAsync(person.GroupName.ToLowerInvariant(), person.Id.Value, faceId)).GetAwaiter().GetResult();
     }
     catch (FaceAPIException ex)
     {
         throw new FaceApiException(ex.ErrorMessage);
     }
 }
Beispiel #2
0
        /// <summary>
        /// 刪除人臉的動作
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void btnDeleteFace_Click(object sender, EventArgs e)
        {
            picFace.Image.Dispose();
            picFace.Image = null;
            string strFaceId = ((Models.CognitiveModels.ListItem)lbxFace.SelectedItem).Value;
            await face.DeletePersonFaceAsync(this.PersonGroupId, Guid.Parse(this.PersonId), Guid.Parse(strFaceId));

            string strFilePath = @"Faces\" + strFaceId;

            File.Delete(strFilePath);
            btnDeleteFace.Enabled = false;
            this.BindFace();
        }
Beispiel #3
0
        public async Task <IHttpActionResult> Reset(Guid id)
        {
            try
            {
                var faceClient = new FaceServiceClient(OxfordFaceKey);

                var person = await faceClient.GetPersonAsync(XebienzaPersonGroup, id);

                foreach (var faceId in person.PersistedFaceIds)
                {
                    await faceClient.DeletePersonFaceAsync(XebienzaPersonGroup, person.PersonId, faceId);
                }

                return(Ok());
            }
            catch (Exception e)
            {
                await _storage.LogAsunc("Error while processing message", Level.Error, e);

                return(InternalServerError(e));
            }
        }
Beispiel #4
0
 public async Task DeletePersonFaceAsync(string personGroupId, Guid personId, Guid faceId)
 {
     await RunTaskWithAutoRetryOnQuotaLimitExceededError(() => faceClient.DeletePersonFaceAsync(personGroupId, personId, faceId));
 }
Beispiel #5
0
 public async Task DeletePersonFace(string personGroupId, string personId, string faceId)
 {
     await faceServiceClient.DeletePersonFaceAsync(personGroupId, personId.ToGuid(), faceId.ToGuid());
 }
Beispiel #6
0
 /// <summary>
 /// Removes a face that is linked to a user
 /// </summary>
 /// <param name="personId">Guid personId</param>
 /// <param name="faceId">Guid faceId</param>
 /// <returns></returns>
 public async Task RemoveFaceAsync(Guid personId, Guid faceId)
 {
     await _faceApiClient.DeletePersonFaceAsync(MAGIC_MIRROR_GROUP, personId, faceId);
 }