Created
July 26, 2013 16:36
-
-
Save snargledorf/6090313 to your computer and use it in GitHub Desktop.
This is an extension method for the Windows Form class that mimics the behavior of Androids Activity.runOnUiThread(Runnable) method.
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 RunOnUiThreadExtensionMethod | |
{ | |
public static void RunOnUiThread(this Form @this, Action action) | |
{ | |
if (@this.InvokeRequired) | |
{ | |
@this.BeginInvoke(action); | |
} | |
else | |
{ | |
action(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment