CreateAsync() public static method

public static CreateAsync ( MobileServiceFile file, TodoItem todoItem, Action deleteHandler ) : Task
file Microsoft.WindowsAzure.MobileServices.Files.MobileServiceFile
todoItem TodoItem
deleteHandler Action
return Task
示例#1
0
        public async Task LoadImagesAsync()
        {
            IEnumerable <MobileServiceFile> files = await this.itemManager.GetImageFilesAsync(todoItem);

            this.Images = new ObservableCollection <TodoItemImageViewModel>();

            foreach (var f in files)
            {
                var viewModel = await TodoItemImageViewModel.CreateAsync(f, this.todoItem, DeleteImage);

                this.Images.Add(viewModel);
            }
        }
示例#2
0
        private async void AddImage(object obj)
        {
            IPlatform mediaProvider   = DependencyService.Get <IPlatform>();
            string    sourceImagePath = await mediaProvider.TakePhotoAsync(App.UIContext);

            //var mediaPicker = new MediaPicker(App.UIContext);
            //var photo = await mediaPicker.TakePhotoAsync(new StoreCameraMediaOptions());

            if (sourceImagePath != null)
            {
                MobileServiceFile file = await this.itemManager.AddImage(this.todoItem, sourceImagePath);

                var image = await TodoItemImageViewModel.CreateAsync(file, this.todoItem, DeleteImage);

                this.images.Add(image);
            }
        }