Пример #1
0
        internal override void ReadXmlInternal(XmlReader reader)
        {
            string str;

            base.ReadXmlInternal(reader);
            if ((reader.NodeType == ((XmlNodeType)((int)XmlNodeType.Element))) && ((str = reader.Name) != null))
            {
                if (str != "SerializationMode")
                {
                    if (str != "ImageSource")
                    {
                        if (str == "Stretch")
                        {
                            _stretch = (Stretch)Serializer.DeserializeObj(typeof(Stretch), reader);
                        }
                        return;
                    }
                }
                else
                {
                    _serializationMode = (PictureSerializationMode)Serializer.DeserializeObj(typeof(PictureSerializationMode), reader);
                    return;
                }
                _imageSource = Serializer.DeserializeImage(reader, out ImageByteArrayBase64String);
            }
        }
Пример #2
0
        public static Stream GetImageStream(ImageSource image, ImageFormat imageFormat, PictureSerializationMode mode)
        {
            //try
            //{
            //    BitmapImage bmp = image as BitmapImage;
            //    if (bmp == null)
            //        return null;

            //    Stream stream = null;
            //    Task loadImageTask = null;
            //    UIAdaptor.InvokeSync(() => loadImageTask = LoadImgAsync(bmp.UriSource, stream));
            //    while (true)
            //    {
            //        if ((loadImageTask.IsCompleted || loadImageTask.IsCanceled) || loadImageTask.IsFaulted)
            //        {
            //            break;
            //        }
            //        new ManualResetEvent(false).WaitOne(50);
            //    }
            //    return stream;
            //}
            //catch { }
            //return null;

            // 功能未用到,hdt
            throw new NotImplementedException("未实现链接地址图片的序列化功能!");
        }