Exemplo n.º 1
0
        public SettingService(IAmazonDataService amazonDataService, ISettingStore settingStore, ISerializer serializer)
        {
            _amazonDataService = amazonDataService;
            _settingStore      = settingStore;
            _serializer        = serializer;
            bool found;
            var  c = _settingStore.LoadAsEnum <CountryType>(CountryTypeKey, out found, roaming: true);

            if (found)
            {
                _amazonDataService.CountryType = c;
            }
            else
            {
                var locale = new Windows.Globalization.GeographicRegion().CodeTwoLetter;
                var type   = CountryType.US;
                switch (locale)
                {
                case "JP":
                    type = CountryType.Japan;
                    break;

                case "CA":
                    type = CountryType.Canada;
                    break;

                case "FR":
                    type = CountryType.France;
                    break;

                case "DE":
                    type = CountryType.Germany;
                    break;

                case "UK":
                    type = CountryType.UK;
                    break;
                }
                _amazonDataService.CountryType = type;
            }
        }