TGIMBA Windows Presentation Foundation (WPF) Client – Basic Client Complete with Delete and Web API Interface Functionality Added

Git  Code

Welcome back to the The Globe In My BucketList Application (TGIMBA) Windows Presentation Foundation (WPF) client creation. This blog post will be the final one since it completes the basic Create Read Update Delete (CRUD) functionality a client would need.  It is also separated from the back end system with a Representation State Transfer (REST) Application Program Interface (API) module. I also added the delete functionality because I forgot to in an earlier post (doh!) 🙂

To make this happen, I did end up breaking the Don’t Repeat Yourself (DRY) principle. Why would I do this after preaching about DRY? What kind of heresy is this? I am justifying this because this WPF client should be a separate Visual Studio (VS) 2015 project and because of that, no references to the website/web API VS 2015 solution I built this client in. I built it in the existing website/web API solution for quick development. Feel free to throw stones if you must 🙂

Soooo, moving some code from the Shared project’s Utility class into the one I created for the WPF project, I created a TgimbaApi class to handle the calls to the production API. As I started to reaquaint myself with C# GET and POST calls, I re-discovered (quite happily) that this code had already been written in the test project.

To port this over, I didn’t copy over the code verbatim. Instead, I kept the wrapper methods I created (i.e. ProcessUser(), ProcessRegistration(), etc) and then created a GET and POST method to minimize duplication. This is all in the TgimbaApi.cs class.

code1

Something to note. Somehow I was not property Base64 encoding the username and password while testing with the https://www.tgimba.com/api/Account endpoint and I was not able to see that until I used the localhost Tgimba site. However, getting the ‘https’ modifications out of the web.config so I could run as just http for local debugging is not a straight forward process. That is until I just found the pre-https version in source control (thank gosh for github!!!). However, Internet Explorer has finally gone around the bin and would not run this local project. Chrome also had some issues. However, the new Edge browser worked fun. I guess it is finally good bye Internet Explorer. Once I was able to run the localhost and Postman with a debug break point, I saw the issue.

Argh…the problem then came back. It did not completely go away (so far) until I deleted all of my localhost certificates as outlined in reference #1.

If you have VS 2015, you can pull the project down and run against the production https://www.tgimba.com site.

Stay tuned!

References:

1) https://stackoverflow.com/questions/19417219/ssl-connection-connection-reset-with-iisexpress/22818853#22818853

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