Tired of always checking if you need to invoke or not on a thread. This method below will invoke the specified delegate on the specified target with the passed arguments.
////// Invokes the specified delegate on the specified target with the specified arguments. /// /// The delegate to invoke. /// The target for the invocation. /// The arguments for the invoke. private void invokeOnTarget(Delegate del, ISynchronizeInvoke target, params object[] args) { //if target requires invoke. if (target.InvokeRequired) { //invoke the delegate on the target target.BeginInvoke(del, args); } else { //invoke the delegate on this thread del.DynamicInvoke(args); } }