Skip to content

Instantly share code, notes, and snippets.

@zoint
Last active January 1, 2016 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoint/8174654 to your computer and use it in GitHub Desktop.
Save zoint/8174654 to your computer and use it in GitHub Desktop.
Localization of App Settings for Windows Phone 8.
using System;
using System.Globalization;
using MadWorldApps.Phone.Helpers.Interfaces;
namespace Places.BLL.Services
{
public enum DistanceType { Miles, Kilometers };
public class SettingsService : ISettingsService
{
private readonly IStorageRepository _storageRepository;
public SettingsService(IStorageRepository storageRepository)
{
_storageRepository = storageRepository;
}
public DistanceType GetDistanceType()
{
var distanceType = _storageRepository.GetApplicationSetting(SettingsKey.DistanceType.ToString());
if (distanceType == null)
return RegionInfo.CurrentRegion.IsMetric ? DistanceType.Kilometers : DistanceType.Miles;
return (DistanceType)Enum.Parse(typeof(DistanceType), distanceType);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment