Invoking Method on UI thread from within a Lock()
问题 I have two methods, MethodA & MethodB . MethodB has to run on the UI thread. I need them to run one after the other without allowing MethodC to run between them. MethodC is called when a user clicks on a lovely little button. What I did to ensure this is put a Lock around the code thus: lock (MyLock) { MethodA(param1, param2); MyDelegate del = new MyDelegate(MethodB); if (this.IsHandleCreated) this.Invoke(del); } And for MethodC : public void MethodC() lock (MyLock) { Do bewildering stuff....