Last active
January 1, 2016 16:59
-
-
Save zoint/8174654 to your computer and use it in GitHub Desktop.
Localization of App Settings for Windows Phone 8.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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