diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-13 17:28:44 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-02-13 17:28:44 +0200 |
| commit | 7fd31b19dc4a836230bed3e4c38f5cc94e5d0a37 (patch) | |
| tree | a18bf1cf076a5fca4a48057e2b4e5320d0a71fde /Software/Visual_Studio/Tango.Settings | |
| parent | d55420499a73f2a3e8e50cf221ff1dd32f8a3d71 (diff) | |
| download | Tango-7fd31b19dc4a836230bed3e4c38f5cc94e5d0a37.tar.gz Tango-7fd31b19dc4a836230bed3e4c38f5cc94e5d0a37.zip | |
Implemented Digital In.
Diffstat (limited to 'Software/Visual_Studio/Tango.Settings')
| -rw-r--r-- | Software/Visual_Studio/Tango.Settings/SettingsManager.cs | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/Software/Visual_Studio/Tango.Settings/SettingsManager.cs b/Software/Visual_Studio/Tango.Settings/SettingsManager.cs index 8455cb91d..ca213cc3f 100644 --- a/Software/Visual_Studio/Tango.Settings/SettingsManager.cs +++ b/Software/Visual_Studio/Tango.Settings/SettingsManager.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using Tango.Logging; using Tango.Serialization; @@ -96,18 +97,34 @@ namespace Tango.Settings { if (IsInitialized) return; + IsInitialized = true; + LogManager.Log("Initializing application configuration..."); DefaultFilePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Twine", "Tango", "Settings.xml"); DefaultFolder = Path.GetDirectoryName(DefaultFilePath); + bool waited = false; + + Retry: + try { Default = LoadFromXML(DefaultFilePath); } catch (Exception ex) { - LogManager.Log(ex, "Could not load application configuration."); + if (!waited) + { + LogManager.Log(ex, "Could not load application configuration. Retrying in 1 second..."); + waited = true; + Thread.Sleep(1000); + goto Retry; + } + else + { + LogManager.Log(ex, "Could not load application configuration."); + } try { @@ -138,8 +155,6 @@ namespace Tango.Settings { LogManager.Log("Application configuration loaded successfully."); } - - IsInitialized = true; } } } |
