private void OnApplicationStartup(object sender, StartupEventArgs e) { // Load configuration this.ConfigurationService.ConfigurationFileName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "config.xml"); this.ConfigurationService.Load(); this.AudioService.Start(); // Load and show the main window this.application.MainWindow = this.ViewModelService.CreateViewForViewModel <Window>(new MainWindowViewModel()); this.application.MainWindow.Show(); IEmulatorFactory factory = this.EmulatorFactories.SingleOrDefault(f => f.Metadata.EmulatorName == "NES").Value; this.emulator = factory.CreateInstance(); string rom = null; if (e.Args.Length >= 1) { rom = e.Args[0]; } // Start the emulator thread Task.Run(() => this.EmulatorThreadProc(rom)); }
protected IEmulator GetInstance() { IEmulatorFactory factory = this.EmulatorFactories.SingleOrDefault(e => e.Metadata.EmulatorName == "NES").Value; return(factory.CreateInstance()); }