C# - Update UI control thread-safe
public void ControlInvokeRequired(Control control, Action action) { if (control.InvokeRequired) control.Invoke(new MethodInvoker(delegate { action(); })); }