private void StartEmulation(string gamePath) { _cancellationTokenSource?.Cancel(); _joypad.ResetJoypadState(); Cartridge cartridge = Cartridge.LoadCartridge(gamePath); var nes = new NES(cartridge, _joypad); _cancellationTokenSource = new CancellationTokenSource(); Task.Factory.StartNew(() => RunGame(nes, _cancellationTokenSource.Token), TaskCreationOptions.LongRunning); }