Esempio n. 1
0
        public async Task Initialize()
        {
            //Log.Trace("Entered ConfigurationService.Initialize");

            if (this.IsLoading || this.IsLoaded)
            {
                return;
            }

            this.IsLoading = true;

            if (null == this.Configuration)
            {
                // get the local folder
                StorageFolder localFolder = await GetLocalStorageFolder();

                if (null != localFolder)
                {
                    // look in the local storage folder for the file
                    this.Configuration = await GetConfigurationFile(localFolder);
                }

                if (null == this.Configuration)
                {
                    // look in the root local folder for the file
                    this.Configuration = await GetConfigurationFile(ApplicationData.Current.LocalFolder);
                }

                // if we didn't find it
                if (null == this.Configuration)
                {
                    // look in the install location
                    this.Configuration = await GetConfigurationFile(Package.Current.InstalledLocation);
                }

                // if we still didn't find it
                if (null == this.Configuration)
                {
                    // get the default configuration
                    this.Configuration = ConfigurationFile.CreateDefault();
                }
            }

            this.IsLoaded  = true;
            this.IsLoading = false;

            //Log.Trace("Exiting ConfigurationService.Initialize");
        }