private async void BtGetPhotoClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) return; var client = new PhotosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); Image img = new Image { uid = this.tb_PhotoUidForEditPhoto.Text, title = this.tb_PhotoTitleForGetPhoto.Text, tags = this.tb_PhotoTagsForGetPhoto.Text, synopse = this.tb_PhotoSynopseForGetPhoto.Text }; Image returnedImage = await client.EditImageDetailsAsync(img); if (returnedImage != null) tblock_Result.Text = String.Format("Uri: {0}; tags: {1}; title: {2}; synopse: {3}", img.uid, img.tags, img.title, img.synopse); }
private async void BtPickPhotoClick(object sender, RoutedEventArgs e) { FileOpenPicker openPicker = new FileOpenPicker { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.PicturesLibrary }; openPicker.FileTypeFilter.Add(".jpg"); openPicker.FileTypeFilter.Add(".jpeg"); openPicker.FileTypeFilter.Add(".png"); StorageFile file = await openPicker.PickSingleFileAsync(); if (file != null) { App app = Application.Current as App; if (app == null) return; var client = new PhotosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); Image img = new Image { title = file.DisplayName, tags = file.DisplayName }; CreateImageResult createImageResult = await client.CreateImageAsync(file, img); this.tblock_Result.Text = createImageResult.ResponseResult; if (createImageResult.Img != null) this.tblock_Result.Text += " -> uri: " + createImageResult.Img.url; } else { this.tblock_Result.Text = "Error reading file"; } }