Ejemplo n.º 1
0
        public async Task LoadSettingsFileLocal()
        {
            // if successful set and invalidate
            // If not loadSettings again
            var SETTINGS_FILE_NAME = string.IsNullOrEmpty(LocalSettingsLocation) ? GlobalConfig.DEFAULT_SETTINGS_FILE_NAME : LocalSettingsLocation;

            try
            {
                await Task.Factory.StartNew(() =>
                {
                    if (fileHelper.FileExists(SETTINGS_FILE_NAME))
                    {
                        using (var stream = fileHelper.FileOpenRead("", SETTINGS_FILE_NAME))
                        {
                            try
                            {
                                if (stream != null)
                                {
                                    _settings = _settings.Deserialise(stream);
                                }
                            }
                            catch { }
                        }
                    }
                });
            }
            catch
            {
                throw new FileNotFoundException("Could not locate the local Settings file");
            }
        }
Ejemplo n.º 2
0
        public async Task LoadSettingsFileLocal()
        {
            // if successful set and invalidate
            // If not loadSettings again
            var SETTINGS_FILE_NAME = string.IsNullOrEmpty(LocalSettingsLocation) ? GlobalConfig.DEFAULT_SETTINGS_FILE_NAME : LocalSettingsLocation;

            try
            {
                var stream = await fileHelper.OpenStreamAsync(SETTINGS_FILE_NAME);

                if (stream != null)
                {
                    _settings = _settings.Deserialise(stream);
                }
            }
            catch
            {
                throw new FileNotFoundException("Could not locate the local Settings file");
            }
        }