コード例 #1
0
        /// <summary>
        /// Attempts to get the image that should be displayed with the specified cell if it is available locally.
        /// </summary>
        /// <param name="cell">The cell to get the image for.</param>
        /// <returns>The image for the cell or null if an image is not currently available.</returns>
        protected virtual UIImage TryGetImageForCell(UIEntityTableViewCell <TEntity> cell)
        {
            if (this.imageCatalog == null)
            {
                throw new InvalidOperationException("A remote image catalog has not been set so remote image downloading is not available.");
            }

            return
                (this.imageCatalog.TryGetImage(
                     cell.ImageUrl,
                     cell.ImageOptions,
                     bytes => UIImageByteConverter.FromBytes(bytes, decompress: true)));
        }
コード例 #2
0
        private void HandleFinishedFinishedPickingMedia(
            UIImagePickerController imagePickerController,
            UIImagePickerMediaPickedEventArgs e,
            Action <byte[]> actionComplete)
        {
            UIImage image = e.Info[UIImagePickerController.EditedImage] as UIImage;

            if (image == null)
            {
                image = e.Info[UIImagePickerController.OriginalImage] as UIImage;
            }

            if (image == null)
            {
                throw new InvalidOperationException("An image was not found from the selection.");
            }

            imagePickerController.DismissViewController(true, () => { });
            actionComplete(UIImageByteConverter.ToBytesAsJpeg(image));
        }