Calls the given function with the given arguments by passing it through the CrossThreadCall class. This ensures that the calls to the GUI functions happen on the correct thread.