0

When open Window in callback method of socket.BeginReceive , display error : The calling thread must be STA, because many UI components require this.

int id = pr.ReadInt32();
BinaryWriter bw = new BinaryWriter();
if (!InCall)
{
   string name = null;
   Incoming_Call IncmCall = new Incoming_Call();
   InCall = (bool)IncmCall.ShowDialog();        
  • 2
    Possible duplicate of [How do I create and show WPF windows on separate threads?](http://stackoverflow.com/questions/1111369/how-do-i-create-and-show-wpf-windows-on-separate-threads) – Steve Nov 24 '16 at 19:16

1 Answers1

0

Use Dispatcher.BeginInvoke to force UI thread to open a new window

Vijay
  • 663
  • 4
  • 15