C# app to record currently focused window
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Program.cs 1014B

123456789101112131415161718192021222324252627282930313233343536
  1. namespace WindowMonitor
  2. {
  3. using System;
  4. using System.Configuration;
  5. using System.ServiceProcess;
  6. /// <summary>
  7. /// The main entry point. Starts the service either as a console app or
  8. /// registered with the service manager.
  9. /// </summary>
  10. internal static class Program
  11. {
  12. /// <summary>
  13. /// The main entry point for the application.
  14. /// </summary>
  15. public static void Main()
  16. {
  17. var service = new WindowMonitorService(ConfigurationManager.AppSettings["ProcessMatcher"]);
  18. if (Environment.UserInteractive)
  19. {
  20. service.Startup();
  21. Console.WriteLine("Service started; Press <enter> to stop.");
  22. Console.ReadLine();
  23. service.Shutdown();
  24. }
  25. else
  26. {
  27. ServiceBase.Run(new ServiceBase[]
  28. {
  29. service
  30. });
  31. }
  32. }
  33. }
  34. }