public MainWindow() { InitializeComponent(); var handler = RenderPanel.Handle; new Thread(() => { _game = new EditorGame(handler); _game.Run(); }).Start(); Closed += (s, e) => _game.Exit(); }