diff options
author | Juwon <juwon.ahn@samsung.com> | 2017-01-13 16:47:58 +0900 |
---|---|---|
committer | Kangho Hur <kangho.hur@samsung.com> | 2017-01-15 20:14:05 -0800 |
commit | 09a6758c03df6dc3e49c18e21d12058e0bd6be36 (patch) | |
tree | 9464dc8df1d904b9c142b3aafcba0806e0b6e037 | |
parent | e69a2d3a9fb468c65cdc9dbd88f81e3e5e5586de (diff) | |
download | xamarin-forms-09a6758c03df6dc3e49c18e21d12058e0bd6be36.tar.gz xamarin-forms-09a6758c03df6dc3e49c18e21d12058e0bd6be36.tar.bz2 xamarin-forms-09a6758c03df6dc3e49c18e21d12058e0bd6be36.zip |
Set ElmSharp.Color only when image loading has completed.
Change-Id: I073a2abf60c1f2ecb5e2e6d4163d0bc51a47cd5d
-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> |