Introduced InvokeInMainThread() method.