public MainWindow() { InitializeComponent(); var host = new Host(); var profiler = new Profiler(x => _listBox.Dispatcher.Invoke(x)); DataContext = profiler; Task.Run(() => { while (true) { host.AcceptProfileClient(profiler); } }); }