diff options
author | Juwon <juwon.ahn@samsung.com> | 2017-01-13 16:47:58 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-03-24 13:19:00 +0900 |
commit | bbe8a66481ef27ca058fc3d33585c38e66231d2e (patch) | |
tree | a6467f671918a532112b98a94fa43e723b289693 /Xamarin.Forms.Platform.Tizen | |
parent | 6b44c214ff22040fd9648280882f469a2c369331 (diff) | |
download | xamarin-forms-bbe8a66481ef27ca058fc3d33585c38e66231d2e.tar.gz xamarin-forms-bbe8a66481ef27ca058fc3d33585c38e66231d2e.tar.bz2 xamarin-forms-bbe8a66481ef27ca058fc3d33585c38e66231d2e.zip |
Set ElmSharp.Color only when image loading has completed.
Change-Id: I073a2abf60c1f2ecb5e2e6d4163d0bc51a47cd5d
Diffstat (limited to 'Xamarin.Forms.Platform.Tizen')
-rwxr-xr-x[-rw-r--r--] | Xamarin.Forms.Platform.Tizen/Native/Image.cs | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/Xamarin.Forms.Platform.Tizen/Native/Image.cs b/Xamarin.Forms.Platform.Tizen/Native/Image.cs index 7321c5b1..5b64c435 100644..100755 --- a/Xamarin.Forms.Platform.Tizen/Native/Image.cs +++ b/Xamarin.Forms.Platform.Tizen/Native/Image.cs @@ -2,6 +2,7 @@ using ElmSharp; using EImage = ElmSharp.Image; using ESize = ElmSharp.Size; +using EColor = ElmSharp.Color; namespace Xamarin.Forms.Platform.Tizen.Native { @@ -11,6 +12,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native public class Image : EImage, IMeasurable { Aspect _aspect; + bool _imageLoadCompleted; /// <summary> /// Initializes a new instance of the <see cref="Xamarin.Forms.Platform.Tizen.Native.Image"/> class. @@ -46,18 +48,39 @@ namespace Xamarin.Forms.Platform.Tizen.Native } /// <summary> + /// Gets or sets the image color. + /// </summary> + public override EColor Color + { + get + { + return base.Color; + } + set + { + if (_imageLoadCompleted) + { + base.Color = value; + } + } + } + + /// <summary> /// Loads image data from the given <see cref="Xamarin.Forms.ImageSource"/> asynchronously. /// </summary> /// <returns>A task which will be completed when image data is loaded.</returns> /// <param name="source">Image source specifying from where the image data has to be loaded.</param> - public Task<bool> LoadFromImageSourceAsync(ImageSource source) + public async Task<bool> LoadFromImageSourceAsync(ImageSource source) { - IImageSourceHandler handler; - if (source != null && (handler = Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null) + IImageSourceHandler handler = Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType()); + + _imageLoadCompleted = false; + + if (source != null && handler != null) { - return handler.LoadImageAsync(this, source); + _imageLoadCompleted = await handler.LoadImageAsync(this, source); } - return Task.FromResult<bool>(false); + return _imageLoadCompleted; } /// <summary> |