Skip to content

Instantly share code, notes, and snippets.

View NicoVermeir's full-sized avatar

NicoVermeir

View GitHub Profile
@NicoVermeir
NicoVermeir / ExtendedSelector.cs
Created August 30, 2013 09:03
extension of the LongListSelector in Windows Phone 8 to support binding to SelectedItem
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Phone.Controls;
namespace ExtendedControls
{
public class ExtendedSelector : LongListSelector
{
public static readonly DependencyProperty SelectedItemProperty =
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Windows;
using System.Windows.Controls;
using Microsoft.Phone.Controls;
namespace LongListSelectorAdd
{
public class ExtendedSelector : LongListSelector
using System;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using Xamarin.Forms;
namespace WrapPanelDemo.Controls
{
public class AwesomeWrappanel : Layout<View>
{
using (var client = new HttpClient())
{
var result = await client.GetAsync(Constants.ApiCallUrl);
}
public class RestClient
{
private static HttpClient _client;
public static HttpClient GetClientInstance()
{
if (_client == null)
_client = new HttpClient();
return _client;
private async Task FetchData()
{
var result = await RestClient.GetClientInstance().GetAsync(Constants.ApiCallUrl);
}
public class RestClient
{
private static HttpClient _client;
public static HttpClient GetClientInstance()
{
if (_client == null)
_client = new HttpClient
{
BaseAddress = new Uri(Constants.ApiBaseUrl)
public static HttpClient GetClientInstance()
{
if (_client == null)
{
var handler = new HttpClientHandler();
if (handler.SupportsAutomaticDecompression)
{
handler.AutomaticDecompression = DecompressionMethods.GZip |
DecompressionMethods.Deflate;
}
_client = new HttpClient(handler)
{
BaseAddress = new Uri(Constants.ApiBaseUrl)
};
_client.DefaultRequestHeaders.Clear();
_client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", UserInstance.AccessToken);
private async Task FetchData()
{
var service = new ResourcesService();
var result = await service.FetchAllResources();
//textblock is bound against Json
Json = result
}
public class ResourcesService