Using the C# Dispatcher in WPF Applications

后端 未结 3 1373
一向
一向 2020-11-29 00:45

I\'m building a chat client and am not 100% sure on how to use the dispatcher. So the question is I have a method as such:

public void LostConne         


        
3条回答
  •  天命终不由人
    2020-11-29 01:15

    I had problems with Application.Current.Dispatcher.BeginInvoke and the object.Invoke() methods.

    This worked for me:

    Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() =>
    {
         // code...
    }));
    

提交回复
热议问题