diff options
author | E.Z. Hart <hartez@users.noreply.github.com> | 2017-01-12 04:50:37 -0700 |
---|---|---|
committer | Rui Marinho <me@ruimarinho.net> | 2017-01-12 11:50:37 +0000 |
commit | 32df5c0ae5ad66e2ed25926d97b62c29f1b9e134 (patch) | |
tree | f4c0cd9dfc23726b63e15bbc255817e480ee18b1 /Xamarin.Forms.Core | |
parent | 1d58aaec70266cf8bbbd3f94d2dd55719263eccd (diff) | |
download | xamarin-forms-32df5c0ae5ad66e2ed25926d97b62c29f1b9e134.tar.gz xamarin-forms-32df5c0ae5ad66e2ed25926d97b62c29f1b9e134.tar.bz2 xamarin-forms-32df5c0ae5ad66e2ed25926d97b62c29f1b9e134.zip |
Don't set up the properties task until it's requested (#671)
Diffstat (limited to 'Xamarin.Forms.Core')
-rw-r--r-- | Xamarin.Forms.Core/Application.cs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/Xamarin.Forms.Core/Application.cs b/Xamarin.Forms.Core/Application.cs index ac9aa1b1..e089cf88 100644 --- a/Xamarin.Forms.Core/Application.cs +++ b/Xamarin.Forms.Core/Application.cs @@ -10,7 +10,7 @@ namespace Xamarin.Forms public class Application : Element, IResourcesProvider, IApplicationController, IElementConfiguration<Application> { static Application s_current; - readonly Task<IDictionary<string, object>> _propertiesTask; + Task<IDictionary<string, object>> _propertiesTask; readonly Lazy<PlatformConfigurationRegistry<Application>> _platformConfigurationRegistry; IAppIndexingProvider _appIndexProvider; @@ -30,7 +30,6 @@ namespace Xamarin.Forms Loader.Load(); NavigationProxy = new NavigationImpl(this); Current = this; - _propertiesTask = GetPropertiesAsync(); SystemResources = DependencyService.Get<ISystemResourcesProvider>().GetSystemResources(); SystemResources.ValuesChanged += OnParentResourcesChanged; @@ -94,7 +93,15 @@ namespace Xamarin.Forms public IDictionary<string, object> Properties { - get { return _propertiesTask.Result; } + get + { + if (_propertiesTask == null) + { + _propertiesTask = GetPropertiesAsync(); + } + + return _propertiesTask.Result; + } } internal override ReadOnlyCollection<Element> LogicalChildrenInternal |