private void ShowImagesCollectionView() { if (AllowUserCompletion) { btnSubmitChallenge.UserInteractionEnabled = true; btnSubmitChallenge.SetBackgroundImage(UIImage.FromBundle("challenge-btn_submit"), UIControlState.Normal);//btnSubmitChallenge.Alpha = 1; } else { btnSubmitChallenge.UserInteractionEnabled = false; btnSubmitChallenge.SetBackgroundImage(new UIImage(), UIControlState.Normal);//btnSubmitChallenge.Alpha = 0.25f; } CollectionView.Hidden = false; bottomButtonsContainer.Hidden = false; vCameraCenter.Hidden = true; vDescriptionContainer.Hidden = true; submitContainer.Hidden = true; CameraButton.SetBackgroundImage(UIImage.FromBundle("challenge-btn_photo"), UIControlState.Normal); UploadedCountText.Text = AllImagesCount.ToString(); if (_collectionSource != null) { ImagesAttach.ForEach(x => x.Description = DescriptionText.Text); Images.AddRange(ImagesAttach); _collectionSource.Pictures = Images; RefreshCollections(); } }
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); }); } }
public override void OnTakePictureComplete(CameraPicture picture) { if (picture == null) { return; } ImagesAttach.Clear(); ImagesToAddCount = 1; CallbacksCount = 0; AddImagesIfRequired(picture); }
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(); }