diff options
Diffstat (limited to 'Xamarin.Forms.Core/Application.cs')
-rw-r--r-- | Xamarin.Forms.Core/Application.cs | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Xamarin.Forms.Core/Application.cs b/Xamarin.Forms.Core/Application.cs index b084b52a..5df8ad6c 100644 --- a/Xamarin.Forms.Core/Application.cs +++ b/Xamarin.Forms.Core/Application.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.Threading; using System.ComponentModel; using System.Threading.Tasks; using Xamarin.Forms.Internals; @@ -16,13 +15,14 @@ namespace Xamarin.Forms readonly Lazy<PlatformConfigurationRegistry<Application>> _platformConfigurationRegistry; IAppIndexingProvider _appIndexProvider; + bool _isSaving; ReadOnlyCollection<Element> _logicalChildren; Page _mainPage; ResourceDictionary _resources; - static SemaphoreSlim SaveSemaphore = new SemaphoreSlim(1, 1); + bool _saveAgain; protected Application() { @@ -304,16 +304,16 @@ namespace Xamarin.Forms async Task SetPropertiesAsync() { - await SaveSemaphore.WaitAsync(); - try - { - await DependencyService.Get<IDeserializer>().SerializePropertiesAsync(Properties); - } - finally - { - SaveSemaphore.Release(); - } - + if (_isSaving) + { + _saveAgain = true; + return; + } + _isSaving = true; + await DependencyService.Get<IDeserializer>().SerializePropertiesAsync(Properties); + if (_saveAgain) + await DependencyService.Get<IDeserializer>().SerializePropertiesAsync(Properties); + _isSaving = _saveAgain = false; } class NavigationImpl : NavigationProxy |