Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Detect preferred distance units #25

Open
sliekens opened this issue Sep 20, 2015 · 1 comment
Open

Detect preferred distance units #25

sliekens opened this issue Sep 20, 2015 · 1 comment

Comments

@sliekens
Copy link
Contributor

The zone completion assistant & the tasks tracker display distances in feet by default, but they should instead detect the preferred distance unit from the user's regional settings.

In

this.userData = new ZoneCompletionUserData();

if (this.userData == null)
{
    this.userData = new ZoneCompletionUserData();

    // Add this block
    if (System.Globalization.RegionInfo.CurrentRegion.IsMetric)
    {
        this.userData.DistanceUnits = Units.Meters;
    }
}

Gotcha: the value of RegionInfo.CurrentRegion is cached for the lifetime of the application. This will bite you sooner or later. When a user changes their regional settings, CurrentRegion remains whatever it was initialized to. You can clear the cache by explicitly calling CultureInfo.ClearCachedData().

@SamHurne
Copy link
Owner

I'm marking this as a feature request, although it could be argued this is more of a "how it should just be done" request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants