Ejemplo n.º 1
0
        private async Task ExecuteCameraMultiplePicPicCommand()
        {
            var Wait = UserDialogs.Instance.Loading("Wait...", Cancel(), "Cancel", true, MaskType.Black);

            Wait.Show();
            InitMedia();
            var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions());

            if (file == null)
            {
                return;
            }
            else
            {
                byte[] imageasbytes = null;
                using (var memorystream = new MemoryStream())
                {
                    file.GetStream().CopyTo(memorystream);
                    file.Dispose();
                    imageasbytes = memorystream.ToArray();
                }
                if (imageasbytes.Length > 0)
                {
                    imageasbytes = _IImageResize.ResizeImage(imageasbytes, 300, 400, 100);
                    Franchise_Secondar_Image.Add(new MultipleImage_Class
                    {
                        Image = imageasbytes
                    });
                    _Franchise_Multiple_Image = Franchise_Secondar_Image;
                }
            }
            Wait.Dispose();
        }
Ejemplo n.º 2
0
        private async Task SelectFranchiseMultiplePicAsync()
        {
            var Wait = UserDialogs.Instance.Loading("Wait...", Cancel(), "Cancel", true, MaskType.Black);

            Wait.Show();
            if (!CrossMedia.Current.IsPickPhotoSupported)
            {
                await App.Current.MainPage.DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK");

                return;
            }
            var file = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions
            {
                PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium
            });

            if (file == null)
            {
                return;
            }
            else
            {
                byte[] imageasbytes = null;
                using (var memorystream = new MemoryStream())
                {
                    file.GetStream().CopyTo(memorystream);
                    file.Dispose();
                    imageasbytes = memorystream.ToArray();
                }
                if (imageasbytes.Length > 0)
                {
                    imageasbytes = _IImageResize.ResizeImage(imageasbytes, 300, 400, 100);
                    Franchise_Secondar_Image.Add(new MultipleImage_Class
                    {
                        Image = imageasbytes
                    });
                    _Franchise_Multiple_Image = Franchise_Secondar_Image;
                }
            }
            Wait.Dispose();
        }