This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MsgHub | |
{ | |
public static MsgHub Instance = new MsgHub(); | |
public static void Send<TArgs> (TArgs args) | |
{ | |
var msg = args.GetType ().Name; | |
MessagingCenter.Send<MsgHub, TArgs> (Instance, msg, args); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Drawing; | |
using MonoTouch.Foundation; | |
using MonoTouch.UIKit; | |
namespace HexagonApp { | |
[Register ("AppDelegate")] | |
class AppDelegate : UIApplicationDelegate { | |
UIWindow window; | |
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BackgroundDownload | |
{ | |
public BackgroundDownload () | |
{ | |
} | |
NSUrlSessionDownloadTask downloadTask; | |
static NSUrlSession session; | |
public async Task DownloadFileAsync(Uri url, string destination) | |
{ | |
if (downloadTask != null) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class LocalCache { | |
static HashSet<string> tempKeys = new HashSet<string> (); | |
public static Task<Stream> GetCachedOrDownload (string key, Uri uri, bool temporary = true) | |
{ | |
return GetCachedOrDownload (key, uri, CreateNativeHttpClient, temporary); | |
} | |
public static Task<Stream> GetCachedOrDownload (string key, Uri uri, Func<HttpClient> createHttpClient, bool temporary = true) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using MonoTouch; | |
using MonoTouch.Foundation; | |
using MonoTouch.AssetsLibrary; | |
namespace StreamHelper | |
{ | |
/// <summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
{ |