Example #1
0
        private static async Task <string> CreateAlbum(string albumName)
        {
            //// Create new album
            var albumItem = new Album {
                Name = albumName
            };

            await albumDataSource.albumTable.InsertAsync(albumItem);

            //// Add group item to view model
            AlbumDataSource.AddAlbum(new AlbumViewModel(albumItem.Id, albumItem.Name));

            return(albumItem.Id);
        }
Example #2
0
        public static async Task UploadPicture(UploadViewModel uploadForm)
        {
            var albumId = (uploadForm.SelectedAlbum.UniqueId == string.Empty) ? await AlbumDataSource.CreateAlbum(uploadForm.NewAlbumName) : uploadForm.SelectedAlbum.UniqueId;

            //// Add picture item to trigger insert operation which returns the SAS for the blob images
            var pictureItem = CreatePictureInstance(uploadForm, albumId);

            var pictureTable = App.MobileService.GetTable <Picture>();
            await pictureTable.InsertAsync(pictureItem);

            //// TODO: Upload picture directly to blob storage using SAS and the Storage Client library for Windows

            //// Add item to view model
            var group = AlbumDataSource.GetAlbum(albumId);

            group.Items.Add(new PictureViewModel(pictureItem.Id, pictureItem.Name, new Uri(pictureItem.ThumbnailUrl), new Uri(pictureItem.ImageUrl), pictureItem.Description, group));
        }