Ejemplo n.º 1
0
 public ImageSwapper()
 {
     _imageResource = new AsyncImageResource();
     _imageResource.Property = _propertyOne;
     _imageResource.ImageLoadingComplete += new AsyncImageLoadComplete(imageResource_ImageLoadingComplete);
 }
Ejemplo n.º 2
0
        // Once image loading is complete this method is called and the visibility of the
        // two GUIImages is swapped.
        private void imageResource_ImageLoadingComplete(AsyncImageResource image)
        {
            lock (loadingLock) {
                if (_guiImageOne == null)
                    return;

                if (_filename == null) {
                    if (_guiImageOne != null) _guiImageOne.Visible = false;
                    if (_guiImageTwo != null) _guiImageTwo.Visible = false;
                    return;
                }

                _guiImageOne.ResetAnimations();
                if (_guiImageTwo != null) _guiImageTwo.ResetAnimations();

                // if we have a second backdrop image object, alternate between the two
                if (_guiImageTwo != null) {
                    if (_imageResource.Property.Equals(_propertyOne)) {
                        _guiImageOne.Visible = _active;
                        _guiImageTwo.Visible = false;
                    }
                    else {
                        _guiImageOne.Visible = false;
                        _guiImageTwo.Visible = _active;
                    }

                    imagesNeedSwapping = true;
                }

                // if no 2nd backdrop control, just update normally
                else _guiImageOne.Visible = _active;

                if (_loadingImage != null) _loadingImage.Visible = false;
            }
        }