Automating the InvokeRequired code pattern

后端 未结 9 1184
醉话见心
醉话见心 2020-11-21 23:57

I have become painfully aware of just how often one needs to write the following code pattern in event-driven GUI code, where

private void DoGUISwitch() {
           


        
9条回答
  •  抹茶落季
    2020-11-22 00:26

    Create a ThreadSafeInvoke.snippet file, and then you can just select the update statements, right click and select 'Surround With...' or Ctrl-K+S:

    
    
      
    ThreadsafeInvoke Wraps code in an anonymous method passed to Invoke for Thread safety. SurroundsWith

提交回复
热议问题