#VS2017 – Lessons learned migrating a UWP App from #Windows 8.1 to #Windows10 and how to replace Geolocation CivicAddress

Hi!

If you ever get bored, an 100% interesting activity is to try to update a project that has been closed 3 years ago or more. In my case, I have invested much time during these past days upgrading a Windows 8.1 to Windows 10 App.

Here’s a couple of things I’ve learned

  • Visual Studio 2017 is a thousand times better than previous Visual Studio versions to create UWP Apps. This point applies the saying “for tastes colors” in my case Visual Studio 2017 works great!
  • 3 years ago the most advisable option to share code/functionality between projects were to use Portable Class Libraries. Today this is very Old School, so I have migrated several projects to .Net Standard and it was not an easy path (ostias!)
  • I have suffered, in silence but pain was there. For example, .Net Standard its now in version 2.0, however, in order to create Net standard Class Libraries that can be used in UWP Apps, you have to “download” to version 1.4
  • No more CivicAddress. If you use localization functionality in your App, including values such as the country, city, zip code and State, the CivicAddress property has been declared obsolete from win 8.1

On this last point I will extend a bit. Well When you get the location in a UWP App, the 2 values that if returned are latitude and longitude. I was investigating a little bit about the best way to get an address from a point (latitude and longitude) and I came to this conclusion.

You can use services like the following where you must have a Developer key

Although thanks to StackOverflow I found a free service that with 4 lines solves the problem. This is OPENSTREETMAP and the following code is more than enough to understand how it works

A sample result in the next image

I1

that if, if your application requires a very intense use of this service, it is time to go back to Bing or Google to avoid a

System.Net.Http.HttpRequestException: ‘Response status code does not indicate success: 429 (Too Many Requests).’

I2

Happy Coding!

Greetings @ Toronto

El Bruno

References

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s