private void OnTextureBrowserMessage(TextureBrowserMessage message) { Action action = () => { var dialog = new TextureBrowserWindow(this, message.OptFile); if (dialog.ShowDialog() == true) { message.TextureName = dialog.TextureName; } else { message.TextureName = null; } }; this.Dispatcher.Invoke(action); }