Skip to content

Instantly share code, notes, and snippets.

View dsplaisted's full-sized avatar

Daniel Plaisted dsplaisted

View GitHub Profile
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:local="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:text="Filename"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@dsplaisted
dsplaisted / PCLs and NuGet lib folders.md
Last active March 25, 2016 17:10
Portable Class Libraries and NuGet lib folders

(This is in response to the conversation started by this tweet asking why the portable HttpClient package has platform-specific library folders in addition to the portable folder.)

Sometimes in a portable library you want to be able to call APIs that aren't portable. The functionality may be exposed differently on different platforms, or you may want to "light up" and take advantage of functionality on platforms where it's available. Here are some blog posts about how to do this:

Also, see my [PCL Storag

@dsplaisted
dsplaisted / HttpClient and platform specific APIs.md
Last active December 19, 2015 18:38
Portable Facebook C# SDK, HttpClient, and platform specific APIs

(This is in response to this conversation on Twitter.)

I don't recommend using dynamic or reflection to call platform-specific APIs in most cases. Generally, create an abstraction and then implement it in a platform-specific API. The nice thing about our portable HttpClient package is that we do that for you so you pretty much don't have to worry about it.

WriteStreamBuffering can be disabled on WP8 (but not WP7). When using the latest RC of portable HttpClient 2.2 on WP8, we will disable it automatically for you under certain conditions. I believe those conditions are that you've disabled automatic redirection and authentication. @theesj can confirm that.

Here are some blog posts about calling platform-specific APIs from PCLs:

@dsplaisted
dsplaisted / gist:3852741
Created October 8, 2012 14:12
Zip C# Solution
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ionic.Zip;
using System.IO;
namespace ProjectZipper
{
class Program
@dsplaisted
dsplaisted / AsyncPortableTask.cs
Created July 8, 2012 05:36
Portable task wrappers
// An implementation of IPortableTask which wraps an actual Task.
// This has to go in a project targeting a platform or platforms which support Task and async/await
using System;
using System.Threading.Tasks;
namespace PortableTasks
{
public class AsyncPortableTask : IPortableTask
{