Exemplo n.º 1
0
        public async Task <bool> InitImage()
        {
            if (string.IsNullOrWhiteSpace(Dados))
            {
                return(false);
            }

            var bytes = ImagemHelper.Base64ToBytes(Dados);

            using (InMemoryRandomAccessStream stream = new InMemoryRandomAccessStream())
            {
                using (DataWriter writer = new DataWriter(stream.GetOutputStreamAt(0)))
                {
                    writer.WriteBytes(bytes);
                    await writer.StoreAsync();
                }
                var image = new BitmapImage();
                await image.SetSourceAsync(stream);

                Image = image;
            }
            return(true);
        }
Exemplo n.º 2
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var base64 = value.ToString();

            return(ImagemHelper.Base64ToBytes(base64));
        }