private async void AppBarButtonPersonFaceRefresh_Click(object sender, RoutedEventArgs e) { List <ImageChannel> imageChannel = new List <ImageChannel>(); textBlockFace.Text = "Face - " + globals.gPersonSelected.name; if (null != globals.gPersonSelected && globals.gPersonSelected.name.Equals("...") == false) { appbarFaceRefreshButton.IsEnabled = false; personFaceProgressRing.IsActive = true; appbarFaceAddFromCameraButton.IsEnabled = false; appbarFaceAddFromFileButton.IsEnabled = false; appbarDeleteFaceButton.IsEnabled = false; //FaceImageCollection.Clear(); foreach (string persistedFaceId in globals.gPersonSelected.persistedFaceIds) { FaceData faceInfo = await PersonFaceCmds.GetPersonFace(globals.gPersonGroupSelected.personGroupId, globals.gPersonSelected.personId, persistedFaceId); if (null != faceInfo) { //BitmapImage bmpImage = new BitmapImage(new Uri(HttpHandler.storagePath + "thumbnails/" + faceInfo.userData)); //FaceImageCollection.Add(new ImageCollection(persistedFaceId, bmpImage, faceInfo)); imageChannel.Add(new ImageChannel() { ImagePath = faceInfo.userData, PersistedFaceId = persistedFaceId, FaceInfo = faceInfo }); } } personFaceListView.ItemsSource = imageChannel; personFaceProgressRing.IsActive = false; appbarFaceAddFromCameraButton.IsEnabled = true; appbarFaceAddFromFileButton.IsEnabled = true; appbarFaceRefreshButton.IsEnabled = true; } else { MessageDialog dialog = new MessageDialog("Person to be selected to find associated Faces", "Refresh Error"); await dialog.ShowAsync(); } }
public static async Task <FaceData> GetPersonFace(string personGroupId, string personId, string persistedFaceId) { FaceData face = null; string uri = HttpHandler.BaseUri + "/" + personGroupId + "/persons/" + personId + "/persistedFaces/" + persistedFaceId; HttpResponseMessage response = await HttpHandler.client.GetAsync(uri); if (response.IsSuccessStatusCode) { string responseBody = await response.Content.ReadAsStringAsync(); face = JsonConvert.DeserializeObject <FaceData>(responseBody); } else { string responseBody = await response.Content.ReadAsStringAsync(); globals.ShowJsonErrorPopup(responseBody); } return(face); }
public ImageCollection(string PersistedFaceId, BitmapImage Image, FaceData FaceInfo) { this.persistedFaceId = PersistedFaceId; this.image = Image; this.faceInfo = FaceInfo; }