// when the program is shutdown again public void OnProgramShutdown(object sender, ProcessEventArgs e) { Console.WriteLine($"Program stoppet: {e.processName}"); switch (e.processName) { // csgo case nameof(gameTitles.csgo): _csgoHandling.Shutdown(); break; // notepad case nameof(gameTitles.notepad): Console.WriteLine("Stoppet fra swtich"); break; } }
// when the program is started public void OnProgramRunning(object sender, ProcessEventArgs e) { Console.WriteLine($"Program startet: {e.processName}"); // compare running program with enum and do different things switch (e.processName) { // csgo case nameof(gameTitles.csgo): _csgoHandling.StartCsgoListening(); break; // notepad case nameof(gameTitles.notepad): Console.WriteLine("Startet fra swtich"); break; } }