public void IF_ImageSelected(int positionDirectory, int positionImage, ImageSource imageSource, byte[] stream)
        {
            var item = galleryDirectories[CurrentParent].Images[positionImage];

            item.galleryImageXF.Checked = !item.galleryImageXF.Checked;
            CollectionGallery.ReloadData();

            if (item.galleryImageXF.Checked)
            {
                var options = new PHContentEditingInputRequestOptions()
                {
                };

                item.Image.RequestContentEditingInput(options, (contentEditingInput, requestStatusInfo) =>
                {
                    var Key = new NSString("PHContentEditingInputResultIsInCloudKey");
                    if (requestStatusInfo.ContainsKey(Key))
                    {
                        var valueOfKey = requestStatusInfo.ObjectForKey(Key);
                        if (valueOfKey.ToString().Equals("1"))
                        {
                            item.galleryImageXF.CloudStorage = true;
                        }
                        else
                        {
                            item.galleryImageXF.CloudStorage = false;
                            //item.Path = contentEditingInput.FullSizeImageUrl.ToString().Substring(7);
                        }
                    }
                });
            }
            else
            {
                item.galleryImageXF.OriginalPath = null;
            }

            if (imageSource != null)
            {
                item.galleryImageXF.ImageSourceXF = imageSource;
            }
            if (stream != null)
            {
                item.galleryImageXF.ImageRawData = stream;
            }

            var count = GetCurrentSelected().Count;

            if (count > 0)
            {
                ButtonDone.SetTitle("Done (" + count + ")", UIControlState.Normal);
            }
            else
            {
                ButtonDone.SetTitle("Done", UIControlState.Normal);
            }
        }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var color = UIColor.FromRGB(64, 64, 64);

            View.BackgroundColor = color;
            ButtonBack.SetImage(UIImage.FromBundle("arrow_left").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal), UIControlState.Normal);

            ViewTop.BackgroundColor = UIColor.Clear;
            //ViewTop.Layer.MasksToBounds = false;
            //ViewTop.Layer.ShadowOpacity = 1f;
            //ViewTop.Layer.ShadowOffset = new CGSize(0, 2);
            //ViewTop.Layer.ShadowColor = UIColor.Gray.CGColor;
            //ViewTop.Layer.CornerRadius = 0;

            ButtonSpinner.BackgroundColor = UIColor.Clear;
            ButtonSpinner.Font            = UIFont.SystemFontOfSize(13);
            ButtonSpinner.SetTitle("Select album", UIControlState.Normal);
            ButtonSpinner.Layer.CornerRadius = 3;
            ButtonSpinner.Layer.BorderColor  = UIColor.White.CGColor;
            ButtonSpinner.Layer.BorderWidth  = 1f;

            galleryCollectionSource = new GalleryCollectionSource(assets, this);

            CollectionGallery.RegisterNibForCell(UINib.FromName("GalleryItemPhotoViewCell", NSBundle.MainBundle), "GalleryItemPhotoViewCell");
            CollectionGallery.DataSource = galleryCollectionSource;
            CollectionGallery.SetCollectionViewLayout(GetLayoutWhenOrientaion(), true);

            ViewBottom.BackgroundColor       = color.ColorWithAlpha(0.7f);
            ButtonDone.Layer.BackgroundColor = UIColor.FromRGB(42, 131, 193).CGColor;
            ButtonDone.Layer.CornerRadius    = 12;
            ButtonDone.SetTitle("Done", UIControlState.Normal);

            ButtonBack.TouchUpInside += (object sender, EventArgs e) =>
            {
                OnPicked?.Invoke(new List <PhotoSetNative>());
                //DismissViewController(true, null);
            };

            ButtonDone.TouchUpInside += (object sender, EventArgs e) =>
            {
                OnPicked?.Invoke(GetCurrentSelected());
                //MessagingCenter.Send<SupportGalleryPickerController, List<PhotoSetNative>>(this, Utils.SubscribeImageFromGallery, GetCurrentSelected());
                //DismissModalViewController(true);
            };

            ButtonSpinner.TouchUpInside += (sender, e) => {
                ShowData();
            };

            InitShowDialog();
            FeetchAddPhotos();
        }
Ejemplo n.º 3
0
 private void SetDoneText()
 {
     try
     {
         var count = GetCurrentSelected().Count;
         if (count > 0)
         {
             ButtonDone.SetTitle("Done (" + count + ")", UIControlState.Normal);
         }
         else
         {
             ButtonDone.SetTitle("Done", UIControlState.Normal);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.StackTrace);
     }
 }
        void ReleaseDesignerOutlets()
        {
            if (ButtonBack != null)
            {
                ButtonBack.Dispose();
                ButtonBack = null;
            }

            if (ButtonDone != null)
            {
                ButtonDone.Dispose();
                ButtonDone = null;
            }

            if (ButtonSpinner != null)
            {
                ButtonSpinner.Dispose();
                ButtonSpinner = null;
            }

            if (CollectionGallery != null)
            {
                CollectionGallery.Dispose();
                CollectionGallery = null;
            }

            if (ViewBottom != null)
            {
                ViewBottom.Dispose();
                ViewBottom = null;
            }

            if (ViewTop != null)
            {
                ViewTop.Dispose();
                ViewTop = null;
            }
        }