DvachBrowser.Assets.HttpTasks.HttpGetImageTask.ParseBitmap C# (CSharp) Method

ParseBitmap() private method

private ParseBitmap ( string uri, MemoryStream stream ) : void
uri string
stream System.IO.MemoryStream
return void
        private void ParseBitmap(string uri, MemoryStream stream)
        {
            BitmapSource bitmap = null;
            try
            {
                // the special case for gif images
                bitmap = this.DecodeGif(stream);

                // try to use the default way for all other images and for failed gif images
                if (bitmap == null)
                {
                    stream.Seek(0, SeekOrigin.Begin);
                    bitmap = new BitmapImage();
                    bitmap.SetSource(stream);
                }

                this.InvokeInUiThread(() => this.OnPostExecute(bitmap));
            }
            catch (Exception e)
            {
                this.InvokeOnErrorHandler(ErrorMessages.DownloadImageError);
            }
        }