Skip to content

Instantly share code, notes, and snippets.

@jonathanpeppers
Created August 20, 2012 19:35
Show Gist options
  • Save jonathanpeppers/3407041 to your computer and use it in GitHub Desktop.
Save jonathanpeppers/3407041 to your computer and use it in GitHub Desktop.
Execute for Xactware
using System;
using System.Threading;
using MonoTouch.Foundation;
using MonoTouch.UIKit;
namespace XactwareExample
{
public static class Execute
{
public static void OnBackgroundThread(NSAction backgroundAction, NSAction uiAction)
{
ThreadPool.QueueUserWorkItem (_ =>
{
backgroundAction();
OnUIThread (uiAction);
});
}
public static void OnUIThread(NSAction action)
{
UIApplication.SharedApplication.BeginInvokeOnMainThread (action);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment