Ejemplo n.º 1
0
        async void UpdateSource()
        {
            ImageSource source = Element.Source;

            (Element as IImageController)?.SetIsLoading(true);

            if (Control != null)
            {
                bool success;
                if (source is FileImageSource fis)
                {
                    success = _image.LoadFromFile(fis.File);
                }
                else
                {
                    success = await _image.LoadFromImageSourceAsync(source);
                }

                if (!IsDisposed && success)
                {
                    (Element as IVisualElementController)?.NativeSizeChanged();
                    UpdateAfterLoading();
                }
            }

            if (!IsDisposed)
            {
                ((IImageController)Element).SetIsLoading(false);
            }
        }
Ejemplo n.º 2
0
        protected override EvasObject OnGetContent(Cell cell, string part)
        {
            if (part == ImagePart)
            {
                var imgCell   = cell as ImageCell;
                int pixelSize = Forms.ConvertToScaledPixel(imgCell.RenderHeight);
                if (pixelSize <= 0)
                {
                    pixelSize = this.GetDefaultHeightPixel();
                }

                var image = new Native.Image(Forms.NativeParent)
                {
                    MinimumWidth  = pixelSize,
                    MinimumHeight = pixelSize
                };
                image.SetAlignment(-1.0, -1.0);            // fill
                image.SetWeight(1.0, 1.0);                 // expand

                var task = image.LoadFromImageSourceAsync(imgCell.ImageSource);
                return(image);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        EvasObject GetImageIcon(EvasObject parent)
        {
            var image = new Native.Image(parent);

            _ = image.LoadFromImageSourceAsync(s_currentDragStateData.DataPackage.Image);
            return(image);
        }