From 17620901e1995e261f8fcc319ebb92a8f9149b47 Mon Sep 17 00:00:00 2001 From: Paul Betts Date: Tue, 6 May 2014 16:39:32 -0700 Subject: [PATCH] Update the README --- README.md | 47 +++-------------------------------------------- 1 file changed, 3 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index b499858..ee2f5ea 100644 --- a/README.md +++ b/README.md @@ -15,55 +15,14 @@ The good news is, you don't have to know either of these two libraries above, using ModernHttpClient is the most boring thing in the world. Here's how it works: -On iOS: - ```cs -var httpClient = new HttpClient(new NSUrlSessionHandler()); -``` - -On Android: - -```cs -var httpClient = new HttpClient(new OkHttpNetworkHandler()); +var httpClient = new HttpClient(new NativeMessageHandler()); ``` ## How can I use this in a PCL? -Using ModernHttpClient from a PCL is fairly easy with some rigging, especially -if you've got some sort of IoC/DI setup - request an HttpClient in your PCL, -and register it in your app. However, here's what you can do without any -external dependencies: - -```cs -// In your PCL -public static class HttpClientFactory -{ - public static Func Get { get; set; } - - static HttpClientFactory() - { - Get = (() => new HttpClient()); - } -} - -// Somewhere else in your PCL -var client = HttpClientFactory.Get(); - -// In your iOS app (i.e. the startup of your app) -public static class AppDelegate -{ - public void FinishedLaunching(UIApplication app, NSDictionary options) - { - HttpClientFactory.Get = (() => new HttpClient(new NSUrlSessionHandler())); - } -} -``` - -## How can I use this in MvvmCross? - -Check out Michael Ridland's blog post, [Implementing ModernHttpClient in -MvvmCross](http://www.michaelridland.com/mobile/implementing-modernhttpclient-in-mvvmcross/), -for more information. +Just reference the Portable version of ModernHttpClient in your Portable +Library, and it will use the correct version on all platforms. ## Building