예제 #1
0
        public override void OnTakePicturesComplete(MultiAssetEventArgs pictures)
        {
            if (pictures == null)
            {
                return;
            }
            ImagesAttach.Clear();
            ImagesToAddCount = pictures.Assets.Length;
            CallbacksCount   = 0;

            var imageManager = new PHImageManager();

            foreach (var asset in pictures.Assets)
            {
                imageManager.RequestImageData(asset,
                                              new PHImageRequestOptions {
                    DeliveryMode = PHImageRequestOptionsDeliveryMode.HighQualityFormat
                },
                                              (NSData data, NSString dataUti, UIImageOrientation orientation, NSDictionary info) =>
                {
                    double?latFinal = null;
                    double?lonFinal = null;
                    if (data != null)
                    {
                        GetLocationFromImageData(data, ref latFinal, ref lonFinal);
                    }

                    var picture = new CameraPicture {
                        Image = UIImage.LoadFromData(data), Data = data, Lat = latFinal, Lon = lonFinal
                    };
                    AddImagesIfRequired(picture);
                });
            }
        }
        async void Upload(CameraPicture picture)
        {
            var imageUrl = await Platform.CloudinarySDK.Upload(picture.Image.AsPNG().AsStream());

            await SL.Manager.PostSubmitContent(Challenge.ID, imageUrl, DescriptionText.Text, Platform.Lat, Platform.Lon, SubmitContentResponse);

            ResetUI();
        }
예제 #3
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            CameraPicture picture = Pictures != null ? Pictures[indexPath.Row] : null;

            var cell = (CollateralCollectionViewCell)collectionView.DequeueReusableCell(CollateralCollectionViewCell.ClassName, indexPath);

            if (picture != null)
                cell.UpdateCellData(picture);

            return cell;
        }
예제 #4
0
        public override void OnTakePictureComplete(CameraPicture picture)
        {
            if (picture == null)
            {
                return;
            }
            ImagesAttach.Clear();
            ImagesToAddCount = 1;
            CallbacksCount   = 0;

            AddImagesIfRequired(picture);
        }
 public override void OnTakePictureComplete(CameraPicture picture = null)
 {
     base.OnTakePictureComplete(picture);
     //SubmitChallenge(SubmitButton);
     if (picture == null)
     {
         SendToInstagram(ChallengeImage.Image);
         return;
     }
     ChallengeImage.Image = picture.Image;
     SendToInstagram(picture.Image);
 }
 public override void OnTakePictureComplete(CameraPicture picture)
 {
     ImageToUpload       = picture;
     PreviewImage.Image  = picture.Image;
     DeleteButton.Hidden = false;
     MarkStep(1, true);
     if (DidAllStepsComplete())
     {
         //AddPosterButton.Hidden = false;
         UpdateButton(false);
     }
 }
예제 #7
0
 private void AddImagesIfRequired(CameraPicture picture)
 {
     if (AllImagesCount >= TargetCount)
     {
         AlertImageSizeErrorIfFinished();
         return;
     }
     if ((picture.Data != null) && (picture.Data.Length > 5 * 1024 * 1024))
     {
         AlertImageSizeErrorIfFinished(true);
         return;
     }
     PreviewImage.Image = picture.Image;
     ImagesAttach.Add(picture);
     ShowAddDescriptionView();
     AlertImageSizeErrorIfFinished();
 }
예제 #8
0
        public override void FinishedPickingMedia(UIImagePickerController picker, NSDictionary info)
        {
            picker.DismissModalViewController(true);

            var image  = info.ValueForKey(new NSString("UIImagePickerControllerOriginalImage")) as UIImage;
            var file   = info.ValueForKey(new NSString("UIImagePickerControllerImageURL")) as NSUrl;
            var refUrl = info.ValueForKey(new NSString("UIImagePickerControllerReferenceUrl")) as NSUrl;

            image = MaxResizeImage(image, 1080, 1080);
            CameraPicture picture = new CameraPicture();

            picture.Image = image;
            if (file != null)
            {
                picture.FileName = file.ToString();
            }

            CameraViewController.OnTakePictureComplete(picture);
        }
예제 #9
0
 public void UpdateCellData(CameraPicture picture)
 {
     ImageView.Image = picture.Image;
     ImageView.Layer.CornerRadius = SizeConstants.ScreenMultiplier * 8;
     ImageView.ClipsToBounds      = true;
 }