Update UI from background Thread

后端 未结 6 1313
悲&欢浪女
悲&欢浪女 2020-12-20 10:33

This is just a curious question. Which one is the best way to update UI from another thread. First, this one:

private delegate void MyDelegateMethod();
void          


        
6条回答
  •  一整个雨季
    2020-12-20 10:38

    Check out Roy Osherove's blog post on this: http://osherove.com/blog/2006/3/1/the-3-ways-to-create-a-thread-safe-gui-with-net-20-with-one.html

    delegate void Func(T t);
    Func del = delegate
    {
    
      // UI Code goes here
    };
    Invoke(del);
    

提交回复
热议问题