Esempio n. 1
0
        void SetImage(LuaStream stream)
        {
            using (MemoryStream memoryStream = new MemoryStream())
            {
                Defines.CopyStream((Stream)stream.GetStream(), memoryStream);
                BitmapImage imageSource = new BitmapImage();

#if NETFX_CORE
                //TODO:Is there any other elegant solution for this.
                imageSource.SetSource(memoryStream.AsRandomAccessStream());
#else
                imageSource.SetSource(memoryStream);
#endif

                // Assign the Source property of your image
                ((Image)view).Source = imageSource;
            }
#if !NETFX_CORE
            ((Stream)stream.GetStream()).Close();
#endif
        }