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 BtDummyEchoClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new PhotosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); this.tblock_Result.Text = await client.DummyEchoAsync(this.tb_echoStr.Text); }
private async void BtGetUserAlbumsClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new PhotosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); Album[] albums = await client.GetUserAlbumsList(); foreach (Album album in albums) { this.tblock_Result.Text += String.Format("title: {0}, aid: {1}; ", album.title, album.id); } }
private async void BtGetUserImageListClick(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[] images = await client.GetUserImageList(); foreach (Image img in images) { this.tblock_Result.Text += String.Format("title: {0}, aid: {1}; ", img.title, img.uid); } }
private async void BtDeletePhotoClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new PhotosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); bool success = await client.DeleteImageAsync(this.tb_PhotoUidForDeletePhoto.Text); this.tblock_Result.Text = success ? String.Format("Photo with uid {0} sucessfully deleted", this.tb_PhotoUidForDeletePhoto.Text) : "Error!"; }
private async void BtGetUserTagsClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new PhotosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); string[] tags = await client.GetUserTags(); foreach (string tag in tags) { this.tblock_Result.Text += tag + "; "; } }
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"; } }
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 = await client.GetImageDetailsAsync(this.tb_PhotoUidForGetPhoto.Text); if (img != null) { tblock_Result.Text = String.Format("Uri: {0}, username: {1}, title: {2}, date: {3}", img.url, img.user.username, img.title, img.creationDate); } }
private async void BtCreateAlbumClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new PhotosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); Album album = new Album { title = this.tb_AlbumTitleForCreateAlbum.Text }; album = await client.CreateAlbumAsync(album); this.tblock_Result.Text = String.Format("Uri: {0}, username: {1}", album.url, album.user.username); }
private async void BtAddPhotoClick(object sender, RoutedEventArgs e) { App app = Application.Current as App; if (app == null) { return; } var client = new PhotosServiceClient(app.EsbUsername, app.EsbPassword, app.EsbAccessKey); //You MUST provide to albums for this example to work bool result = await client.AddImageToAlbums(this.tb_PhotoUidForAddPhotoToAlbum.Text, new int[] { Convert.ToInt32(this.tb_Album1AidForAddPhotoToAlbum.Text), Convert.ToInt32(this.tb_Album2AidForAddPhotoToAlbum.Text) }); this.tblock_Result.Text = result ? "Photo sucessfully added to the specified albums" : "Error!"; }