Example #1
0
        private void RequestImage(string imageSource)
        {
            ClearCurrentHttpImageRequest();

            if (string.IsNullOrEmpty(imageSource))
            {
                ShowDefaultImage();
                return;
            }

            if (imageSource.ToUpper().StartsWith("HTTP"))
            {
                NewHttpImageRequested();

                _currentImageRequest           = new MvxImageRequest <T>(imageSource);
                _currentImageRequest.Complete += CurrentImageRequestOnComplete;
                _currentImageRequest.Error    += CurrentImageRequestOnError;
                _currentImageRequest.Start();
            }
            else
            {
                var image = ImageFromLocalFile(imageSource);
                if (image == null)
                {
                    ShowErrorImage();
                }
                else
                {
                    NewImageAvailable(image);
                }
            }
        }
Example #2
0
        private void ClearCurrentHttpImageRequest()
        {
            if (_currentImageRequest == null)
            {
                return;
            }

            _currentImageRequest.Complete -= CurrentImageRequestOnComplete;
            _currentImageRequest.Error    -= CurrentImageRequestOnError;

            _currentImageRequest = null;
        }