REST service base class for Windows Phone 8.1 XAML apps

Communicating with a JSON based REST service is a task that many Windows Phone apps have to do. My apps sure do it a lot so I came up with a base class that I use in all of them, put it on Github and created a Nuget package, so your apps could use it to.

The usage of this base class is simple. Create your service class and inherit from BaseRestService. The minimum you need to do to make it work is to override the GetBaseUrl() method to set the base url for all the requests. You can (but do not have to) also override the GetRequestHeaders() method to set the default request headers.

public class MyDataService: BaseRestService
{
  protected override string GetBaseUrl()
  {
    return "my base url";
  }
  
  protected override Dictionary<string, string> GetRequestHeaders()
  {
    return new Dictionary<string, string>
    {
      {"Accept-Encoding", "gzip, deflate"},
      {"Accept", "application/json"},
    };
  }
}

and you can now use the following protected methods

[Read More]

AutoCompleteBox for Windows Store apps

There is no AutoCompleteBox control that can be used when building Windows Store apps in C# and XAML so I decided to create one, because I needed it for a project. Currently it supports only String collections and the selected value must be accessed using code behind, but this will hopefully change.

The AutoCompleteBox uses WinRT XAML Toolkit to show the watermark and Reactive Extensions so the users does not need to press enter, the results will show after they stop typing for a second.

The project is hosted on my Bitbucket so you can check it out at https://github.com/igorkulman/AutoCompleteBox, forks and code contributions are welcomed. Nuget package is available at https://nuget.org/packages/AutoCompleteBoxWinRT.

Installation using Nuget:

Install-Package AutoCompleteBoxWinRT

[Read More]
nuget  winrt